#!/usr/local/bin/perl use strict; use DBI; # Connect to Oracle database, making sure AutoCommit is # turned off and potential errors are raised. my $dbh = DBI->connect( 'dbi:Oracle:orcl', 'scott', '**', { RaiseError => 1, AutoCommit => 0 } ); # Create the SQL. my $sql = qq{ SELECT 'Hello World' FROM DUAL }; # Prepare the SQL and execute. my $sth = $dbh->prepare( $sql ); $sth->execute( ); # Fetch output rows into array, plus prepare a # print formatter for the results. while ( my($helloWorldString) = $sth->fetchrow_array) { # Print out the result. print $helloWorldString, "\n"; } $dbh->disconnect( ); # Disconnect