Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / October 2008

Tip: Looking for answers? Try searching our database.

DB21034E with triggers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gregor Kovač - 27 Oct 2008 13:37 GMT
Hi!

My trigger looks like this:

CREATE TRIGGER REVIZIJA.T_1_AU AFTER UPDATE ON TABLE1
REFERENCING OLD O
           NEW N
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC

DECLARE OLD_VALUE VARCHAR(120);
DECLARE NEW_VALUE VARCHAR(120);

SET OLD_VALUE = SUBSTR(O.VALUE, 1, 120);
SET NEW_VALUE = SUBSTR(N.VALUE, 1, 120);

INSERT INTO LOG.TABLE (ID, OLD, NEW) VALUES (NEXTVAL FOR TABLE_SEQ,
OLD_VALUE, NEW_VALUE);
END

It is true that VALUE column in table TABLE1is defined as
VARCHAR(30000). Is there any way to make this trigger compile?

Best regards,
   Kovi

Signature

____________________________

|http://kovica.blogspot.com|
-----------------------------~-~-~-~-~-~-~-~-~-~-
|  In A World Without Fences Who Needs Gates?    |
|              Experience Linux.        |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Serge Rielau - 28 Oct 2008 17:08 GMT
> Hi!
>
[quoted text clipped - 18 lines]
> It is true that VALUE column in table TABLE1is defined as
> VARCHAR(30000). Is there any way to make this trigger compile?
I think you may be stuck here. DB2 needs to be able to build a temp with
both the old and new value.

VARCHAR(32000) is a lot of text....

Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Gregor Kovač - 29 Oct 2008 07:26 GMT
Hi!

Yes, a lot of text. It is just that I'm building sort of an archiving
system and on update I'd need new and old values.
Can I solve this some other way?

Best regards,
   Kovi

Serge Rielau pravi:
>> Hi!
>>
[quoted text clipped - 22 lines]
>
> VARCHAR(32000) is a lot of text....

Signature

____________________________

|http://kovica.blogspot.com|
-----------------------------~-~-~-~-~-~-~-~-~-~-
|  In A World Without Fences Who Needs Gates?    |
|              Experience Linux.        |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Serge Rielau - 30 Oct 2008 02:32 GMT
> Hi!
>
> Yes, a lot of text. It is just that I'm building sort of an archiving
> system and on update I'd need new and old values.
> Can I solve this some other way?
Why do you need to store both before and after image?

Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Gregor Kovač - 30 Oct 2008 08:52 GMT
Unfortunately, yes.

Best regards,
   Kovi

Serge Rielau pravi:
>> Hi!
>>
>> Yes, a lot of text. It is just that I'm building sort of an archiving
>> system and on update I'd need new and old values.
>> Can I solve this some other way?
> Why do you need to store both before and after image?

Signature

____________________________

|http://kovica.blogspot.com|
-----------------------------~-~-~-~-~-~-~-~-~-~-
|  In A World Without Fences Who Needs Gates?    |
|              Experience Linux.        |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.