lars_4 has asked for the wisdom of the Perl Monks concerning the following question:
*please ignore the bad oracle sql statement* Hopefully someone knows what is going on..?#!/usr/bin/perl $ENV{'ORACLE_HOME'} = '/prog/oracle/10.2.0'; use DBI; use Mysql; use strict; #############MYSQL############### sub sub_mysql { my $myhost = "localhost"; my $mydatabase = "db"; my $mytablename = "table"; my $myuser = "user"; my $mypwd = "password"; my $myconn = Mysql->connect($myhost, $mydatabase, $myuser, $mypwd); $myconn->selectdb($mydatabase); my $myquery = "INSERT INTO $mytablename (date, status, well) VALUES (N +OW(),'$_[0]','$_[1]')"; my $myexecute = $myconn->query($myquery); } ###############END MYSQL################ ##############ORACLE SQL############## my $orahost = "oracle.bla.com"; my $oraport = "1000"; my $orasid = "I01"; my $orauser = ""; my $orapwd = ""; my $oraconn = "dbi:Oracle:HOST=$orahost;SID=$orasid;port=$oraport"; my $db = DBI->connect( $oraconn, $orauser, $orapwd ) || die( $DBI::err +str . "\n" ); my $oraquery = "SELECT date, status, well FROM bla where > sysdate -1 "; my $sth = $db->prepare($oraquery); $sth->execute(); my ($date, $well, $status); $sth->bind_columns(\$date, \$well, \$status); while( $sth->fetch() ) { sub_mysql("$status","$well"); } $db->disconnect; #############END ORACLE SQL#############
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl script not running correct as a cron
by JavaFan (Canon) on Jun 05, 2009 at 09:30 UTC | |
by lars_4 (Initiate) on Jun 05, 2009 at 09:36 UTC | |
by JavaFan (Canon) on Jun 05, 2009 at 09:48 UTC | |
by lars_4 (Initiate) on Jun 05, 2009 at 09:50 UTC | |
by JavaFan (Canon) on Jun 05, 2009 at 09:58 UTC | |
|
Re: Perl script not running correct as a cron
by codeacrobat (Chaplain) on Jun 05, 2009 at 18:57 UTC |