how can i do this procedure? [message #288148] |
Sat, 15 December 2007 02:21 |
futi
Messages: 22 Registered: November 2007
|
Junior Member |
|
|
Hi...
For example, i have a procedure that print the each column of each row of EMPLOYEES table.
FOR REC IN CURSOR1
LOOP
DBMS_OUTPUT.PUT_LINE(rec.name);
DBMS_OUTPUT.PUT_LINE(rec.surname);
DBMS_OUTPUT.PUT_LINE(rec.salary);
END LOOP;
it is okey.
But i want to create a new procedure that gets the table name as an argument. Then, procedure print each column of each row of that table.
Such as:
CURSOR CURSOR1 IS SELECT * FROM argument1;
...
..
FOR REC IN CURSOR1
LOOP
DBMS_OUTPUT.PUT_LINE(rec.?);
DBMS_OUTPUT.PUT_LINE(rec.?);
DBMS_OUTPUT.PUT_LINE(rec.?);
END LOOP;
i dont know how much columns are in that table? it must be dynamic.
for example, sometimes there are 3 column, sometimes there 5. And i dont know what are the names of columns?(rec.????)
How can i create this dynamic procedure? I am waiting your helps.
thanks
|
|
|
|
|
|