The SQL*Plus host command allows you to run operating system commands from within a SQL*Plus session:
SQL> host date
Wed Feb 8 10:56:34 GMT 2012
SQL>
Alternatively, you can use an exclamation mark:
SQL> ! echo "Andrew was here"
Andrew was here
SQL>
... and, if you do, it is not necessary to leave a space between the exclamation mark and the OS command:
SQL> !pwd
/home/oracle/examples/host
SQL>
host (or ho) is system independant
ReplyDeletein unix, you could ! and in windows $
the return code is in &_RC, sometimes
Dear Laurent,
ReplyDeleteThat's a very useful clarification. I saw a reference to using a $ in some old documentation but it didn't make it clear that it was for Windows only. I tried it out on UNIX but could not get it to work!
Best wishes,
Andrew