我正在程序中执行这2个语句。Plsql动态sql语句
execute immediate 'create table temp_test(user_state varchar(100), user_goal varchar(100))';
insert into temp_test values('sunil','test');
它给我错误表未找到。
所以我只是想知道动态sql语句不会立即执行语句。
我正在程序中执行这2个语句。Plsql动态sql语句
execute immediate 'create table temp_test(user_state varchar(100), user_goal varchar(100))';
insert into temp_test values('sunil','test');
它给我错误表未找到。
所以我只是想知道动态sql语句不会立即执行语句。
你要做的刀片也是动态:
begin
execute immediate 'create table temp_test(user_state varchar(100), user_goal varchar(100))';
execute immediate 'insert into temp_test values('sunil','test');';
COMMIT ;
end;
应该
begin
execute immediate 'create table temp_test(user_state varchar(100), user_goal varchar(100))';
execute immediate 'insert into temp_test values(''sunil'',''test'')';
COMMIT ;
end;
感谢您的答案!我们如何在执行即时语句中插入变量?对不起,我是程序撰写新手:) :) –
您可以使用USING子句。检查链接http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/dynamic.htm –
是的,你是对的,动态SQL语句不会立即执行的语句。检查这个答案execute immediate create table and update table
中的示例7.1感谢您的回答!我们如何在执行即时语句中插入变量?对不起,我是程序写作的新手:) –
感谢您的回答!我们如何在执行即时语句中插入变量?对不起,我是新的程序写作:) –