Thread Update auf db mit perl (19 answers)
Opened by Duff at 2008-01-15 16:34

Duff
 2008-01-16 11:42
#104779 #104779
User since
2006-10-06
283 Artikel
BenutzerIn

user image
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

View full thread Update auf db mit perl