Home » SQL & PL/SQL » SQL & PL/SQL » how to call an sql script with in the PL/SQL script
how to call an sql script with in the PL/SQL script [message #228421] Tue, 03 April 2007 00:12 Go to next message
lokeshg82
Messages: 23
Registered: February 2007
Location: chennai
Junior Member
hi,

here i want to call sql script from PL/SQL script.

see the my code below,

set serveroutput on
DECLARE
  data varchar2(20);
variable1 NUMBER;
HandleN varchar(20);
BEGIN
  data:='&1';
  select BI_ACCOUNTID into variable1 from pb_bill_info where PBBTN=data;
     do.pl('BI_ACCOUNTID');
     do.pl('------------');
     do.pl(variable1);
select pbhandlenamelower INTO HandleN from pb_handle where pbhandleid in(select max(pbhandleid)
from pb_handle where ha_customerentityid in (select acct_customerentityid from account
where acct_accountid =variable1)) AND pbmainhandleflag=1 ;
     do.pl('==============================') ;
     do.pl('Handle Name: ' || HandleN ) ;
     do.pl('==============================') ;
EXCEPTION
     WHEN OTHERS THEN
     do.pl('No rows selected');
END;



here inside the code,want to call account.sql script which is called as '@account'.

i tried to execute this code
'execute immediate '@'||'account'||'account.sql';
but im getting some exception..

pls guide me...

Re: how to call an sql script with in the PL/SQL script [message #228444 is a reply to message #228421] Tue, 03 April 2007 01:48 Go to previous message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can't do that in PL/SQL.
You can:
  • Read with UTL_FILE the script and execute each line
  • Put the script in a table and execute each row
  • Spawn a SQL*Plus to execute the script
  • And surely other ways

Regards
Michel
Previous Topic: Run SQL files using SQL-PLUS
Next Topic: Temporary table
Goto Forum:
  


Current Time: Fri Dec 09 04:11:29 CST 2016

Total time taken to generate the page: 0.22667 seconds