Dear Tanyi (Paul Twa), Sorry about top-posting this response - blame Lotus Notes. I don't understand your problem. What do you mean by 'truncated'. Please provide a complete, self-contained test script that illustrates the problem on your system, and include the actual output and what you think is the correct output (possibly with an explanation of why you think that is correct). Also, provide information about the platform (machine, o/s), and software (Perl, DBI, DBD::Informix, ESQL/C, IDS) that you are using. Looking at your code, you can tighten it up. For example, you have 'my $sth;' declared outside the eval block, but you never attempt to use it outside the eval block. Use: my $sth = $dbh->prepare(...) You are busy binding parameters explicitly - that's hard work for something that is going to be used once. Just use: $sth->execute(@$parameter_list); The $sth->finish() is not needed - it is only needed if you terminate a fetch loop early. Ideally, your test case should look something like the following. For any non-Informix users perusing this, the curly-brackets enclose inline comments in Informix's dialect of SQL. use DBD::Informix::TestHarness; use strict; use warnings; my $table = "test_table"; my $dbh = connect_to_test_database({RaiseError => 1}); $dbh->do(qq%CREATE TEMP TABLE $table (object_id SERIAL PRIMARY KEY {, ...})%); my $sth = $dbh->prepare(qq%INSERT INTO $table VALUES(? {, ? ... })%); $sth->execute(0); # Add extra values as needed my $serial = $sth->{ix_sqlerrd}[1]; print "SERIAL = $serial\n"; When I run this (Perl 5.8.0, DBI 1.37, DBD::Informix 2003.04, ESQL/C 9.52.UC1, IDS 9.30.UC3 on Solaris 8), it produces the answer I expect - "SERIAL = 1". -- Jonathan Leffler ([EMAIL PROTECTED]) STSM, Informix Database Engineering, IBM Data Management 4100 Bohannon Drive, Menlo Park, CA 94025 Tel: +1 650-926-6921 Tie-Line: 630-6921 "I don't suffer from insanity; I enjoy every minute of it!" Delivered-To: [EMAIL PROTECTED] Date: Tue, 24 Jun 2003 9:44:51 +0800 From: "tanyi" <[EMAIL PROTECTED]> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> Subject: ???? ???????????????? Dear Tim: I'm from china,one of your faithful reader to the book of "Programming the Perl DBI". I do really enjoy and benefit a lot. May I have your answer for a question? #use function mdbi_execute ($r_recordset, $nrows) = mdbi_execute($dbh, $sql, 1, [EMAIL PROTECTED]); #There is a problem. $sql='insert into a_objects(object_id) VALUES (?)'; #the data type of the field of 'object_id' is serial(1) (INFORMIX) the result of this execution is that ,compare with the original values,the values of 'object_id' were truncated . why? #define function mdbi_execute sub mdbi_execute { my $dbh = shift; my $sql = shift; my $return_flag = shift; my $parameter_list = shift; my @parameters; my $sth; # A SQL statement handle my @recordset; my @recordsets; my $nrows; my $i; # Use eval to trap prepare and execute error but don't quit program # ------------------------------------------------------------------ #print "@$parameter_list"."\n"."$sql \n"; eval { $sth = $$dbh->prepare($sql) || die "Can't prepare SQL statemant:\n\n $DBI::errstr \n\n $sql\n\n"; # Handle the parameters_list if(!defined $parameter_list) { $sth->execute() || die "Can't execute SQL statemant:\n\n $DBI::errstr \n\n $sql\n\n"; }else { for($i = 0; $i < @$parameter_list; $i++) { $sth->bind_param($i+1, $$parameter_list[$i]) } $sth->execute() || die "Can't execute SQL statemant b:\n\n $DBI::errstr \n\n $sql\n\n"; } @recordset = (); if($return_flag == 1) { @recordsets = $sth->fetchrow_array; }elsif($return_flag == 2) { while(@recordset = $sth->fetchrow_array) { push @recordsets, [EMAIL PROTECTED]; @recordset = (); } } if($sth->rows == -1) { $nrows = 0; }else { $nrows = $sth->rows; } $sth->finish; }; if($@) { print $@; return -1, $@; } if($return_flag == 0) { return 1, $nrows; }elsif($return_flag == 1 || $return_flag == 2) { return [EMAIL PROTECTED], $nrows; } } This is the first time that I enter into this forum. I`m looking forward to your email and I do hope you could provide me with some related information(network ,source code and materials etc). Any help would be appreciated! Thanks! Yours Paul Twa 2003/06/24 ???????????? ???????????????????? ???????????????????????????? ----- End forwarded message -----