I have a procedure witch takes a table as parameter and i must write into an sql file all details from that table like column names , type and constraints.Here is what I tried(This is a test code just to find out how to print all the info):
v_cursor_id := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(v_cursor_id , 'SELECT * FROM marks', DBMS_SQL.NATIVE);
v_ok := DBMS_SQL.EXECUTE(v_cursor_id );
DBMS_SQL.DESCRIBE_COLUMNS(v_cursor_id, v_total_coloane, v_rec_tab);
v_nr_col := v_rec_tab.first;
IF (v_nr_col IS NOT NULL) THEN
LOOP
DBMS_OUTPUT.PUT(v_rec_tab(v_nr_col).col_name);
DBMS_OUTPUT.PUT(' ');
v_tipColoana :=(v_rec_tab(v_nr_col).col_type);
case v_tipColoana
when 1 then DBMS_OUTPUT.PUT('varchar2');
when 2 then DBMS_OUTPUT.PUT('Number');
when 12 then DBMS_OUTPUT.PUT('date');
when 96 then DBMS_OUTPUT.PUT('CHAR');
end case;
EXIT WHEN (v_nr_col IS NULL);
END LOOP;
END IF;
DBMS_SQL.CLOSE_CURSOR(v_cursor_id);