SQL Plus - Host

Card Puncher Data Processing

About

Host executes an operating system command without leaving SQL*Plus.

Enter HOST without command to display an operating system prompt and EXIT to return.

Syntax

HO[ST] [command]

On Unix system, you can use the Exclamation mark as alias.

Child process

The host command starts a child process. It has therefore no influence on the working directory of SQLPlus.

  • Just don't stay in your OS home directory
cd C:\temp
  • start SQLPlus
sqlplus myLogin/MyPasswor@MyTnsNames
  • and execute this command:
host dir

It will give your OS home directory and not your current working directory:

Volume in drive C has no label.
 Volume Serial Number is AEB0-A348

 Directory of C:\users\gerard

2013-10-15  17:08    <DIR>          .
2013-10-15  17:08    <DIR>          ..
2012-10-16  13:45    <DIR>          .ant
2013-06-06  12:58               498 .dbfit.jks
2012-09-16  19:25    <DIR>          .eclipse
2013-08-31  12:27               182 .gitconfig
2013-03-08  11:39    <DIR>          .hudson
2013-05-01  11:10    <DIR>          .idlerc
2012-11-10  16:37    <DIR>          .jmsn
2012-10-16  13:45    <DIR>          .m2
2013-05-01  09:33    <DIR>          .ssh
2013-05-16  09:20    <DIR>          .VirtualBox
2012-09-20  21:45    <DIR>          .zenmap
2012-05-11  08:24    <DIR>          AppData
2012-06-22  12:04    <DIR>          catalogmanager
2013-01-22  19:01             3,664 COBI_UTILS_PCK.sql
2013-01-22  19:01            82,132 COBI_UTILS_PCK_1.sql
2013-01-22  19:05             3,400 COBI_UTILS_PCK_2.sql
2013-01-23  11:15            80,439 COBI_UTILS_PCK_3.sql
2013-01-22  19:06            77,039 COBI_UTILS_PCK_4.sql
2013-09-20  10:02    <DIR>          Contacts
2012-06-01  15:29             1,577 data_template.xml
2013-10-28  14:57               562 default-soapui-workspace.xm
...........................................

Example

Windows

host dir
Volume in drive D is Yo
 Volume Serial Number is 52EE-02AA

 Directory of D:\temp\

2013-10-14  17:55    <DIR>          .
2013-10-14  17:55    <DIR>          ..
2013-09-12  15:37               204 myFile.txt
2013-10-14  17:48               655 myDemo.bat
...................................................
...................................................
              13 File(s)         14,866 bytes
               2 Dir(s)  78,909,874,176 bytes free

Linux

!pwd
/home/oracle





Discover More
Card Puncher Data Processing
SQL Plus - Command Reference

Commands Description @ @@ / ACCEPT APPEND ARCHIVE ATTRIBUTE BREAK BTITLE CHANGE CLEAR COLUMN COMPUTE CONNECT COPY Copies data from a query to a table in the same or another...
Card Puncher Data Processing
SQL Plus - Special Characters

Useful command in sqlplus. The At & character is the default character that define a substitution variable. You can change it with the define system variable. The slash command (/): ...
Card Puncher Data Processing
SQL Plus - Working Directory

The working directory is the directory where you start the SQLPLus utility . There is no way to change it as the host command starts a child process. Therefore a will have no effect.



Share this page:
Follow us:
Task Runner