Oracle Enterprise stage, UPSERT works, TRUNCATE aborts!

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Oracle Enterprise stage, UPSERT works, TRUNCATE aborts!

Post by vinaymanchinila »

Hi,
I have a file which I load into a table. If I use UPSERT option in the Oracle enterprise stage, the job finishes fine, but If I use

WRITE METHOD=LOAD & WRITE MODE= TRUNCATE, the job aborts with the following error!

The system(sqlldr bdr@cooradevl31 CONTROL=ora.3331.899749.0.ctl LOG=ora.3331.899749.0.log BAD=ora.3331.899749.0.log.bad SILENT=header PARFILE=ora.3331.899749.0.par) failed; see the log file for the Oracle specific message.

Any help is greatly appreciated
Thanks,
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Vinay,

have you done what the error message has told you to do?

Go to your DataStage temp directory, start with node1 and look into the directory /default/Scratch and then view the file ora.3331.899749.0.log

sometimes the first /tmp node doesn't have the error, in which case I would look at the log file in more detail or just use the "find" unix command to locate the log file.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Hi Arnd,

It is complaining about inserting a blank into a field , but it is really not null .

Record 805: Rejected - Error on table SAP_ZAVL_PROJ, column ZAVL_PROJ_DESIGN_ID.ORA-01400: cannot insert NULL into (ZAVL_PROJ_DESIGN_ID)
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Vinay,

the column is probably an Oracle VarChar2() datatype ... and by definition the loader trims these and makes it a null field.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Hi ,
The job works in 2 scenarios,

1)When I took the source column out and had a constant.

2) When I changed the constant to ' ' it works but I do not understand why it doesnt recognize the ' ' comming in !

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ArndW wrote:the column is probably an Oracle VarChar2() datatype ... and by definition the loader trims these and makes it a null field.
There is a sql loader option to PRESERVE BLANKS and I would think there would be a way to enable this for a load.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Hi Arnd,

It is "NOT NULL CHAR(4)".

I tried to use

if IsNull(Src.Col2) then ' ' else Src.Col2

and it still aborts
Record 805: Rejected - Error on table SAP_ZAVL_PROJ, column ZAVL_PROJ_DESIGN_ID. ORA-01400: cannot insert NULL into (ZAVL_PROJ_DESIGN_ID)

is your name Arnold ?
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Searched for it and I used the APT_ORACLE_PRESERVE_BLANKS, and set it to true.

The job finishes now!

Thanks a bunch guys.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The APT_ORACLE_PRESERVE_BLANKS will work as long as the column isn't VarChar2; I assumed that it was set so was looking for the more obscure error.

Good job - glad to see it is working.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

It i sChar(4), so how do we handle this if it is varchar ?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There isn't a workaround. If you have a NOT NULLable VarChar2 column and the data only has spaces in it then the bulk load method won't work.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

But I dont understand why the following statement doesnt work:

if IsNull(Src.Col1) then ' ' else Src.Col1

' '=Blank


Thanks,
Post Reply