Export Example

Top  Previous  Next

With dbfile you can export data into a delimited or fixed size file.

The syntax is very similar to that for importing.  The direction option changes to direction=o and the SQL statement becomes a SELECT query over one or more tables or views or a selectable stored procedure that returns rows.

A control file consisting of the following:

options direction=o file=countries.txt variables=2 user=SYSDBA  

    passwd=masterkey db=127.0.0.1:employee   

SELECT COUNTRY {position=1 size=15},  

    CURRENCY {position=16 size=10}) FROM COUNTRY

will produce the following fixed size data file:

USA            Dollar     

England        Pound      

Canada         CdnDlr     

Switzerland    SFranc     

Japan          Yen        

Italy          Euro       

France         Euro       

Germany        Euro       

Australia      ADollar    

Hong Kong      HKDollar   

Netherlands    Euro       

Belgium        Euro       

Austria        Euro       

Fiji           FDollar   

The named output file is created by dbFile.  If a file of that name exists already, dbFile will overwrite it.