How to call external program from SQL*Plus and catch its output into anonymous PL/SQL block [message #678902] |
Tue, 21 January 2020 11:45  |
 |
Olexandr Siroklyn
Messages: 36 Registered: September 2018 Location: USA
|
Member |
|
|
sqlplus "/ as sysdba"
...
SQL>host rm ./mypipe.sql
SQL>host mkfifo mypipe.sql
SQL>host echo "set heading off"'\n' "select 'It works' from dual;" | sqlplus -s "/ as sysdba" > mypipe.sql &
SQL>set serveroutput on
SQL>declare
file_contents VARCHAR2(32767):='
@@mypipe.sql
';
begin dbms_output.put_line(file_contents); end;
/
It works
SQL>
P.S.
It's AIX example. For Linux use -e option for echo command
P.P.S
SP2-0317: expected symbol name is missing message can be ignored.
|
|
|
|
|
|
|
|
|
|
|
|