sqlplus statement from command line

Viewed 253124

Is it possible to do something like this?

$ sqlplus -s user/pass "select 1 from dual" or
$ echo "select 1 from dual" | sqlplus -s user/pass

I know I can put select 1 from dual in a file and do this:
$ sqlplus -s user/pass @myFile.sql

but I'm wondering if it's actually necessary to create a file just to satisfy sqlplus

5 Answers

For windows version you can try below. remove double quotes (")

echo select 1 from dual; | sqlplus -s username/password@service
Related