CREATE OR REPLACE PROCEDURE ZAD_CZWARTE AS
row_num number;
sql_stmnt varchar2(200);
cursor kursor is
select table_name from user_tables;
tab_name varchar2(200);
BEGIN
FOR c_kur IN kursor LOOP
tab_name := c_kur.table_name;
--dbms_output.put_line(tab_name);
sql_stmnt :='SELECT COUNT(*) FROM :1';
execute immediate sql_stmnt into row_num using tab_name;
DBMS_OUTPUT.PUT_LINE(tab_name||' : '||row_num);
END LOOP;
END zad_czwarte;
问题出现了s a problem with execute immediate line. Anybody knows what
?一切似乎都适合我。任务是输出用户的表名,其中包含行数。
答案 0 :(得分:4)
您不能将物理表绑定为绑定变量。您的命令必须是sql_stmnt :='SELECT COUNT(*) FROM ' || tab_name;
,然后是execute immediate sql_stmnt into row_num;