任何人都可以帮我解决代码错误。
ORA-06550:第 20 行,第 33 列:
PLS-00306:调用“||”时参数的数量或类型错误
ORA-06550:第 20 行,第 12 列:
PL/SQL:语句被忽略
...条件1:如果我在参数化游标中明确输入值,那么直到第二个 FOR 循环才达到。并在打印“内部”语句后执行。条件2。如果我将变量作为参数,那么它会给出上述错误。
DECLARE
/* First cursor */
CURSOR get_tables IS
SELECT DISTINCT * FROM src_table_list tbl ;
/* Second cursor */
CURSOR get_columns(v_table_name varchar2) IS
SELECT SUBSTR (SYS_CONNECT_BY_PATH (column_name, ','), 2) csv
FROM (SELECT column_name , ROW_NUMBER () OVER (ORDER BY column_name ) rn,
COUNT (*) OVER () cnt
FROM USER_TAB_COLUMNS where table_name = v_table_name)
WHERE rn = cnt
-- and col.sn = v_sn
START WITH rn = 1
CONNECT BY rn = PRIOR rn + 1;
BEGIN
FOR i IN get_tables LOOP
dbms_output.put_line( 'Inside ' );
FOR j IN get_columns(i.table_name) LOOP
dbms_output.put_line('SELECT '|| j ||'FROM'||i.table_name||' ;' );
dbms_output.put_line( ' ' );
END LOOP;
END LOOP;
END;
/