desc: invalid sql statement, answered



found a google hit finally which answers my question:

From: Bob Showalter [mailto:Bob_Showalter@xxxxxxxxxxxxxxx] Sent: Tuesday, May 31, 2005 2:55 PM To: Christopher L. Hood; beginners@xxxxxxxx Subject: RE: :Oracle problems christopher.l.hood@xxxxxxxxxxx wrote: > All, > > I am getting the following error while trying to use DBD::Oracle: > > DBD::Oracle::st execute failed: ORA-00900: invalid SQL statement (DBD > ERROR: OCIStmtExecute) [for Statement "describe ALL_USERS"] at > ../oracleTest.pl line 69.

DESCRIBE is a SQL*Plus command. It is not part of the Oracle SQL language. You need to either query the data dictionary views directly, or use the statement handle attributes like NAME, PRECISION, TYPE, etc. to get this information.
--- Begin Message --- I believe a describe statement is Oracle DDL, but I still failed for both of the ways that I know of to execute sql. There must be something that I am not considering.

#!/usr/local/bin/perl
#script to demonstate execution failure
use strict;
use warnings;

use DBI;
use DBD::Oracle;

my $username='';
my $password='';
my $dbsid='';
my $cont;

eval {
$cont = DBI->connect('dbi:Oracle:' . lc($dbsid), $username, $password,
{
RaiseError => 1,
AutoCommit => 0,
ora_session_mode => 0
}
);
};


die "problem" if ($@);

my $sth;

#1
eval {
       $sth = $cont->prepare("desc user_tables");
};

if ($@) {
print "$DBI::errstr";
#exit;
} else {
eval {
$sth->execute;
};
if ($@) {
print "$DBI::errstr";
#exit;
}
}


#2
eval {
       $cont->do("desc user_tables");
};

if ($@) {
       print "$DBI::errstr";
       #exit;
}

# Windows XP
# DBI 1.48
# DBD-Oracle 1.16
# ActivePerl 5.8.7 build 813

DBD::Oracle::st execute failed: ORA-00900: invalid SQL statement (DBD ERROR: OCIStmtExecute) [for Statement "desc user_tables"] at C:\DATA\SESS_KILL\DBD-DBI_testing.pl line 37.
ORA-00900: invalid SQL statement (DBD ERROR: OCIStmtExecute) <--print output
DBD::Oracle::db do failed: ORA-00900: invalid SQL statement (DBD ERROR: OCIStmtExecute) [for Statement "desc user_tables"] at C:\DATA\SESS_KILL\DBD-DBI_testing.pl line 48.
ORA-00900: invalid SQL statement (DBD ERROR: OCIStmtExecute) <--print output
Issuing rollback() for database handle being DESTROY'd without explicit disconnect().



--- End Message ---


Relevant Pages

  • How can I pass data into a boolean variable in SSIS from Oracle?
    ... In oracle, create a view that basically does something like this select * ... Then I create an EXECUTE SQL step in SSIS. ... of the SQL query. ...
    (microsoft.public.sqlserver.dts)
  • RE: How can I pass data into a boolean variable in SSIS from Oracle?
    ... its true or false and decide if it should execute a certain step. ... In oracle, create a view that basically does something like this select * ... In SQL Server I do the following: ... TSQL which is compatible with SSIS's boolean data type. ...
    (microsoft.public.sqlserver.dts)
  • Re: ADO.NET / Oracle problem
    ... I've seen similar weirdness with Oracle. ... "Bill Zack" wrote in message ... > We populate it with some data and try to execute a select statement. ... > Encountered an exception while preparing the SQL statement. ...
    (microsoft.public.dotnet.framework.adonet)
  • ADO.NET / Oracle problem
    ... SQL> desc cubetest ... We populate it with some data and try to execute a select statement. ... Encountered an exception while preparing the SQL statement. ... We are using the Microsoft oracle provider. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: desc: invalid sql statement
    ... It is not part of the Oracle SQL language. ... Subject: desc: invalid sql statement ... I believe a describe statement is Oracle DDL, but I still failed for both of the ways that I know of to execute sql. ...
    (perl.dbi.users)