Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
cancel
Showing results for 
Search instead for 
Did you mean: 

PLSQL with Perl

SOLVED
Go to solution
Kalin Evtimov
Regular Advisor

PLSQL with Perl

Hi!
I have a small problem, maybe syntax:

I create an sql-file using spool:


$file = "file.sql";
$HOT=qx{$ENV{'ORACLE_HOME'}/bin/sqlplus -SL /nolog < whenever sqlerror exit failure
set termout off heading off feedback off trimspool on
set echo off linesize 1000 pagesize 300
connect / as sysdba;
whenever sqlerror continue
spool $file
select 'alter tablespace '||a.tablespace_name||' end backup;'
----and so on---------

spool off
END};

Now I want to call the created sql-file and use:

start $file

Here my programm freezes and does nothing more.
If I test the sql-file separately, it works perfectly. But calling within the perl-script doesn't work properly.

Help appreciated. Many thanks.
2 REPLIES
Peter Godron
Honored Contributor
Solution

Re: PLSQL with Perl

Kalin,
as a test, can you write your file.sql as you do at the moment, but then start a new sqlplus session and do your start.
So:
1. Create your file.sql
2. exit sqlplus
3. Start new sqlplus, which starts file.sql

This used to be our workaround whwn packages were not being executed, which I assume also stands true for PLSQL.
Kalin Evtimov
Regular Advisor

Re: PLSQL with Perl

Thanks.

The problem was in the wrong settings of the database..I hope it wil work.