2014-01-30 67 views
1
create or replace procedure add1(id1 integer, id integer) 
as 
begin 
    execute immediate 'create table section2(id integer)'; 
    execute immediate 'insert into section2 values(id1)'; 
end; 

顯示器錯誤插入語句的過程中

[ERR-312BA:柱這裏不允許:
0001:插入到第2節值(ID) ^^

我想直接插入不是值,但通過變量

+6

你使用什麼rdbms? – dasblinkenlight

+0

'這是一個韓文數據庫altibase isql' – user3245451

回答

1

這是因爲values expec ts正在執行的語句的常量和參數。儘管id1是一個參數,但它屬於存儲過程,而不屬於INSERT語句。

試試這個語句來代替:

execute immediate 'INSERT INTO section2(id) VALUES (:1)' USING id1; 

現在id1成爲參數:1的值,所以語句應正常運行。