Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Case statement logic for External Tables

ChaitanyaGoparajuDec 16 2010 — edited Dec 16 2010
Hi All,

Is there anyway I can perform a CASE logic in External table creation script?

I have a column which is supposed to receive only Numbers. But if i inadvertently receive a String, i want to insert NULL for that instance.
My table has the following creation syntax: ( I have to make a check for the NumValue column - althought I am using VARCHAR2(50) I have the transformation stage where the NumValue column has a CASE logic ; my entire file is getting rejected just because a single row in the input dat file is coming as a String)

CREATE TABLE XYZ_TABLE
(
LineNumber NUMBER(20),
NumValue VARCHAR2(50 BYTE)
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY "EXT_TAB_DIR"
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
BADFILE 'EXT_TAB_DIR_LOG':'FILE1.BAD'
LOGFILE 'EXT_TAB_DIR_LOG':'FILE1.LOG'
DISCARDFILE 'EXT_TAB_DIR_LOG':'FILE1.DSC'
FIELDS TERMINATED BY '#|#'
OPTIONALLY ENCLOSED BY '#$' and '$#'
MISSING FIELD VALUES ARE NULL(
LINENUMBER,
NUMVALUE

)
)
LOCATION
( 'FILE1.dat'
)
)
REJECT LIMIT UNLIMITED;


Thank you,
Chaitanya
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2011
Added on Dec 16 2010
9 comments
792 views