You export the result of commands to a <file>.
You are logged on to a database instance.
...
1. \o <file>
Enter the full path of the file.
2. Enter the command whose result is to be exported to the <file>.
<command>
To enter multiple commands in succession, choose Enter after each command.
3. To end the export, enter exit.
Logging on to the database instance DEMODB as user MONA with the password RED:
sqlcli -d DEMODB -u MONA,RED
Creation of the file c:\tmp\export.txt into which the SQLCLI is to export the result:
\o c:\tmp\export.txt
Entry of the first command:
\ds
Entry of the second command (SQL statement):
select * from HOTEL.CUSTOMER
Exiting the export procedure:
exit
The customer.txt file now contains the following contents:
| Schema name | Owner name |
| ----------- | -------------------------------- |
| DBADMIN | DBADMIN |
| DBM | DBM |
| DOMAIN | DBADMIN |
| HOTEL | MONA |
| MONA | MONA |
| MSGMAN | MSGMAN |
| OMS | DBADMIN |
| SYNCMAN | SYNCMAN |
| SYSINFO | DBADMIN |
| _webdav | 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: