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



Please try the following in your own shop:
Start IBM i Navigator for Windows.
Expand your IBM i
Expand Databases
Select the database below it (almost always named the same as the IBM i
involved).
Off to the bottom right you will see Databases tasks.
Start "Run an SQL script"

For your first statement put the following:

create table yourlib.yourtable
(ActiveRecordCode char (1) not null,
constraint Cst_ActiveRecordCode_MustBeZ check (ActiveRecordCode='Z'));

Run that. After that is done run:

INSERT INTO yourlib.yourtable (ActiveRecordCode) VALUES('A');

You will get an error like this:
SQL State: 23513
Vendor Code: -545
Message: [SQL0545] INSERT, UPDATE, or MERGE not allowed by CHECK
constraint. Cause . . . . . : The value being inserted or updated does
not meet the criteria of CHECK constraint CST_ACTIVERECORDCODE_MUSTBEZ.
The operation is not allowed. Recovery . . . : Change the values being
inserted or updated so that the CHECK constraint is met. Otherwise, drop
the CHECK constraint CST_ACTIVERECORDCODE_MUSTBEZ.

Now, what possible use would be some mediator on this? This is not a
trigger. This is a constraint. How would your mediator even be activated
upon a check constraint? How would you possibly "grab the message and
forward it on up the stack."? And, if you could do so, what would then
appear the next time you run this insert using Run an SQL Script? Instead
of getting
SQL State: 23513
Vendor Code: -545
Message: [SQL0545] INSERT, UPDATE, or MERGE not allowed by CHECK
constraint. Cause . . . . . : The value being inserted or updated does
not meet the criteria of CHECK constraint CST_ACTIVERECORDCODE_MUSTBEZ.
The operation is not allowed. Recovery . . . : Change the values being
inserted or updated so that the CHECK constraint is met. Otherwise, drop
the CHECK constraint CST_ACTIVERECORDCODE_MUSTBEZ.

You would get, what? The following?
SQL State: ?????
Vendor Code: ???
Message: [CPF9898] ???



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.