Loose the ';' in your insert statement.

-----------------
Ron Reidy
Senior DBA
Array BioPharma, Inc.


-----Original Message-----
From: amonotod [mailto:[EMAIL PROTECTED]
Sent: Friday, June 25, 2004 1:43 PM
To: [EMAIL PROTECTED]
Subject: perl DBD::Oracle not using place holders?


  I'm using "$DBD::Oracle::VERSION = '1.15' with  ActiveState Perl v5.8.0 build 802.

  With the code listed below, I am doing inserts to a database.  

# Build my insert statement...
my $insert_start = "insert into $tablemap (";
my $insert_end = ") values (";
my $colcount = 1;
foreach (@cols) {
  $insert_start .= $_;
  $insert_end .= "?";
  if ($colcount < scalar(@cols)) { $insert_start .= ", "; $insert_end .= ", ";}
  $colcount++;
}
$insert_end .= ");";
my $insert_statement = $insert_start . $insert_end;
print "$insert_statement\n";

# Prepare the insert statement, and start inserting the data...
my $DataInsert = $dbh->prepare(Format_SQL($insert_statement));
while (my (@rets) = $Text_sth->fetchrow_array) { 
   my @valuelist;
   $colcount = 0;
   foreach my $col (@cols) { 
     my $ret = $rets[$colcount];
     if ($ret eq "") { $valuelist[$colcount] = qw /NULL/; }
     else { $valuelist[$colcount] =  $ret; }
     $colcount++;
   }
  unless ($DataInsert->execute(@valuelist)  ) {
    print LOGFILE "errors: $dbh->errstr \n";
    print LOGFILE "\nErrors were encountered during data load...\n";
  }
}
$DataInsert->finish;

  This all works fine with MSSQL (using DBD::ODBC), and with Sybase (using 
DBD::Sybase).  However, with Oracle it dies on the first insert...

insert into ALERT (Alert_ID, Name, ItemID, SGML_ID, CDM_Type) values (?, ?, ?, ?, ?);
DBD::Oracle::st execute failed: ORA-00911: invalid character (DBD ERROR: error 
possibly near <*> indicator at char 94 in 'insert into Table (ID_Col, Name, ItemID, 
Alt_ID, C_Type) values (:p1, :p2, :p3, :p4, :p5)<*>;') [for Statement "insert into 
Table (ID_Col, Name, ItemID, Alt_ID, C_Type) values (?, ?, ?, ?, ?);" with 
ParamValues: :p5='W', :p3='NULL', :p1='600', :p4='Y48840', :p2='Notice Notice'] at 
D:\development\dbd_db.pl line 248.

  Hints, tips and suggestions welcome...

Thank you,
amonotod

-- 
    `\|||/         amonotod@    | subject line: 
      (@@)         charter.net  | no perl, no read...
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


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.

Reply via email to