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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DECODE different things

Status
Not open for further replies.

drkestrel

MIS
Sep 25, 2000
439
GB
I am using DECODE with SQL Loader.
My objective is to convert any of the following to NULL for a field called CODE:
Spaces
-111

I tried the following:
Code:
CODE    POSITION(249:260)   INTEGER EXTERNAL "DECODE(trim(:CODE),'',null,'-111',null,:CODE)"

Problem is that (from what I guessfrom reading the documentation), DECODE seems to have coverted the value to the type as defined in the first expression- i.e. type for '' is VARCHAR or CHAR, and that the field is numeric....

anyway, the outcome is that -111 is not set to null. Any suggestions for getting around with this?
 
It should have been

CODE POSITION(249:260) INTEGER EXTERNAL "DECODE(trim:)CODE),'',null,-111,null,:CODE)"

Witout the '', cos field is Numeric!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top