Redirecting a Result to a File

Use

Redirect the result of commands to a <file>.

Prerequisites

You are logged on to a database instance.

Procedure

...

       1.      \o <file>

Enter the full path of the file.

       2.      Enter the command whose result is to be redirected to the <file>.

<command>

To enter multiple commands in succession, choose Enter after each command.

       3.      To stop redirection to a file, enter \o.

Example

Log on to the database instance DEMODB as user MONA with the password RED:

sqlcli -d DEMODB -u MONA,RED

Create the file c:\tmp\redirected.txt into which the SQLCLI will redirect the result:

\o c:\tmp\redirected.txt

Enter the following command:

\ds

Enter your SQL statements in the SQL dialog window.

select * from HOTEL.CUSTOMER

Stop redirection to a file.

\o

The file redirected.txt now has the following content:

| Schema name | Owner name                       |

| ----------- | -------------------------------- |

| DBADMIN     | DBADMIN                          |

| DBM         | DBM                              |

| DOMAIN      | DBADMIN                          |

| HOTEL       | MONA                             |

| MONA        | MONA                             |

| OMS         | DBADMIN                          |

| SYSINFO     | DBADMIN                          |

| CNO    | TITLE   | FIRSTNAME  | NAME       | ZIP   | ADDRESS|
| ------ | ------- | ---------- | ---------- | ----- | -------|
|   3200 | Company | ?          | Datasoft   | 90018 | 486 Maple Str.|
|   3400 | Mrs     | Mary       | Griffith   | 20005 | 3401 Elder Lane|
|   3500 | Mr      | Martin     | Randolph   | 60615 | 340 MAIN STREET, #7|
|   3600 | Mrs     | Sally      | Smith      | 75243 | 250 Curtis Street|
|   3700 | Mr      | Mike       | Jackson    | 45211 | 133 BROADWAY APT. 1|
|   3900 | Mr      | George     | Howe       | 75243 | 111 B Parkway, #23|
|   4000 | Mr      | Frank      | Miller     | 95054 | 27 5th Str., 76|
|   4400 | Mr      | Antony     | Jenkins    | 20903 | 55 A Parkway, #15|

...

 

See also:

Executing a Command