首页 > 解决方案 > Oracle 动态 SQL 中的缺失值错误。对于以下查询,其抛出缺失值关键字

问题描述

create or replace procedure temp_test_tb(A varchar2 ) is
lsql varchar(4000);
new_table_name varchar2(100);
fz_date timestamp(50);
begin
select timestamp(max(completion_dt)) into freeze_date from  status where  run_status=1;

new_table_name := 'common_' ||A|| '_' ||to_char(add_months(fz_date, -1), 'MON');

lsql:='insert into os_temp_tab_2'||
'select * from'||new_table_name||' WHERE ROWNUM<10';
execute immediate lsql;
commit;
end;

此查询引发错误

缺失值关键字

在甲骨文。我的插入表与插入表具有相同的列。

标签: sqloracledynamic

解决方案


from 之后缺少空格

' select * from '||new_table_name|| ' WHERE ROWNUM<10 ';

推荐阅读