Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Generic function to display a specific row from any table

671581Nov 20 2008 — edited Nov 21 2008
Hi all,

I need some help to write a function in PL/SQL or Dynamic SQL (or both), to write a function that would take in parameters only the unique ID of the row to display and the name of the table to display (that could be any table with any format).

Actually we don't know in advance which table will be accessed, so we don't know the columns and their types until the function is called.

Once I get the row, I want to return a small table with a size of only one line containing the details of the row I looked for.

So the signature of the function would be something like: CREATE function displayDetailedRowFromAnyTable(uniqId in varchar2(25), tableName in varchar2(25)).

Hope the description is clear. I found in some forums some details about this kind of problems; however, the structure of the tables (ie. the columns name and their types) is always known in advance. In my case, I don't know those details until run time.

Any help would be greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2008
Added on Nov 20 2008
17 comments
1,224 views