× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Actually I meant have the physical have a new field, which in your
parlance would be a "derived column". So you already planned on adding a
new column. Just have one trigger on the PF which populates that derived
column.

create table rob.myddstable (
mypfkey char(5));

alter table rob.myddstable
add column myDerivedColumn dec(5, 0);

create trigger myddspftrigger
before insert or update of mypfkey on rob.myddstable
referencing new as new_row
for each row mode db2row
set new_row.myDerivedColumn = cast(new_row.mypfkey as dec(5, 0));

insert into rob.myddstable (mypfkey) values('12345');
select * from myddstable;
....+....1....+....2....
MYPFKEY MYDERIVEDCOLUMN
12345 12,345

update myddstable
set mypfkey='45678' where mypfkey='12345'

select * from myddstable
....+....1....+....2....
MYPFKEY MYDERIVEDCOLUMN
45678 45,678

insert into rob.myddstable (mypfkey) values('1A345')
SQL trigger MYDDSPFTRIGGER in ROB failed with SQLCODE -420 SQLSTATE 22018,
and the message is Character in CAST argument not valid
(note: insert did not happen)




Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.