Subject | adding check constraint |
---|---|
Author | James |
Post date | 2004-06-09T07:04:34Z |
Good day.
Iam not very familiar with using check constraint. Can somebody here
help me?
I have a table named payment.
CREATE TABLE PAYMENT (
ID D_ID NOT NULL,
CUSTOMER D_ID,
PAY_DATE D_TRANSACTION_DATE,
PAYMENT_TYPE CHAR(3) NOT NULL,
BANK D_ID,
BRANCH VARCHAR(15),
CHECK_NO VARCHAR(15),
CHECK_DATE D_TRANSACTION_DATE,
AMOUNT D_MONEY,
STATUS D_STATUS,
CREATE_BY D_CREATE_BY,
CREATE_ON D_CREATE_ON,
EDIT_BY D_EDIT_BY,
EDIT_ON D_EDIT_ON
);
How do I write a check constraint that will check that if payment_type
is equal to 'CHK' then bank, branch, check_no, check_date should not be
null?
Thanks.
regards,
james
Iam not very familiar with using check constraint. Can somebody here
help me?
I have a table named payment.
CREATE TABLE PAYMENT (
ID D_ID NOT NULL,
CUSTOMER D_ID,
PAY_DATE D_TRANSACTION_DATE,
PAYMENT_TYPE CHAR(3) NOT NULL,
BANK D_ID,
BRANCH VARCHAR(15),
CHECK_NO VARCHAR(15),
CHECK_DATE D_TRANSACTION_DATE,
AMOUNT D_MONEY,
STATUS D_STATUS,
CREATE_BY D_CREATE_BY,
CREATE_ON D_CREATE_ON,
EDIT_BY D_EDIT_BY,
EDIT_ON D_EDIT_ON
);
How do I write a check constraint that will check that if payment_type
is equal to 'CHK' then bank, branch, check_no, check_date should not be
null?
Thanks.
regards,
james