Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

zby's scratchpad

by zby (Vicar)
on Jun 01, 2004 at 22:07 UTC ( [id://358660]=scratchpad: print w/replies, xml ) Need Help??

use Data::Dumper; use DBI; use strict; my $dbh = DBI->connect('dbi:ODBC:MID', 'midadmin', '*****') or die "Ni +e moge sie polaczyc: $!" ; =pod $dbh->{LongTruncOk} = 1; $dbh->{LongReadLen} = 1024; DBI->trace(5); =cut my @kolumny = qw( MIDDELETIONFLAG UMREN MEINH UMREZ LAENG BREIT NOEHE VOLUM VOLEH BRGEW +GEWEI MESUB SYSTEM_ID LEGACY_ID MAKT_MAKTX_PL MAS_IADSC DUP_CHK MAS_I +APACS MARM_MEINS MAS_IANPAL ); my @vals = ("S", "1", "PAL", "1152", "", "", "00337", "1200", "800", " +972", "MM", "933120", "CM3", "313", "KG", "CS", "PLNCPL", "00337", "P +LNCPL", "00337PAL", ); my $cols = join ', ', 'MIDID', @kolumny; my $placeh = join ', ', map {'?'} 'MIDID', @kolumny; my $statement = "INSERT into middbexp.marmtest ($cols) values ($placeh +)"; print $statement, "\n"; my $sth = $dbh->prepare($statement); print "\n\n"; $sth->bind_param(1, 2, 4); for my $nrcol (1 .. $#kolumny + 1){ print "$nrcol, $kolumny[$nrcol - 1], $vals[$nrcol - 1]\n"; $sth->bind_param($nrcol + 1, $vals[$nrcol]); } my $rv = $sth->execute(); print "$rv\n";
The output:
DBD::ODBC::st execute failed: [IBM][Client Access Express ODBC Driver +(32-bit)][DB2/400 SQL]Data truncated. (SQL-01004)(DBD: st_execute/SQL +Execute err=-1) at a.pl line 33. INSERT into middbexp.marmtest (MIDID, MIDDELETIONFLAG, UMREN, MEINH, U +MREZ, LAENG, BREIT, NOEHE, VOLUM, VOLEH, BRGEW, GEWEI, MESUB, SYSTEM_ +ID, LEGACY_ID, MAKT_MAKTX_PL, MAS_IADSC, DUP_CHK, MAS_IAPACS, MARM_ME +INS, MAS_IANPAL) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, ?) 1, MIDDELETIONFLAG, S 2, UMREN, 1 3, MEINH, PAL 4, UMREZ, 1152 5, LAENG, 6, BREIT, 7, NOEHE, 00337 8, VOLUM, 1200 9, VOLEH, 800 10, BRGEW, 972 11, GEWEI, MM 12, MESUB, 933120 13, SYSTEM_ID, CM3 14, LEGACY_ID, 313 15, MAKT_MAKTX_PL, KG 16, MAS_IADSC, CS 17, DUP_CHK, PLNCPL 18, MAS_IAPACS, 00337 19, MARM_MEINS, PLNCPL 20, MAS_IANPAL, 00337PAL

Autogenerate Test Scripts
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2025-04-29 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.