use DBI;use DBD::Oracle; is redundant use DBI; is sufficient. José.
> -----Original Message----- > From: Mark Martin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 03, 2003 12:47 PM > To: Bob Showalter; [EMAIL PROTECTED] > Subject: Re: DBI and Unique Keys > > > Bob, > here is the code with SQL embedded. It's a very simple > extract from one Dbase and insert into another : > > #!/usr/bin/perl > use CGI qw(fatalsToBrowser); > use DBI; use DBD::Oracle; > > $dbh1 = DBI->connect( "dbi:Oracle:SOURCE_SID", "username", > "pword" ) or die "Can't connect to Oracle database: > $DBI::errstr\n"; $dbh2 = DBI->connect( > "dbi:Oracle:TARGET_SID", "username", "pword" ) or die "Can't > connect to Oracle database: $DBI::errstr\n"; > > my $sql1 = qq{SELECT FIELD1, FIELD2, FIELD3, FIELD4, > ........... FIELD10 FROM SOURCE_TABLE}; > my $sql2 = qq{INSERT INTO TARGET_TABLE VALUES (?,?,?,?,?,?,?,?,?,?)}; > > my $sth1 = $dbh1->prepare($sql1) or die "Can't prepare SQL > statement: $DBI::errstr\n"; $sth1->execute or die "Can't > execute SQL statement: $DBI::errstr\n"; > > while (my @row = $sth1->fetchrow) { > chomp; > > $var1 = $row[0]; > $var2 = $row[1]; > . > . > . > $var10 = $row[9]; > > my $sth2 = $dbh2->prepare($sql2) or die > "Can't prepare SQL statement: $DBI::errstr\n"; > $sth2->execute($var1,$var2........$var10) > or print "WARNING: Can't execute SQL statement 2: $DBI::errstr\n"; > } > $dbh1 ->disconnect(); $dbh2 ->disconnect(); exit; > > ----- Original Message ----- > From: "Bob Showalter" <[EMAIL PROTECTED]> > To: "'Mark Martin'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Monday, June 02, 2003 2:14 PM > Subject: RE: DBI and Unique Keys > > > > Mark Martin wrote: > > > Hi, > > > I have an Oracle table with a Unique Key which is generated by a > > > trigger : > > > > > > CREATE TRIGGER MYTRIGGER > > > before insert on MYTABLE > > > for each row > > > begin > > > select MYSEQUENCE.nextval into :new.MYCOLUMNAME from > dual; end; And > > > this works fine on normal insert > > > > > > When I try to insert from a perl script I get the following : > > > ORA-00947: not enough values > > > > Need to see your SQL. > > > > > > > > When I try to add an extra placeholder for the value the will be > > > generated by the trigger I get the following : execute > > > failed: called 28 bind variables when 29 are needed > > > > You need to supply an additional bind variable (value > doesn't matter). > > Again, we need to see the code. > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > **** DISCLAIMER **** "This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer". Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]