我正在尝试执行以下查询,但遇到无效标识符错误
EXECUTE IMMEDIATE 'create table temp parallel (degree 4) nologging as select e.* from employee e where e.emp_id between r0 and r1'; /
r0和r1作为数据类型为number的输入变量传递
uelo1irk1#
如果要在PL/SQL块中使用动态SQL,请尝试以下操作:
DECLARE r0 number := 100; r1 number := 1100; BEGIN EXECUTE IMMEDIATE 'CREATE TABLE temp parallel (degree 4) nologging AS SELECT * FROM employee WHERE emp_id BETWEEN '||r0||' AND '||r1||' '; END; /
mf98qq942#
r0和r1不是绑定变量:更改为:r0和:r1,并将USING子句添加到EXECUTE IMMEDIATE。(请阅读联机文档:(第10页)
2条答案
按热度按时间uelo1irk1#
如果要在PL/SQL块中使用动态SQL,请尝试以下操作:
mf98qq942#
r0和r1不是绑定变量:更改为:r0和:r1,并将USING子句添加到EXECUTE IMMEDIATE。(请阅读联机文档:(第10页)