create or replace function testProcfun (TableName in varchar, RowCount out int )
return int is
begin
query_str :='select count(*) from '||table_name||' ;
EXECUTE IMMEDIATE query_str ;
exception
end;
begin...end中的执行体改如何写?
...全文
553打赏收藏
做一个通过输入表名,输出该表的记录数的存储过程
create or replace function testProcfun (TableName in varchar, RowCount out int ) return int is begin query_str :='select count(*) from '||table_name||' ; EXECUTE IMMEDIATE query_str ; exception end; begin...end中的执行体改如何写?
create procedure testProcfun (TableName in varchar, RowCount number)
as
type myrctype is ref cursor;
cur1 myrctype;
sSQL varchar2(200);
begin
sSQL := 'select count(*) ct from '|| substrb(TableName,1,100);
open cur1 for sSQL;
fetch cur1 into RowCount;
close cur1;
end;
/