NOTHING,
DOES ANYONE HAS ANY MORE SUGGESTIONS?
RIGHT NOW I HAVE AND NOT WORKING ON DB2 V.7 FOR OS/390 THE FOLLOWING:
CREATE TRIGGER trigger_name NO CASCADE BEFORE INSERT
ON table_anme REFERENCING NEW AS N
FOR EACH ROW MODE DB2SQL
WHEN (N.field_name1=0)
BEGIN ATOMIC
SET field_name1=NULL;
All I want is that before inserting a record in a table that contains a 0 is inserted in the table as NULL.
PLEASE HELP ME HERE.
-----Mensagem original-----
De: Alejandro Daniel Toffetti [Email address protected]
Enviada: quinta-feira, 20 de Maio de 2004 13:47
Para: Pedro Miguel Gonçalves
Assunto: Re: PROBLEMS IN A TRIGGER
**A LazyDBA.com subscriber has responded to your lazydba.com post** **LazyDBA.com mail shield has forwarded you this email,
**and removed any attachments, and kept your email address secret **from this person, and any viruses/trojans.
**If you reply to this email, the person will see your email address as normal
**Anything below this line is the original email text
Two things that springs to mind:
Try fitting the whole text of the trigger into one single line and
submit again. It worked for me only this way sometimes (DB2 UDB 6.1
under Windows 2000)
Try replacing
REC.field_name = NULL
with something like
REC.field_name = NULLIF('0', '0')
Nullif returns NULL if both arguments are equal.
Hope this helps,
Daniel
Pedro Miguel Gonçalves wrote:
>Thanks but it's not it...
>
>Keeps getting me SQL = -199 even with REC.field_name = 0;
>
>Any suggestions?
>
>Pedro Gonçalves
>
>
>-----Mensagem original-----
>De: Wilson Allan [Email address protected]
>Enviada: quinta-feira, 20 de Maio de 2004 12:24
>Para: LazyDBA Discussion
>Assunto: RE: PROBLEMS IN A TRIGGER
>
>
>Do you need WHERE REC.field_name = 0;
>
>-----Original Message-----
>From: Pedro Miguel Gonçalves [Email address protected]
>Sent: Thursday, May 20, 2004 6:18 AM
>To: LazyDBA Discussion
>Subject: PROBLEMS IN A TRIGGER
>
>Hi guys,
>
>I'm working with DB2 v.7 for OS/390.
>
>What's the problem with this trigger I want to create?
>
>CREATE TRIGGER trigger_name
> NO CASCADE BEFORE INSERT ON table_name
> REFERENCING NEW AS REC
> FOR EACH ROW MODE DB2SQL
> UPDATE table_name
> SET REC.field_name = NULL
> WHERE field_name = 0;
>
>Keeps telling that I should switch some keyword or end-of-statment for
>some tokken that DB2 doesn´t give me.
>
>
>HELP.
>
>
>Pedro Gonçalves. [Email address protected]
>
>
>---------------------------------------------------------------------
>PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
>website: http://www.LazyDBA.com
>To unsubscribe, e-mail: [Email address protected]
>For additional commands, e-mail: [Email address protected]
>
>
>
>---------------------------------------------------------------------
>PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
>website: http://www.LazyDBA.com
>To unsubscribe, e-mail: [Email address protected]
>For additional commands, e-mail: [Email address protected]
>
>
>
>---------------------------------------------------------------------
>PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
>website: http://www.LazyDBA.com
>To unsubscribe, e-mail: [Email address protected]
>For additional commands, e-mail: [Email address protected]
>
DB2 & UDB email list listserv db2-l LazyDBA home page