Thursday, May 29, 2008

What is the difference between $ ! and HOST?

Actually in terms of functionality there is no difference between $,! and host. They all perform the same task which is to execute Operating system command. Whenever we write any one of these inside SQL*Plus, SQL*Plus will execute operating system commands as child processes of SQL*Plus. Individually enter anyone of these like only host or ! will enter you into a OS prompt. But it does not affect the current SQL*Plus session. After you terminate the session you again enter to SQL*session.

Example:
-----------------------------------
SQL> host

bash-3.00$ hostname
neptune
bash-3.00$ exit
exit

SQL> --SQL prompt is returned

The host command is more generic. You can use it on any platform.
The ! command is for unix operating system only.
The $ command is for OS/390, VMS, and Windows OS only.

Example:
-------------------
SQL> !pwd

/export/home/oracle

Related Documents:
-------------------------------------------------------
How to set Environmental variable to SQL*Plus permanently

No comments:

Post a Comment