1

I'm trying to run sqlcl on Windows 10 cmd with a one-liner query ...

Simply stated, here is what I'm trying to to do:

C:\ sql.exe -s username/password@database.hello.com:1521/ORCL 'SELECT * FROM some_table'

I know this is possible in linux, but I'm getting

Bad Filename : 'SELECT

What I can do is put the query into a file called test.txt like this:

SELECT * FROM some_table;
quit;

and run the following command - this works (but I'm trying to avoid using the file as the source of the command):

C:\ sql.exe -s username/password@database.hello.com:1521/ORCL @test.txt

Which produces the desired query results (in my case its this):

SOMETABLE

TEST1 TEST2 TEST3

I need to use this in a script to check the contents of a table after certain operations have been run on the system.

Since this question is specific to Windows, and sqlcl ... I'm going to leave it up with the answer ... the following works and the client automatically exits - (no need to quit):

C:\ echo SELECT * FROM some_table | sql.exe -s username/password@database.hello.com/1521/ORCL
Ivan Tuma
  • 11
  • 2
  • Did you try using double quotes instead of single quotes? – Ken White Dec 05 '20 at 01:47
  • Yes, that didn't work either unfortunately, but actually a related article answered my question... This inline statement I found actually works (and the client automatically exits - no need to quit): C:\ echo SELECT * FROM some_table | sql.exe -s username/password@database.hello.com/1521/ORCL – Ivan Tuma Dec 05 '20 at 02:07

0 Answers0