Re: ORA-1008 on Oracle 10g

2008-04-03 Thread [EMAIL PROTECTED]

Hello!
it seems there is a common interest for a solution for this case.

We solved this problem changing the Oracle parameter 'CURSOR_SHARING' from 
value 'force' to 'exact'. This fixes a known bug (or feature) introduced in 
Oracle 10.

After changing this parameter DBI works like with Oracle 9 before.

Hope this helps you to solve *your* problem.

Best Regards,
  Olaf Ohlenmacher


--
Olaf Ohlenmacher [EMAIL PROTECTED]
MaXpert AG, Berner Straße 119, 60437 Frankfurt am Main
Tel: +49 69 50065 269
Fax: +49 69 50065 515
Mobil: +49 172 6648 604




Von: [EMAIL PROTECTED]
Gesendet: Donnerstag, 14. Februar 2008 17:47
An: dbi-users@perl.org
Betreff: ORA-1008 on Oracle 10g



Hello!
i am writing a script querying a Oracle database with prepared 
statements. The database owner has upgradeed the database from version 9.2 to 
version 10g.
Since this upgrade the scripts croaks() with

DBD::Oracle::st execute failed: ORA-01008: not all variables bound (DBD 
ERROR: OCIStmtExecute) [for Statement 
SELECT *
FROM
 BB_TO_SYS_MESSAGE
WHERE
 STATUS= 'new' AND
 BACKBONE_TICKET_ID = ? AND
 TIMESTAMP   = ?
 with ParamValues: :p1='Ticket-SC-GER-20080214153230054', 
:p2='2008-02-14 15:39:38'] at 
D:/Programme/backbone-devel/Programme/DBhandling.pm line 459

There are only two parameters :p1 and :p2 with both have valid values.

Have you any suggestion why this statement failed on Oracle 10g?
Do you know about any problems with the module version i am 
using (see below)?

Using this version...

ActiveState perl 5.8.8
DBI 1.601
DBD-Oracle 1.17

All from ActiveState Package Repository.

Best Regards,
  Olaf Ohlenmacher
--
Olaf Ohlenmacher [EMAIL PROTECTED]
MaXpert AG, Berner Straße 119, 60437 Frankfurt am Main
Tel: +49 69 50065-265
Mobil: +49 172 6648 604




Blank inserted with varchar copy using prepare

2008-04-03 Thread Rutherdale, Will
Hi.

I am using Perl 5.8.8 on SunOS pnc 5.8 with Informix (Server Version
9.30) and DBI 1.51 and DBD::Informix 2005.2.

I try to copy a list of tables using DBI.  I have found that a certain
column declared as varchar(64) is copied incorrectly when it contains an
empty string.  The value in the target location is a string containing
one space instead of being empty.

Here is a code fragment copied from the actual script:

foreach my $tb ( @$table_list )
{
my ( $sel ) = $from_dbh-prepare( SELECT * FROM $tb );
$sel-execute();
my ( $cols, $val_str ) = ( $sel-{NUM_OF_FIELDS}, () );
$val_str = ( . (?, x ($cols-1)) . ?)  if ( $cols0 );
my ( $ins ) = $to_dbh-prepare( INSERT INTO $tb VALUES . $val_str
);
my ( $fetch_tuple_sub ) = sub { $sel-fetchrow_arrayref };
my @tuple_status;
my ( $rc ) = $ins-execute_for_fetch( $fetch_tuple_sub,
[EMAIL PROTECTED] );
my ( @errors ) = grep { ref $_ } @tuple_status;
$sel-finish();
$ins-finish();
}

Is this a known bug?  Is there a way I can get this code to faithfully
reproduce the data including blank strings of type varchar(64)?

-Will



 - - - - - Appended by Scientific Atlanta, a Cisco company - - - - - 
This e-mail and any attachments may contain information which is confidential,
proprietary, privileged or otherwise protected by law. The information is solely
intended for the named addressee (or a person responsible for delivering it to
the addressee). If you are not the intended recipient of this message, you are
not authorized to read, print, retain, copy or disseminate this message or any
part of it. If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.



Fwd: Blank inserted with varchar copy using prepare

2008-04-03 Thread Jonathan Leffler
Bother.

-- Forwarded message --
From: Jonathan Leffler [EMAIL PROTECTED]
Date: Thu, Apr 3, 2008 at 5:49 PM
Subject: Re: Blank inserted with varchar copy using prepare
To: Rutherdale, Will [EMAIL PROTECTED]




On Thu, Apr 3, 2008 at 3:34 PM, Rutherdale, Will [EMAIL PROTECTED]
wrote:

 I am using Perl 5.8.8 on SunOS pnc 5.8 with Informix (Server Version
 9.30) and DBI 1.51 and DBD::Informix 2005.2.

 I try to copy a list of tables using DBI.  I have found that a certain
 column declared as varchar(64) is copied incorrectly when it contains an
 empty string.  The value in the target location is a string containing
 one space instead of being empty.

 Here is a code fragment copied from the actual script:

 foreach my $tb ( @$table_list )
 {
my ( $sel ) = $from_dbh-prepare( SELECT * FROM $tb );
$sel-execute();
my ( $cols, $val_str ) = ( $sel-{NUM_OF_FIELDS}, () );
$val_str = ( . (?, x ($cols-1)) . ?)  if ( $cols0 );
my ( $ins ) = $to_dbh-prepare( INSERT INTO $tb VALUES . $val_str
 );
my ( $fetch_tuple_sub ) = sub { $sel-fetchrow_arrayref };
my @tuple_status;
my ( $rc ) = $ins-execute_for_fetch( $fetch_tuple_sub,
 [EMAIL PROTECTED] );
my ( @errors ) = grep { ref $_ } @tuple_status;
$sel-finish();
$ins-finish();
 }

 Is this a known bug?  Is there a way I can get this code to faithfully
 reproduce the data including blank strings of type varchar(64)?


Perl 5.10.0 on Solaris 10, DBI 1.604, DBD::Informix 2008.0229, ESQL/C
3.00.UC2.

#!/bin/perl -w
use strict;
use DBD::Informix::TestHarness;

my($dbh) = connect_to_test_database({RaiseError = 1});

my($tbl1) = dbd_ix_something_1;
my($tbl2) = dbd_ix_something_2;
$dbh-do(create {temp} table $tbl1 ( col VARCHAR(64) NOT NULL));
$dbh-do(create {temp} table $tbl2 ( col VARCHAR(64) NOT NULL));
$dbh-do(INSERT INTO $tbl1 VALUES('a'));  # Non-blank VARCHAR
$dbh-do(INSERT INTO $tbl1 VALUES(' '));   # Single-blank VARCHAR
$dbh-do(INSERT INTO $tbl1 VALUES(''));# Empty (non-null) VARCHAR

my($from_dbh) = $dbh;
my($to_dbh) = $dbh;

my($table_list) = [ $tbl1 ];

foreach my $tb ( @$table_list )
{
my ( $sel ) = $from_dbh-prepare( SELECT * FROM $tb );
$sel-execute();
my ( $cols, $val_str ) = ( $sel-{NUM_OF_FIELDS}, () );
$val_str = ( . (?, x ($cols-1)) . ?)  if ( $cols0 );
my ($new) = $tb;
$new =~ s/1/2/;
my ( $ins ) = $to_dbh-prepare( INSERT INTO $new VALUES . $val_str);
my ( $fetch_tuple_sub ) = sub { $sel-fetchrow_arrayref };
my @tuple_status;
my ( $rc ) = $ins-execute_for_fetch( $fetch_tuple_sub,
[EMAIL PROTECTED] );
my ( @errors ) = grep { ref $_ } @tuple_status;
$sel-finish();
$ins-finish();
}

Runs OK - first time.

Black JL: perl will.sciatl.pl
# DBI-connect('dbi:Informix:stores', '', '');
#   Connect Attribute: RaiseError = 1
#   Connect Attribute: ChopBlanks = 1
Black JL: sqlcmd -d stores -F unload -e 'select * from dbd_ix_something_1'
a|
 |
\ |
Black JL: sqlcmd -d stores -F unload -e 'select * from dbd_ix_something_2'
a|
 |
\ |
Black JL:

Basically, this code is copying the single blank and the empty but non-null
string accurately.

So, in the absence of a reproduction with DBD::Informix 2008.0229, I'm going
to claim no longer a problem.  There have been issues in the handling of
VARCHAR, both in ESQL/C and in DBD::Informix on occasion, but not
self-evidently on this occasion.

I assume there's a reason why you can't do:
INSERT INTO dbase2:tablename SELECT * FROM dbase1:tablename;
Probably related to error -999 (not implemented yet).

-- 
Jonathan Leffler [EMAIL PROTECTED] #include disclaimer.h
Guardian of DBD::Informix - v2008.0229 - http://dbi.perl.org
Blessed are we who can laugh at ourselves, for we shall never cease to be
amused.



-- 
Jonathan Leffler [EMAIL PROTECTED] #include disclaimer.h
Guardian of DBD::Informix - v2008.0229 - http://dbi.perl.org
Blessed are we who can laugh at ourselves, for we shall never cease to be
amused.