Monday, July 21, 2008

Pass a Unix Variable into a PL/SQL Program

I am using the Oracle SQL*Plus environment and need to pass a variable from
the UNIX command line into a PL/SQL program.
set serveroutput on
set verify off
/* plsql starts here */
declare
my_filename varchar2(20);
begin
my_filename := '&1'; /* &1 represents the 1st command line argument */
dbms_output.put_line(my_filename);
/* call your stored procedure here */
end;
/

At the command line type the following:
sqlplus scott/tiger @my_script.sql hello

No comments:

search engine

Custom Search