Sqlplus hangs when run in powershell ISE

I’m running into the issue where I’m testing an oracle sql call in powershell ISE, and it hangs. It says connected, and stops.

I was reading sqlplus hanging when run from powershell ise, and it seems to be a regular issue. I always test with powershell ise. Is there a way to workaround it? It happens when I run in powershell ISE from the prompt or from my script. It is a very lengthy script so I can’t just run the one command from the powershell prompt (not in ise). Can I move the sqlplus command to a separate powershell script and run that from powershell ise as a command to execute? I’m not sure what to do to get it to run and still use powershell ISE to write the rest of my code.

This is what the command looks like, but I don’t think that’s it.

sqlplus user/pw@RRRPRD.company.net:1521/RRRPRDC ‘@C:\Users\me\Documents\2021\temp endToEnd\short.sql’

It says this on the screen and all looks good:

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

but it hangs. It’s a short query so shouldn’t take forever.

Update: I’m using VSCode now, and fixed a missing \ before short.sql.
I added this:
$quote = ‘"’

 $info = $("{0}/{1}@{2}:{3}/{4} `@{5}{6}{5}" -f  $username, $password, $hostIp, $port, $service, 
 $quote, $sqlPath,$quote)  
 $result = ""
 Write-Host "info: $info"
 $result = sqlplus '$info'
 Write-Host "result: $result"

But it’s not printing result: before the 2 it shows now, or the db connection info when I run in VSCode.

Terminal output when run at terminal:


Last Successful login time: Tue Jan 11 2022 09:05:19 -05:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

2

The query it’s running now is select * from tablename which runs fine in Oracle sql developer. This has a few columns and a few rows. It shouldn’t be printing a “2”.

I suggest you use VSCode. Its 10x than ISE for development and is used by everyone now. Its actively developed and maintained. ISE is obsolete now.

Visual Studio Code - Code Editing. Redefined

PowerShell editing with Visual Studio Code

1 Like

@kvprasoon - it’s still hanging with VSCode. It’s a little different now. It says Connected to Oracle DB Enterprise Edition Release xxx - Production. Then it has a 2. It should print table query results. Any ideas how to debug this, or what’s wrong with it?

FYI, it looks like a 2 returned means a semicolon is missing. Once I added that it provided results.

Thanks to @kvprasoon for suggesting VSCode, which got me past the ISE issue running sqlplus. I’m going to accept his solution because it got me past the ISE issue. Thanks a lot!

1 Like