Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use DBI;
- use strict;
- use vars qw($dbh $sth);
- BEGIN {
- #$ENV{ORACLE_HOME} = '/home/oracle/product/10.x.x';
- #$ENV{TWO_TASK} = 'DB';
- #$ENV{'DBI_TRACE'}='0';
- }
- my $host='localhost';
- my $sid='orcl';
- DBI->trace(15);
- #DBI->trace( 1, 'my_program.trace' );
- # get a database handle
- $dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid;port=1521", 'system', 'scott');
- # get a statement handle
- #$sth=$dbh->prepare('SELECT current_date FROM dual');
- $sth=$dbh->prepare('SELECT nev FROM table1');
- # execute the statement handle
- $sth->execute();
- # loop through the results
- while (my ($value) = $sth->fetchrow())
- {
- print " $value \n";
- }
- $sth->finish();
- $dbh->disconnect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement