> -----Original Message-----
> From: Marius Keraitis [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 11, 2002 5:40 AM
> To: DBI Perl; Begginers Perl
> Subject: Column names and etc..
>
>
> Hi,
>
> I have a problem with getting colunm count and their names.
>
> I have to get the list of all tables in the users account (Oracle).
> This I do by selecting * from cat.
>
> Second step is to show every table contents (by clicking on
> link with table
> name).
> To do this I need to know how many columns is in table, and
> all names of columns
> in table.
Assuming you're using DBI, you should call prepare() to
get a statement handle for your query. The use the various
statement handle attributes to find out about the columns:
$sth = $dbh->prepare('select * from foo');
$n = $sth->{NUM_OF_FIELDS}; # get number of columns
print $sth->{NAME}[0]; # name of first column
Look in the DBI docs; search for "Statement Handle Attributes"
The other way would be to query the Oracle data dictionary
views like USER_TAB_COLUMNS, but that's pretty ugly.
>
> If in Perl I could use the DESCRIBE commands there was no
> problem, but this is
> an Invalid statement..:(
That's because DESCRIBE is a sqlplus command.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]