我试图在 oracle 中运行这个 sql 脚本并得到一个错误
ORA-00984: 此处不允许列。
declare
tablename varchar2(200):='imagesroom';
temp varchar2(50):='room_id';
iid number:=1;
dir varchar2(200):='imgdirroom';
in_fname varchar2(100):='img1.jpg';
obj ORDIMAGE;
ctx RAW(64) := NULL;
begin
execute immediate 'INSERT INTO '||tablename||'('||temp||',extension,icon)
VALUES(iid,'''',ORDImage(''FILE'',upper(dir),in_fname))
RETURNING icon INTO obj';
end;
/
ERROR at line 1:
ORA-00984: column not allowed here
ORA-06512: at line 10
这个很好用
INSERT INTO imagesroom(room_id,extension,icon)
VALUES(iid,'',ORDImage('FILE',upper(dir),in_fname))
RETURNING icon INTO obj;
它出什么问题了?
如果我这样做
execute immediate 'INSERT INTO :table(:type,extension,icon)
VALUES(:id,'''',ORDImage(''FILE'',upper(:dir),:fname)) RETURNING icon INTO obj'
using tablename,temp,iid,dir,in_fname;
然后
ERROR at line 1:
ORA-00903: invalid table name
ORA-06512: at line 10
出现...