那位大神帮我看看?那里有错误?
create or replace procedure ChangeInfo(tnum in number) as
SqlStr varchar(250);
begin
case
when tnum= 1 then
SqlStr:='select tt.owner,tt.object_name from test_table tt where tt.owner=''v''';
when tnum= 2 then
SqlStr:='select tt.owner,tt.object_name from test_table tt where tt.owner=''a''';
when tnum= 3 then
SqlStr:='select tt.owner,tt.object_name from test_table tt where tt.owner=''b''';
else
SqlStr:='select tt.owner,tt.object_name from test_table tt where tt.owner not in (''v'',''a'',''b'')';
end;
dbms_output.put_line(SqlStr);
end ;
Compilation errors for PROCEDURE CASIC.CHANGEINFO
Error: PLS-00103: 出现符号 ";"在需要下列之一时:
case
符号 "case" 被替换为 ";" 后继续。
Line: 13
Text: end;
[解决办法]
create or replace procedure ChangeInfo(tnum in number) as
SqlStr varchar(250);
begin
case
when tnum= 1 then
SqlStr:='select tt.owner,tt.object_name from test_table tt where tt.owner=''v''';
when tnum= 2 then
SqlStr:='select tt.owner,tt.object_name from test_table tt where tt.owner=''a''';
when tnum= 3 then
SqlStr:='select tt.owner,tt.object_name from test_table tt where tt.owner=''b''';
else
SqlStr:='select tt.owner,tt.object_name from test_table tt where tt.owner not in (''v'',''a'',''b'')';
end case ;
dbms_output.put_line(SqlStr);
end ;