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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.