BEGIN FOR i IN 1..10 LOOP INSERT INTO SHIFT (ShiftID, StartTime, EndTime, StoreID, EmployeeID) VALUES (i, SYSDATE - DBMS_RANDOM.VALUE(1, 7), SYSDATE - DBMS_RANDOM.VALUE(0, 6), i, i); END LOOP; COMMIT; END; 然后报错 FOR i IN 1..10 LOOP * ERROR at line 2: ORA-06550: line 2, column 5: PLS-00103: Encountered the symbol "FOR" when expecting one of the following: := . ( @ % ; The symbol "(" was substituted for "FOR" to continue. ORA-06550: line 2, column 20: PLS-00103: Encountered the symbol "LOOP" when expecting one of the following: , * & - + / at mod remainder rem when while => <an exponent (**)> by index sequence || multiset
时间: 2023-12-25 19:05:43 浏览: 138
原生js scrollbars滚动条插件设置浏览器竖直滚动条美化
这个错误是因为你的 SQL 语句不完整,无法被识别。这段代码看起来像是 PL/SQL 代码,但你没有写 DECLARE 开头的语句块声明变量。如果你想使用 PL/SQL 语法,可以将整段代码放在 BEGIN 和 END 之间,并在 DECLARE 声明区域定义变量。如果你只是想执行简单的 SQL 语句,则可以省略 BEGIN 和 END,直接执行 INSERT INTO ... VALUES ...; COMMIT; 即可。
阅读全文