#!/usr/bin/perl -w use DBI; use strict; $ENV{"ORACLE_HOME"}="ORACLE_HOME=/oravl01/oracle/8.0.6/"; $ENV{"TWO_TASK"}="nxt1"; my $dbh = sqlConnect("alan1", "alan1"); unless ($dbh) { showSQLError( $DBI::errstr ); exit; } getRef( $dbh ); sqlDisconnect( $dbh ); sub sqlConnect { my ( $username, $password ) = @_; my $connectString = join '/', $username, $password; return DBI->connect('dbi:Oracle:',$connectString); } sub sqlDisconnect { my $dbh = shift; $dbh->disconnect; } sub getRef { my $dbh = shift; my $statement = "select OI_REFERENCE from OPEN_ISSUES order by OI_REFERENCE asc"; print "$statement\n"; my $sth = $dbh->prepare($statement) or showSQLError($dbh->errstr); $sth->execute or showSQLError($sth->errstr); print "\n#"; while(my ($oir) = $sth->fetchrow_array) { print "\n- $oir"; } print "\n#\n"; } sub showSQLError { print ""; }