Click to See Complete Forum and Search --> : perl and sqlplus


frank_sg
02-22-2011, 09:06 AM
Hi all,

does anybody know a solution to this problem:

I try to ask my oracle this here in a perlscript ($user ans $tab are set before and do have correct values!):

my $sql = `su - $user -c \'sqlplus -s / as sysdba <<END
select * from $tab
where TRANS_ID = '4D1B8873725B4129E10000000A643382'
order by TABLE_ID;
END
`;


The response I get is:
where TRANS_ID = 4D1B8873725B4129E10000000A643382
*
ERROR at line 3:
ORA-00933: SQL command not properly ended

Right - the sql is not correct. But even if i mask the '-chars like this:
my $sql = `su - $user -c \'sqlplus -s / as sysdba <<END
select * from $tab
where TRANS_ID = \'4D1B8873725B4129E10000000A643382\'
order by TABLE_ID;
END
`;

I do get the same error.

If I could install DBI and DBD::Oracle this would be a solution - but I am stuck to the backtick-option. Any ideas what the problem is and how to solve it?

Thanks and best regards,
Frank