Hi all, this is a difficult one to explain!!

i have a perl script that is inserting entries into an oracle database
table. so far so good!!
the difficulty i have is that the table has a sequence against a unique id
column (number) that can increment itself using seq.nextval.

when i test the script without having an insert statement implemented i get
the results i want ie:

id  entry
1   abc
2   def
3   ghi

etc etc.

however, when i implement the insert statement i get this:
id  entry
1   abc
3   def
6   ghi
10  jkl

the offending code is:

my $sth = $dbh->prepare("insert into "table" values (?, ?)");
my $get_nextval = $dbh->prepare("select seq.nextval from "table");

loop {
        $get_nextval->execute();
        $get_nextval->bind_col(1, \$id);
        $get_nextval->fetch();
        $get_nextval->finish();
        $sth->execute($id, $abc);
}


does anyone have any ideas??

Thanks

Stephen Redding

BT Ignite Solutions
Telephone - 0113 237 3393
Fax - 0113 244 1413
Email - [EMAIL PROTECTED]

British Telecommunications plc
Registered office: 81 Newgate Street London EC1A 7AJ
Registered in England no. 1800000
This electronic message contains information from British Telecommunications
plc which may be privileged or  confidential. The information is intended to
be for the use of the individual(s) or entity named above. If you  are not
the intended recipient be aware that any disclosure, copying, distribution
or use of the contents of  this information is prohibited. If you have
received this electronic message in error, please notify us by  telephone or
email (to the numbers or address above) immediately.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to