Skip to main content

sqlplus used in perl

sqlplus is a command line tool used to work with an Oracle database.

#!/bin/perl
my $sqlString ='sqlplus -s user/pass@SID << END
set heading off
set echo off
set feedback off
set pagesize 0';

$sqlString = "$sqlString\nSELECT 'test' FROM dual;";

my $result; = `$sqlString`;

print $result;
usage: sqlplus [-s] user/pass@SID
-s parameter enables a silent mode. Only result of statement executions will be returned to a standard output (data like 'SQL>' prompt or a connection confirmation will be skipped)

To disable a default human-redable format of returned data the following parameters are set: heading, echo, feedback, pagesize.

Comments