Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with bind_param and DBI.

Status
Not open for further replies.

StickyBit

Technical User
Jan 4, 2002
264
CA
Folks,

I'm receiving the following error from this code:

#!/usr/bin/perl -w

use DBI;

my ($dbh, $sth, $network_status, $sysdate, $seq);

#perform the database connection
$dbh = DBI->connect("dbi:Oracle:ORACLE","larry", "wall", {
PrintError => 0,
RaiseError => 1
});
unlink 'dbitrace.log' if -e 'dbitrace.log';

DBI->trace(2, 'dbitrace.log');


#prepare a sql statement for execution
$network_status = "down";
$sysdate = "sysdate";
$seq = "dhcp_status_seq.nextval";
$sth = $dbh->prepare("insert into dhcp_status values
(?, ?, ?");

$sth->bind_param( 1, $network_status );
$sth->bind_param( 2, $sysdate);
$sth->bind_param( 3, $seq);

#execute the statement in the oracle database

$sth->execute();

#disconnect from the database
$dbh->disconnect();

exit;

DBD::Oracle::st execute failed: ORA-00917: missing comma (DBD ERROR: OCIStmtExecute) at ./dbinsert2.pl line 30.

Line 30 is the execute statement, can't figure out where the problem is. Newbie to perl and DBI, please help.

Thanks,

StickyBit.
 
Are you missing a close parethesis in the "prepare" line?

Should it not read ...values (?,?,?)")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top