Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: DBI + Oracle describe problem

by unixwzrd (Beadle)
on Feb 22, 2001 at 14:08 UTC ( [id://60173]=note: print w/replies, xml ) Need Help??


in reply to DBI + Oracle describe problem

If what you want is lots of information about the columns in a particular table that you can view, try this:
my $sql_statement = "select distinct column_name, column_id from all_tab_columns where table_name = upper('$table_name') order by column_id";
You can adjust what information you want by selecting additional columns from the ALL_TAB_COLUMNS view. Lots of goodies there.

I use this for dynamically creating persistent instances of objects and building the class attributes dynamically. Once I tighten up the code a bit more, I'll be posting my DB_Object class module here.

The reason for the select distinct is that in Oracle, if there is a SYNONYM, it will be listed along with the table information and it will be identical. COLUMN_NAME and COLUMN_ID are the minimums to get away with for the distinct.

Mike

"The two most common elements in the universe are hydrogen... and stupidity."
Harlan Ellison

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://60173]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 16:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found