Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

DBI and using Oracle desc

by Anonymous Monk
on Jun 28, 2007 at 11:49 UTC ( #623859=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi there cellmates! I've been trying to find a DBI equivalent to the Oracle desc command and thus far failed (the only DBI DESC command that I've encountered is to do with sorting returned rows). Is there such a thing or am I going to have to get this information from an oracle session and then use Perl to work with this data?

Replies are listed 'Best First'.
Re: DBI and using Oracle desc
by Corion (Pope) on Jun 28, 2007 at 12:00 UTC

    As you don't tell us what the "Oracle desc command" is supposed to do, I can only guess. Maybe it does "describe" objects in the database. If so, then the Catalog Methods section of the DBI documentation will tell you what to do.

      The "desc" command simply describes a table - returning the column names, null or not null and field type. I've tried using "$sth = $dbh->table_info(",,USER\$")" (the table name is USER$) but I'm not getting anything useful from this.

        All the information on tables, columns and databases are stored in *SUPRISE* other tables. You can write SQL queries against those system tables to get the information that you are interested without needing any special systems knowledge.

        As for the tables that you should be looking at, Try this page to get you started

        $sth = $dbh->table_info(",,USER\$")
        does not do what you might think it does.

        Maybe you wanted to use the following?

        $sth = $dbh->table_info('',undef,"USER")

        Maybe, for a first try, leave all the restrictions out and see what ->table_info gives you.

Re: DBI and using Oracle desc
by adrianh (Chancellor) on Jun 28, 2007 at 12:04 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://623859]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2017-11-23 10:05 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (333 votes). Check out past polls.