Good Day Community,
I'm using Oracle 12c DB and APEX Application Express 5.1.4.00.08
I would like to Create a Check Constraint; where the Check would be the Return Date has to be <= to Sale_Date; with Logic that you can not have a Return Date that has a Date Greater Than the Sale_Date
Based off two Tables Below:
CREATE TABLE "BB_PROD_SALES"
( "IDPRODUCT" NUMBER(4,0) GENERATED ALWAYS as IDENTITY(START with 1 INCREMENT by 1),
"SALE_DATE" DATE NOT NULL,
"PRICE" NUMBER (6,2) NOT NULL,
"QTY" NUMBER(5,0) NOT NULL,
"TOTAL" NUMBER (6,2) GENERATED ALWAYS AS ("PRICE" * "QTY") VIRTUAL,
Constraint pk_IDPRODUCT_BB_PROD_SALES PRIMARY KEY (IDPRODUCT)
);
/
AND
CREATE TABLE BB_PROD_RET
(
"IDPRODUCT" NUMBER (4,0),
"SALE_DATE" DATE NOT NULL,
"PRICE" NUMBER (6,2) NOT NULL,
"QTY" NUMBER(5,0) NOT NULL,
"TOTAL" NUMBER (6,2) NOT NULL,
"RETURN_DATE" DATE NOT NULL,
Constraint fk_IDPRODUCT_BB_PROD_RET FOREIGN KEY (IDPRODUCT)
REFERENCES BB_PROD_SALES (IDPRODUCT)
);
/
Thanks in Advance,
DSteele41