Freitag, 22. August 2014

For Cursor Loop - Example

  set serveroutput on;
  --
  DECLARE
    v_anzahlDS NUMBER(20);
  BEGIN
    FOR n IN (SELECT owner, table_name
                FROM all_tables
               WHERE owner = 'SCOTT' order by 1)
    LOOP
      execute immediate 'select count(*) from '|| n.owner ||'.'|| n.table_name INTO v_anzahlDS;
      dbms_output.put_line(n.table_name || '   ' || v_anzahlDS);
    END LOOP;
  END;

Keine Kommentare: