Điều này sẽ thực hiện thủ thuật.
DECLARE
TNAME user_tables.table_name%TYPE;
CNAME user_tab_columns.column_name%TYPE;
CURSOR ct1
IS SELECT table_name from user_tables;
CURSOR ct2 IS SELECT column_name FROM user_tab_columns WHERE table_name =TNAME;
BEGIN
OPEN ct1;
LOOP
FETCH ct1 INTO TNAME;
EXIT WHEN ct1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('TABLENAME:-->'|| TRIM(TNAME));
OPEN ct2;
LOOP
FETCH ct2 INTO CNAME;
EXIT WHEN ct2%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(' '|| TRIM(CNAME));
END LOOP;
CLOSE CT2;
END LOOP;
CLOSE ct1;
END;