Re: Can't bind unknown placeholder ':p2' (2)

2002-06-24 Thread David Totten

Attached is my entire perl script, and the DBI-trace(2) output that I
created with it.

Just as a reminder, I am running Red Hat 7.3, and oracle client 8.1.7.
I installed all of the compatibility libraries and set ORACLE_HOME,
ORACLE_SID, and LD_ASSUME_KERNEL=2.2.5

before I set any of those, I source
/usr/i386-glibc21-linux/bin/i386-glibc21-linux-env.sh so that I can
even run the sqlplus client.

Please let me know if you need any more information.

Dave Totten

On Sat, Jun 22, 2002 at 07:56:00PM +0100, Tim Bunce wrote:
 Please include the current code and corresponding trace file.
 Thanks.
 
 Tim.
 
 On Thu, Jun 20, 2002 at 06:26:07PM +0100, David Totten wrote:
  On Thu, Jun 20, 2002 at 01:07:23PM -0400, Ronald J Kimball wrote:
Now I am getting:

Can't bind :p1, ora_type 2 not supported by DBD::Oracle at load.pl line
118.
   
   Does it work if you don't specify the type for the numeric argument?  It
   shouldn't be necessary.
  
  Well, if I do that, I get the following:
  
  DBD::Oracle::st execute failed: ORA-00932: inconsistent datatypes:
  expected NUMBER got CLOB (DBD ERROR: OCIStmtExecute) at load.pl line
  120.
  Error message was: DBI::db=HASH(0x824fd28)-errstr
  
  For the change, all I did was remove the ora_type = ORA_NUMBER part.
  
  Dave Totten
 


DBI 1.25-nothread dispatch trace level set to 2
- DBI-connect(DBI:Oracle:fred2_neon, dave, , HASH(0x80fbb0c))
- DBI-install_driver(Oracle) for linux perl=5.006001 pid=13646 ruid=501 euid=501
   install_driver: DBD::Oracle version 1.12 loaded from 
/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBD/Oracle.pm
- install_driver= DBI::dr=HASH(0x81adae0)
- connect for DBD::Oracle::dr (DBI::dr=HASH(0x81adae0)~0x824fbec 'fred2_neon' 
'dave'  HASH(0x8189488))
- connect= DBI::db=HASH(0x824fbbc) at DBI.pm line 491
- STORE for DBD::Oracle::db (DBI::db=HASH(0x824fb2c)~INNER 'PrintError' 1)
- STORE= 1 at DBI.pm line 533
- STORE for DBD::Oracle::db (DBI::db=HASH(0x824fb2c)~INNER 'AutoCommit' 1)
- STORE= 1 at DBI.pm line 533
- STORE for DBD::Oracle::db (DBI::db=HASH(0x824fb2c)~INNER 'LongTruncOk' 0)
- STORE= 1 at DBI.pm line 536
- connect= DBI::db=HASH(0x824fbbc)
- prepare for DBD::Oracle::db (DBI::db=HASH(0x824fbbc)~0x824fb2c 'insert into 
dave2 (idnum, xml) values (?, ?)')
dbd_preparse scanned 2 distinct placeholders
- prepare= DBI::st=HASH(0x824fcac) at load2.pl line 85
- bind_param for DBD::Oracle::st (DBI::st=HASH(0x824fcac)~0x824fb14 1 1)
   bind :p1 == 1 (type 0)
   bind :p1 == 1 (size 1/2/0, ptype 5, otype 1)
- bind_param= 1 at load2.pl line 86
- bind_param for DBD::Oracle::st (DBI::st=HASH(0x824fcac)~0x824fb14 2 '?xml 
version=1.0 encoding=UTF-8?
!DOCTYPE sciserv PUBLIC -//ScienceServer LLC//DTD SciServ 2.1//EN 
http://192.246.204.91:1959/dtd/sciserv.dtd;
!--
This data came from the following dataset: /bb3/sdos_1998/OHL0103A
T1 LINE: 23911
T2 LINE: 23913
T3 LINE: 24039
Supplemental SGML data came from: 
/bb3/sdos_1998/OHL0103A/00100277/V0062I01//0780.SGC
--
sciserv dtdver=2 d...')
   bind :p2 == '?xml version=1.0 encoding=UTF-8?
!DOCTYPE sciserv PUBLIC -//ScienceServer LLC//DTD SciServ 2.1//EN 
http://192.246.204.91:1959/dtd/sciserv.dtd;
!--
This data came from the following dataset: /bb3/sdos_1998/OHL0103A
T1 LINE: 23911
T2 LINE: 23913
T3 LINE: 24039
Supplemental SGML data came from: 
/bb3/sdos_1998/OHL0103A/00100277/V0062I01//0780.SGC
--
sciserv dtdver=2 d...' (type 0)
   bind :p2 == '?xml version=1.0 encoding=UTF-8?
!DOCTYPE sciserv PUBLIC -//ScienceServer LLC//DTD SciServ 2.1//EN 
http://192.246.204.91:1959/dtd/sciserv.dtd;
!--
This data came from the following dataset: /bb3/sdos_1998/OHL0103A
T1 LINE: 23911
T2 LINE: 23913
T3 LINE: 24039
Supplemental SGML data came from: 
/bb3/sdos_1998/OHL0103A/00100277/V0062I01//0780.SGC
--
sciserv dtdver=2 d...' (size 5556/5557/0, ptype 4, otype 1)
- bind_param= 1 at load2.pl line 87
- execute for DBD::Oracle::st (DBI::st=HASH(0x824fcac)~0x824fb14)
dbd_st_execute INSERT (out0, lob0)...
!! ERROR: 1461 'ORA-01461: can bind a LONG value only for insert into a LONG 
column (DBD ERROR: OCIStmtExecute)'
- execute= undef at load2.pl line 89
DBD::Oracle::st execute failed: ORA-01461: can bind a LONG value only for insert into 
a LONG column (DBD ERROR: OCIStmtExecute) at load2.pl line 89.
- finish for DBD::Oracle::st (DBI::st=HASH(0x824fcac)~0x824fb14)
- finish= 1 at load2.pl line 92
- disconnect for DBD::Oracle::db (DBI::db=HASH(0x824fbbc)~0x824fb2c)
- disconnect= 1 at load2.pl line 31
-- DBI::END
- disconnect_all for DBD::Oracle::dr (DBI::dr=HASH(0x81adae0)~0x824fbec)
- disconnect_all= '' at DBI.pm line 553
- DESTROY for DBD

Re: Can't bind unknown placeholder ':p2' (2)

2002-06-20 Thread David Totten

On Thu, Jun 20, 2002 at 12:08:42PM -0400, Ronald J Kimball wrote:
 On Thu, Jun 20, 2002 at 04:36:10PM +0100, David Totten wrote:
 
  $main::sth = $main::dbh-prepare(insert into $tablename (idnum,
  xml) values (mysequence.nextval, ?));
  $main::sth-bind_param(2, $foo, $clob);
 
 You're trying to bind to the second placeholder, but your statement only
 contains one placeholder.

Alright, I modified it so that I was passing in 2 parameters:

sub insertRecord {
my $foo = shift;
my $clob = { ora_type  = ORA_CLOB,
 ora_field = xml };
my $number = { ora_type = ORA_NUMBER,
   orafield = idnum };
$main::dbh-{LongReadLen} = 2**20;
$main::dbh-{LongTruncOk} = 0;
$main::sth = $main::dbh-prepare(insert into $tablename (idnum,
xml) values (?, ?));
$main::sth-bind_param(1, 1, $number);
$main::sth-bind_param(2, $foo, $clob);

if (!$main::sth-execute) {
print Error message was: $main::dbh-errstr\n;
}
$main::sth-finish();
return ;
}

Now I am getting:

Can't bind :p1, ora_type 2 not supported by DBD::Oracle at load.pl line
118.

Dave Totten



Re: Can't bind unknown placeholder ':p2' (2)

2002-06-20 Thread David Totten

On Thu, Jun 20, 2002 at 01:07:23PM -0400, Ronald J Kimball wrote:
  Now I am getting:
  
  Can't bind :p1, ora_type 2 not supported by DBD::Oracle at load.pl line
  118.
 
 Does it work if you don't specify the type for the numeric argument?  It
 shouldn't be necessary.

Well, if I do that, I get the following:

DBD::Oracle::st execute failed: ORA-00932: inconsistent datatypes:
expected NUMBER got CLOB (DBD ERROR: OCIStmtExecute) at load.pl line
120.
Error message was: DBI::db=HASH(0x824fd28)-errstr

For the change, all I did was remove the ora_type = ORA_NUMBER part.

Dave Totten