Birgitta,
Is there a signifigant performance difference between implementing row
level security in a before trigger vs a check constraint?
Thanks,
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx
This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.
"BirgittaHauser"
<Hauser@sss-softw
are.de> To
Sent by: "'RPG programming on the AS400 /
rpg400-l-bounces@ iSeries'" <rpg400-l@xxxxxxxxxxxx>
midrange.com cc
Subject
10/28/2007 05:14 AW: DB2 Check Constraints -
AM Reference a control file
Please respond to
RPG programming
on the AS400 /
iSeries
<rpg400-l@midrang
e.com>
Hi,
1. you cannot use check constraints to check values in an other table.
A check constraint can only compare with hard coded values or with
values
stored
in a column in the same row in your table.
2. If you need to check values in an other table, you need to implement a
before trigger program.
This trigger program gets activated as soon as the event (insert or
update) occurs.
In your trigger program you check if the inserted value can be found in
your control table.
If the value cannot be found in the table you need to send an escape
message (or SIGNAL) the error
and handle it in the caller procedure.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
Im
Auftrag von RNewton@xxxxxxxxxxxx
Gesendet: Sunday, October 28, 2007 00:25
An: rpg400-l@xxxxxxxxxxxx
Betreff: DB2 Check Constraints - Reference a control file
I have been reading a lot today trying to figure out a way that I can setup
a check constraint for a 3a column in a table to reference a control file
that holds all the fields valid (allowed) values.
The control file has been around for years used by edit routines in RPG. It
has a key field that groups the records together. Then there is a values
field which holds the valid values. I would need to hit the file for a
certain group value in the key field then check if the value being inserted
into my table is found in the control file under that goup. The control
table has no "primary" keys. So setting up a foreign key constraint is
unsuccessful. Regardless, in a FKC there would be no way to specify the
group key value.
My goal is to be able to keep all of the valid values for validation in
this
control file to ensure that I do not disturb existing processes and to have
one point in which to update them. I have tried setting up a check
constraint that does a subselect but I quickly learned that is outside of
the scope of a check condition.
Has anyone else tried to do this same thing before with any success? Can
you
offer any insight on how I may accomplish this?
Thanks in advance,
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx
This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the
reader of this message is not the intended recipient, or the employee or
agent responsible to deliver it to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
communication is strictly prohibited.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or
change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.