How to export from oracle to spool text using SQL Navigator
Since my job now need me to convert back from oracle to Cobol text file, i just publish the easiest way to export your data to spool text file.
In this note I will use SQL Navigator as tool.
Keep in mind this export procedure can be different depend on your scenario.
Scenario.From Cobol Data Library, i need to convert from oracle to text file by follow the exact length of column(field).
RDB Table:
TEST
Column :
name (varchar2 - 255),
account(varchar2 - 255),
address(varchar2 - 255),
oldacc(varchar2 - 255)
From Cobol Data Library:
Length:
Record Length: 40
name (10)
account (5)
address (20)
oldacc (5)
In this note I will use SQL Navigator as tool.
Make a select statement like this:SQL Navigator will return this
SELECT lpad( DECODE (a.name,null,' ',a.name),10,' ')||
rpad( DECODE (a.account,null,' ',a.account),5,' ')||
rpad( DECODE (a.address,null,' ',a.address),20,' ')||
rpad( DECODE (a.oldacc,null,' ',a.oldacc),5,' ')
from TEST a
LPAD(DECODE(A.NAME,NULL,'',A.NAME),10,'')||RPAD(DECODE(A.ACCOUNT,NULL,'',A.ACCOUNT,5,'')||RPAD(DECODE(A.ADDRESS,NULL,'',A.ADDRESS),20,'')||RPAD(DECODE(A.OLDACC,NULL,'',A.OLDACC),5,'')Then export the result to your spool text.
Micheal 12345Block A, Street SmartA0123
Keep in mind this export procedure can be different depend on your scenario.

0 Comments:
Post a Comment
<< Home