myscript.sql:
set serveroutput on
set feedback off
set heading off
set echo off
DECLARE
CURSOR c1 IS
select 2 from dual
BEGIN
FOR i IN c1
LOOP
DBMS_OUTPUT.put_line (i.object_text );
END LOOP;
END;
/
exit;
I call my script with that:
sqlplus user/pass@database @Dpath\myscript.sql -S | Out-String | echo
- SQL*Plus Version..........is always printed in the beginning. I don't want it.
- the lines of my query are printed. that is OK.
- Disconnected .... from Oracle Database is always printeed in the end. I don't want it
This code is just a reproductible example.I know that for the particular case, there is other way to do that. But what I want is to print just the dbms_out
-s(or-silent) flag will suppress the banner, but also the statement being executed; are you sure you want to see that? But that flag has to be before the@scriptpart (and the credentials), otherwise it's just seen as another positional parameter.