I have the following sql script that successfully spools the result of a select statement into a textfile but I'm having trouble putting it into a stored procedure. Is there different syntax for the following in PL/SQL? How does it fit in a begin end block?
Code:
SET ECHO OFF
SET HEADING OFF
SET PAGESIZE 0
SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 115
SET FEEDBACK OFF
SET TERMOUT OFF
SPOOL c:/spooltest.txt
SELECT RPAD(pr_number_tx,9,' ')||
RPAD(NVL(pr_corp_code_tx,' '),5,' ')||
RPAD(NVL(TO_CHAR(pr_date_dt,'YYMMDD'),' '),6,' ')FROM purchase_requisition
WHERE pr_status_cd = 'APP'
ORDER
BY pr_number_tx;
SPOOL OFF
EXIT
[code]