还是有错哦!晕 Compilation errors for PROCEDURE MM_DEVELOP.UPDATE_TABLEError: PLS-00103: 出现符号 "QUERY_STR"在需要下列之一时: . ( * @ % & = - + < / > at in is mod not rem then <an exponent (**)> <> or != or ~= >= <= <> and or like between || 符号 "then" 被替换为 "QUERY_STR" 后继续。 Line: 18 Text: query_str:= 'update table '||tableName||' set vendor_id = '''||vendor_Id||''' where vendor_id = '''||vendor_Id2||'''' ;
create or replace procedure update_table (columnName in varchar2, vendorId in varchar2, vendorId2 in varchar2 ) is query_str varchar2(4000); vendor_Id varchar2(64); vendor_Id2 varchar2(64); cursor cl is select table_name from user_tab_columns m where m.COLUMN_NAME=columnName; tableName cl%rowtype; --tableName c1%rowtype; (1)cl拼写错误 begin vendor_Id:=vendorId; vendor_Id2:=vendorId2; open cl; fetch cl into tableName; --fetch c1 into tableName; (2)cl拼写错误 if cl%notfound then --if tableName%notfound (3)tableName不是游标属性 (4)少了then --query_str :='update table '||tableName||' set vendor_id ='||vendor_Id||' where vendor_id = '||vendor_Id2; query_str := 'update table '||tableName.table_name||' set vendor_id = '''||vendor_Id||''' where vendor_id = '''||vendor_Id2||'''' ; --(5)字符串拼写错误 (6)tableName.table_name 写明取出游标的字段名 execute immediate query_str; dbms_output.put_line('update success!'); end if; close cl; ---close c1; (6)拼写错误 end;
Compilation errors for PROCEDURE MM_DEVELOP.UPDATE_TABLEError: PLS-00103: 出现符号 "QUERY_STR"在需要下列之一时:
. ( * @ % & = - + < /
> at in is mod not rem then <an exponent (**)> <> or != or ~=
>= <= <> and or like between ||
符号 "then" 被替换为 "QUERY_STR" 后继续。
Line: 18
Text: query_str:= 'update table '||tableName||' set vendor_id = '''||vendor_Id||''' where vendor_id = '''||vendor_Id2||'''' ;
(columnName in varchar2,
vendorId in varchar2,
vendorId2 in varchar2
)
is
query_str varchar2(4000);
vendor_Id varchar2(64);
vendor_Id2 varchar2(64);
cursor cl is select table_name from user_tab_columns m where m.COLUMN_NAME=columnName;
tableName cl%rowtype; --tableName c1%rowtype; (1)cl拼写错误
begin
vendor_Id:=vendorId;
vendor_Id2:=vendorId2;
open cl;
fetch cl into tableName; --fetch c1 into tableName; (2)cl拼写错误
if cl%notfound then --if tableName%notfound (3)tableName不是游标属性 (4)少了then
--query_str :='update table '||tableName||' set vendor_id ='||vendor_Id||' where vendor_id = '||vendor_Id2;
query_str := 'update table '||tableName.table_name||' set vendor_id = '''||vendor_Id||''' where vendor_id = '''||vendor_Id2||'''' ; --(5)字符串拼写错误 (6)tableName.table_name 写明取出游标的字段名
execute immediate query_str;
dbms_output.put_line('update success!');
end if;
close cl; ---close c1; (6)拼写错误
end;