0

I am creating a powershell script to execute oracle sql script. It is necessary for me to know the query output before I decide to commit or rollback the transaction. How can I read the script output first and keep the sqlplus session so I can issue commit/rollback later?

Here is my code:

$script | &"$env:ORACLE_HOME\bin\sqlplus" ”$schema_name/$schema_pwd@$instance_name$Oracle_Version_Suffix" | Tee-Object -Variable output | Out-Null
2
  • 3
    Perhaps you should consider using a .Net Oracle Library to perform your connection and query so that you have more control over the flow. Take a look at this answer to another question for an example. Commented Jan 18, 2018 at 1:04
  • As an alternative, could you run the script twice; once to determine query output and a second time with a commit? Commented Jan 18, 2018 at 4:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.