I am on my 2nd week of using Oracle APEX 19 and I am nearly finished developing a novice level application that allows users to create/update/delete product families. I used an Interactive Grid but now I need to create a function somewhere (validation? process?) that calls on the support package I created in JDev. The function in the package checks the table to see if the family already exists. If it does, I need APEX to raise an error instantly upon entering NOT after saving.
The name of the Region is PF and the column in question is called product_family. APEX doesn't handle BIND VARIABLES (:pf) so I am aware that the syntax changes but I do not know how that would change the PL/SQL function below.
I created a Validation Type: PL/SQL Function Body (RETURN BOOLEAN)
BEGIN
IF product_families.product_family_exists(:pf.product_family) THEN
MSG_ALERT (
'Product family previously exists.'
,'E'
,TRUE
);
END IF;
END;
Does anyone know the correct syntax to raise an error instantly upon entering a product family in the grid, if it already exists? Please and thank you.
Simplify. In a standard validation you can test column values with the :COLUMN syntax, and perhaps use the error type that returns an error message, instead of boolean.
IF product_families.product_family_exists(:product_family) THEN
return 'Product family previously exists.';
END IF;
Where is Msg_alert from? IT seems very forms-like.