Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple transformations, SQL*LOADER?

Status
Not open for further replies.

tradle

Programmer
Jan 7, 2004
94
US
Hi All -

I'm dealing with a really finicky data source, and have been able to handle every condition but one. I have been able to convert the string $99,999.99 to a valid number, but I cannot figure out how I can also convert ($99,999.99) to -99,999.99 for the same record, because not every record is negative. My control file logic is below.

Code:
load data replace
into table BLAH
TRAILING NULLCOLS (
IGNORE_1    char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
IGNORE_2    char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
CO          char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
CENTER      char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
ASSET       char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
DESCRIPTION char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
ACQDT       date "MM/DD/YY HH24:MI:SS"  TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
CATGRY      char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
COST        char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' "TO_NUMBER(:COST, '$99999999.99')",
IGNORE_3    char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
LTD_DEPR    char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' "TO_NUMBER(:LTD_DEPR, '$99999999.99')",
NET_BK_VAL  char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' "TO_NUMBER(:NET_BK_VAL, '$99999999.99')",
CURR_DEPR   char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' "TO_NUMBER(:CURR_DEPR, '$99999999.99')",
YTD_DEPR    char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' "TO_NUMBER(:YTD_DEPR, '$99999999.99')",
ADDL_DESC   char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
ELIFE       char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
PROJ_NUM    char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
QUANTITY    char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
MANUF_NAME  char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
MODEL_NAME  char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"',
SERIAL_NUMB char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
        NULLIF SERIAL_NUMB=BLANKS,
STA         char   TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
        NULLIF STA=BLANKS,
LOAD_DATE   sysdate,
SEQUENCE_NO RECNUM
)

Thanks,
Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top