Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Need help exporting tables to flat files
Ken,
This is an example of one of my scripts to create flat file:
SET PAUSE OFF
SET PAGESIZE 0
SET ECHO OFF
SET TERMOUT OFF
SET HEADING OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET RECSEP OFF
SET SPACE 0
-- -- Redirect output to file. --
-- -- create data rows. (SDF format) -- All columns are converted to strings for better formating -- for comma delimited add ',' strings -- Example: SELECT 'D'||',', -- SUBSTR( NVL( recMW.RKEY, ' ') , 1 , 4 )||',', -- -- Note ||',' in end of every column. -- -- set line size correctly to prevent trailing blanks. SET LINESIZE 74 SELECT SUBSTR( NVL( recMW.RKEY, ' ') , 1 , 4 ), RPAD(NVL( recMW.CLNT, ' ') , 10 ), RPAD(SUBSTR( NVL( recMW.MKEY, ' ') , 1 , 9 ),9), RPAD( NVL( recMW.MWPLAN, ' ') , 1 ), RPAD( NVL( recMW.MWSRCE, ' ' ) , 1 ), RPAD( NVL( recMW.AMT_TYPE,' ') , 1 ), LTRIM( TO_CHAR( NVL( recMW.AMOUNT,0),'S099999999.9999' )), RPAD( NVL( recMW.FUND_MNGR,' '),3), RPAD( NVL( recMW.FUND_NUM,' '),5), LTRIM( TO_CHAR( NVL( recMW.COM_PERCNT,0),'S09.999')), RPAD( NVL( recMW.FUND_OPT, ' '),1), RPAD( NVL( recMW.TRADE_TYPE,' '),2), RPAD( DECODE(recMW.ORDER_DATE,NULL,' ,TO_CHAR( recMW.ORDER_DATE,'YYYYMMDD')),8), RPAD( NVL( recMW.DIV_OPTION,' '),1), RPAD( NVL( recMW.SEC_CODE,' '),6)FROM CPASINT.MFO_B2 recMW
-- -- Close output to file. --
HTH
Thomas
"Ken Taylor" <taylorkh_at_mind$pring.com> wrote in message
news:38b5966c.293217875_at_news.mindspring.com...
> Greetings,
>
>
>
>
>
>
> >
![]() |
![]() |