我执行以下查询:
declare
i number;
begin
execute immediate 'select count(1) from someTable' returning into i;
dbms_output.put_line(i);
end;
并得到此错误:returns子句必须与insert,update和delete一起使用!
答案 0 :(得分:1)
只是一个小的语法错误(没有RETURNING):
DECLARE
i NUMBER;
BEGIN
EXECUTE IMMEDIATE 'select count(1) from user_tables' INTO i;
dbms_output.put_line(i);
END;