【发布时间】:2015-03-03 06:09:03
【问题描述】:
我正在尝试使用从我的选择中检索到的 id 值,它是我的循环在我的插入语句中所基于的值。来自 select 的 id 和 TEST_LOG 表中的第二列都是 NUMBER(19,0)。当我用 12345 替换 id 时,它工作正常。有什么想法吗?
BEGIN
FOR id IN
(SELECT id FROM t_sample where children is null)
LOOP
INSERT INTO TEST_LOG VALUES (my_sequence.nextVal, id, 'sample', current_timestamp);
END LOOP;
END;
错误:
Error starting at line : 6 in command -
BEGIN
FOR id IN
(SELECT id FROM t_sample where children is null)
LOOP
INSERT INTO TEST_LOG VALUES (my_sequence.nextVal, id, 'sample', current_timestamp);
END LOOP;
END;
Error report -
ORA-06550: line 5, column 69:
PLS-00382: expression is of wrong type
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
【问题讨论】:
-
Id 应在插入中称为
id.id
标签: oracle