Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling Unix Shell Script inside PL/SQL

1913207Oct 17 2014 — edited Oct 20 2014

#!/bin/sh

sqlplus -s apps << !!

DECLARE

v_file VARCHAR2(20);

CURSOR C1 IS

SELECT CONCURRENT_REQUEST_ID FROM RG_REPORT_REQUESTS_V

WHERE REPORT_SET_ID IN (SELECT REPORT_SET_ID FROM RG_REPORT_SETS WHERE NAME LIKE 'PBGC%')

ORDER BY SEQUENCE

BEGIN

FOR I IN C1

LOOP

v_file:='o'||i.concurrent_request_id||'.out';

/* I want to copy the v_file which exists in outpath to the current directory (/usr/tmp) */

DBMS_OUTPUT.PUT_LINE('Request ID :',i.concurrent_request_id);

END LOOP;

END;

!!

In my code i want to use the UNIX Copy command to copy the file. Please suggest me how to do the same.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 17 2014
Added on Oct 17 2014
3 comments
1,465 views