Run DB2 Delete sql in a job

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
ds2000
Premium Member
Premium Member
Posts: 109
Joined: Sun Apr 22, 2007 7:25 pm
Location: ny

Run DB2 Delete sql in a job

Post by ds2000 »

How can i run db2 delete sql from a job ?

I have tried to use DB2 stage with peek stage where i have used user defined sql as:
SELECT TYPE FROM SYSCAT.TABLES fetch first 1 rows only;

and in 'BEFORE SQL' im using:
Delete from tbl1 where dttm='2008-01-04 01:00:00' as parameter. It gives me the following error:

db2command,0: Warning: db2command: SQLExecDirect: Error executing statement 'DELETE from sch1.tbl1 WHERE dttm = €8-09-06 18:23:44.0 '. See following DB2 message for details.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Please clarify what "as a parameter" means here.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ds2000
Premium Member
Premium Member
Posts: 109
Joined: Sun Apr 22, 2007 7:25 pm
Location: ny

Post by ds2000 »

Delete from tbl1 where dttm='2008-01-04 01:00:00'
above sql is passed as job parameter in 'BEFORE SQL'. Even if i just copy sql and run it gets the same error.

Im running db2.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... the entire sql statement is passed in as a parameter? That should be fine, just wanted that clarified. However, are you saying that even putting the sql statement in as-is (with any parameterization) gets you the same error? :?

Have you posted the entire set of messages this error generates, including any 'following DB2 message' that was logged?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ds2000
Premium Member
Premium Member
Posts: 109
Joined: Sun Apr 22, 2007 7:25 pm
Location: ny

Post by ds2000 »

rest of the msg:

db2command,0: Warning: db2command: [IBM][CLI Driver][DB2/NT] SQL0007N The character "€" following "dttm =" is not valid. SQLSTATE=42601
ds2000
Premium Member
Premium Member
Posts: 109
Joined: Sun Apr 22, 2007 7:25 pm
Location: ny

Post by ds2000 »

rest of the msg:

db2command,0: Warning: db2command: [IBM][CLI Driver][DB2/NT] SQL0007N The character "€" following "dttm =" is not valid. SQLSTATE=42601
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Your string pad character is set to 0x00 (its default value) but your DB2 is objecting to a fixed-length string (that is, a Char data type) being padded with this character. Explicitly pad the string with space or some other valid character, or change APT_STRING_PADCHAR.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply