Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: ORA-00900: invalid SQL statement when using Perl DBI::Oracle module

Re: ORA-00900: invalid SQL statement when using Perl DBI::Oracle module

From: Anirban Chattopadhyay <anirban_at_ans.net>
Date: 2000/06/01
Message-ID: <3936B7E4.C354C542@ans.net>#1/1

Panos Kavalagios wrote:
>
> Hello,
>
> In my perl script, I have written the following:
>
> [ successful connection to the database precedes ]
>
> $sth=$dbh->prepare("describe mytablename");
>
> $sth->execute;
>
> and it throws invalid SQL statement!!! If you write the following:
>
> $sth=$dbh->prepare("select * from tab");
>
> $sth->execute;
>
> it runs perfectly and I get the right data. I should say that "describe"
> runs OK within SQLPlus (both in Windows and Linux) and SQLPlus
> Worksheet. Our Oracle server is:
>
> SQL*Plus: Release 8.1.6.0.0 - Production on Thu Jun 1 10:15:32 2000
>
> (c) Copyright 1999 Oracle Corporation. All rights reserved.
>
> Connected to:
> Oracle8i Release 8.1.5.0.0 - Production
> With the Java option
> PL/SQL Release 8.1.5.0.0 - Production
>
> on a Windows NT Server 4.0 (service pack 6). Perl version is:
>
> Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
> Platform:
> osname=linux, osvers=2.2.5-22smp, archname=i386-linux uname='linux
> porky.devel.redhat.com 2.2.5-22smp #1 smp wed jun 2 09:11:51 edt 1999
> i686 unknown '
>
> The DBI module version 1.13 and DBD-Oracle 1.03 (compiled with Oracle
> client 8.1.6).
>
> Could you please have any idea what is the problem about, since I
> need describe SQL command in order to get dynamically the table's
> fields. Is there any other way to do that? Thank you very much in
> advance.
>
> Panos Kavalagios

I think you are correct in saying that "describe" would not work because it is a SQLPLUS command and not a SQL command. There may be a number of ways of working around - one of them may be to do a "select * from table_name where rownum = 1" to retrieve just 1 record and use the SQLDA (SQL Descriptor Area) to get the column names

anirban Received on Thu Jun 01 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US