Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

cidaris's scratchpad

by cidaris (Friar)
on Jul 22, 2004 at 14:16 UTC ( #376582=scratchpad: print w/replies, xml ) Need Help??

Trying to dump the entire contents of an Oracle database to an internal flatfile so we can reverse engineer their ER diagram. (Vendor went out of business...)
## @column_names contains column names $sth = $dbh->prepare("SELECT ? FROM employees"); foreach my $column_name (@column_names){ $sth->execute($column_name) or error_somehow(); while($row = $sth->fetchrow_arrayref()){ print "Value in column $column_name: ".$row->[0]; } }
For my output I'm getting the column names:
EMPLOYEE_NAME
EMPLOYEE_NAME
EMPLOYEE_NAME
EMPLOYEE_NAME
EMPLOYEE_NAME
EMPLOYEE_NAME
EMPLOYEE_SALARY
EMPLOYEE_SALARY
EMPLOYEE_SALARY
EMPLOYEE_SALARY
EMPLOYEE_SALARY
EMPLOYEE_SALARY


I'd much rather get the column contents... Does prepare not understand what I'm doing? Is there an alternative method short of writing a statement for every table?

Conceptually, I'm trying to do "SELECT * FROM *" and filtering out BLOBs, etc.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2023-12-10 17:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (40 votes). Check out past polls.

    Notices?