× 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.



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.

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.