PL/SQL - passing variables to SQL*PLUS.....

From: Syamasundaran T Unnithan <syam_at_rs3.tcs.tulane.edu>
Date: 1997/03/17
Message-ID: <5gke9c$ams$1_at_rs10.tcs.tulane.edu>#1/1


Hello newsgroup subscriber,

I am using oracle V7.3.2 on IBM RS6000 in AIX 4.1.5.  

What I want to do:
In PL/SQL block ,I want to generate a 'file_name'. I want to pass 'file_name' to SQL*PLUS, then to UNIX level. At UNIX level I want to issue 'wlctl .. .. ' command also. I want to do all these dynamically, or runtime.

What I am able to do:
In PL/SQL I can generate a 'file_name'.
From SQL*PLUS level, I can go to UNIX and issue the commands.

Where do I need help?
How can I pass 'file_name' to SQL*PLUS and UNIX dynamically.

Hints...
On p.507 of ORACLE PL/SQL programming,by Steven Feuerstein ,author suggests it is possible.
Author suggests the use of DBMS_SQL, ie.Dynamic SQL. Author mentions ideas of using OPEN_CURSOR , BIND_VARIABLE, EXECUTE, CLOSE_CURSOR.... Please help me in this matter...
An example will be great help.
I am including the PL/SQL block and SQL*PLUS command files.

Thanking you in advance, this is, Syam Unnithan.

create procedure last_c_lname as

begin

   declare

      file_nam varchar2(20);
      file_name varchar2(20);
      save_last_c varchar2(1);
      len NUMBER;
      position_of_ NUMBER;

begin

   select fname into file_nam from employee

          where salary = 38000;

   DBMS_output.enable(200);
   len := LENGTH(file_nam);
   position_of_ := len-1;
   save_last_c := SUBSTR(file_nam,-1);
   if SUBSTR(file_nam,position_of_,1) = '-'

     THEN
       file_name:=SUBSTR(file_nam,1,position_of_);
       file_name:=file_name||'0'||save_last_c;
   end if;

   file_name := file_name||'.jpeg';
   DBMS_output.put_line('file_name is: '||file_name); exception

   WHEN OTHERS THEN DBMS_OUTPUT.put_line('blop'); end;
end;

get last_c_lname.sql;
/
execute last_c_lname;
.
start slave.sql;
.

!clear
!cp file_nam file_name
!wlctl reload 8887
Received on Mon Mar 17 1997 - 00:00:00 CET

Original text of this message