Page 1 of 1

Run DB2 Delete sql in a job

Posted: Sat Jul 12, 2008 5:21 am
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.

Posted: Sat Jul 12, 2008 6:32 am
by chulett
Please clarify what "as a parameter" means here.

Posted: Sat Jul 12, 2008 9:50 am
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.

Posted: Sat Jul 12, 2008 9:57 am
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?

Posted: Sat Jul 12, 2008 10:00 am
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

Posted: Sat Jul 12, 2008 10:15 am
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

Posted: Sat Jul 12, 2008 4:39 pm
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.