SQL * Plus does not return anything; it maps the result of the query to standard output. To get a direct call to only display 3 , you can set heading off in an SQL script, and also call SQL * Plus with the -s flag to suppress the banner. You probably also want to exit at the end of the SQL script so that it does not stay in the SQL> prompt.
The same applies to calling powershell, but something else happens there; 17 - line number, which means that he expects more input and did not execute the command in the SQL script, which implies either a query without a terminator ; either / or PL / SQL block without interruption. But if this is the same SQL that you ran in the first example, this is a little strange, as they should behave the same. You must add the contents of the SQL script to the question to find out what might be wrong.
The only thing I can think about is to change the behavior as if you had login.sql , which includes the set sqlterminator , but you have to collect different login.sql files from two calls ... which is plausible, if powershell has its own environment variables, maybe.
source share