Hi guys, I started to ask this question last week but I somehow was logged in as an anonymous monk - considering the mess I've made of understanding this I might have been better served staying anonymous! That said all I'm trying to do is extract the column names from any given table named in an Oracle database. The rough code that I've been using follows :-
print "\n\t\t***** S T A R T S *****\n" ;
$dbh = DBI->connect("dbi:Oracle:$db","$uname","$password", {
PrintError => 0,
RaiseError => 0
}
) or die "\n\tCan't connect to $db :: $DBI::errstr\n" ;
$sth = $dbh->column_info(undef,undef,"$table","$column") or die "\n\tD
+idnae work min :: $!\n" ;
$sth->execute or die "\n\tCan't execute DBI command :: $DBI::errstr\n"
+ ;
#------------------------------------------#
# Retrieve the returned rows of data #
#------------------------------------------#
while ( @row = $sth->fetchrow_array() ) {
$detail = $row[0] ;
$row_count ++ ;
print "\n\tValue\t$detail\n" ;
}
print "\n\tThere were $row_count rows returned\n" ;
The $table variable points to a table called USER$ - where our user names live & $column is set to COLUMN_NAME. This script runs but no rows are returned. I take it that I'm doing something particularily daft but can't see what it is can someone give me some pointers please?
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.