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
Daniel Hua
  • 153
  • 2
  • 8
  • 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](https://stackoverflow.com/a/45178325/3245749) answer to another question for an example. – TheMadTechnician Jan 18 '18 at 01:04
  • As an alternative, could you run the script twice; once to determine query output and a second time with a commit? – andyb Jan 18 '18 at 04:43

0 Answers0