Thread Update auf db mit perl
(19 answers)
Opened by Duff at 2008-01-15 16:34
Danke, aber das %attr benutze ich nur beim DBI->connect.
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 sub update { my $dbh = shift; my $stmt = "UPDATE tabellenname SET spalte1 = ?, spalte2 = ? WHERE spalte3 = ?"; my $rows = $dbh->do( $stmt, undef, @_[1..3] ); print "$rows Zeilen aktualisiert\n"; $dbh->commit; } my $dbh=DBI->connect("dbi:Oracle:$db_name",$db_user, $db_pw, \%attr) or die "Fehler $DBI::errstr"; update($dbh,$spalte1, $spalte2, $spalte3); $dbh=DBI->diconnect(); D'OH
Daniel |