954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Connection to sqlplus in perl

Hi,

I am facing issue while connecting to sqlplus in perl script. Following is my perl script code. It didn't execute properly & it take too much time to run very short sql.

#!/usr/bin/perl
$sql_return = `sqlplus -s user/password << SQL_END
set linesize 80
set pagesize 10
set heading off
set feedback off
SELECT ID,NAME,LASTNAME
FROM EMPLOYEES
WHERE ( ID= '$id');
quit
SQL_END
`;
chomp($sql_return);
$sql_return = trim($sql_return);
my ($id,$name,$lastname)= split('\n',$sql_return);
print "$id\n";
print "$name\n";
print "$lastname\n";

Can you please suggest if I'm missing anything here. Thanks!

sandeepau
Newbie Poster
16 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

Have you ever considered using DBI instead of sqlplus?

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You