Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to use relative column referencing in Oracle 1

Status
Not open for further replies.

endeavour

MIS
Mar 29, 2001
19
US
I have written a procedure which fixes a historical data problem I have in a database. The problem exists in columns of VARCHAR2 type in several different tables. My proceedure works for a hard-coded tablename.columnname but I would like for it to be able to accept a table name as a parameter and then work through all the VARCHAR2 columns for that table.

In MS Access I would do this using a column count and relative column referencing (tablename(0) for first column) to construct a loop. I have not found an equivalent in Oracle.

Is there an equivalent or is there a different approach I need to take?
 
You can not use relative references directly but you may create dynamic sql statements to execute looping through dictionary views user_tables and user_tab_columns. If you're on 8i use EXECUTE IMMEDIATE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top