desc: invalid sql statement

desc: invalid sql statement

am 27.12.2005 20:35:30 von listmail

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().

RE: desc: invalid sql statement

am 27.12.2005 21:04:28 von Ron.Reidy

'desc' is a Plus command in Oracle. It is not valid SQL.

--
Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: listmail [mailto:listmail@triad.rr.com]=20
Sent: Tuesday, December 27, 2005 12:36 PM
To: dbi-users@perl.org
Subject: desc: invalid sql statement


I believe a describe statement is Oracle DDL, but I still failed for=20
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=3D'';
my $password=3D'';
my $dbsid=3D'';
my $cont;

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

die "problem" if ($@);

my $sth;

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

if ($@) {
print "$DBI::errstr";
#exit;
} else {
eval {
$sth->execute;
};
=20
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=20
ERROR: OCIStmtExecute) [for Statement "desc user_tables"] at=20
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:=20
OCIStmtExecute) [for Statement "desc user_tables"] at=20
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=20
disconnect().

This electronic message transmission is a PRIVATE communication which =
contains
information which may be confidential or privileged. The information is =
intended=20
to be for the use of the individual or entity named above. If you are =
not the=20
intended recipient, please be aware that any disclosure, copying, =
distribution=20
or use of the contents of this information is prohibited. Please notify =
the
sender of the delivery error by replying to this message, or notify us =
by
telephone (877-633-2436, ext. 0), and then delete it from your system.

Re: desc: invalid sql statement

am 27.12.2005 21:25:00 von listmail

Thanks Ron, I found a google hit as well and I can work around this.

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.

Reidy, Ron wrote:

>'desc' is a Plus command in Oracle. It is not valid SQL.
>
>--
>Ron Reidy
>Lead DBA
>Array BioPharma, Inc.
>
>-----Original Message-----
>From: listmail [mailto:listmail@triad.rr.com]
>Sent: Tuesday, December 27, 2005 12:36 PM
>To: dbi-users@perl.org
>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. 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().
>
>This electronic message transmission is a PRIVATE communication which contains
>information which may be confidential or privileged. The information is intended
>to be for the use of the individual or entity named above. If you are not the
>intended recipient, please be aware that any disclosure, copying, distribution
>or use of the contents of this information is prohibited. Please notify the
>sender of the delivery error by replying to this message, or notify us by
>telephone (877-633-2436, ext. 0), and then delete it from your system.
>
>
>