When creating a new record, I want to check if the entered value for a particular field (unique key) does not already exist. I mean, it should be unique.
How can I check this in Oracle Apex?
❇️ OrclQA.Com is a question and answer forum for programmers.
❇️ Here anyone can ask questions and anyone can answer to help others.
❇️ It hardly takes a minute to sign up and it is 100% FREE.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
OrclQA.Com is a question and answer forum for programmers.
Here anyone can ask questions and anyone can answer to help others.
It hardly takes a minute to sign up and it is 100% FREE.
Vinish Kapoor
Check for a field value uniqueness using validation in Oracle Apex. Follow these steps:
Do the right-click on your page item and select the Create Validation option.
Select its validation type as No Rows Returned.
Specify the following SQL query in the SQL query field:
In the Error Message field, specify the error message:
Employee code already exists.
For serverside condition, specify the CREATE button for the When button pressed drop-down.
Below is the screenshot of the above settings:
The above validation will execute only when the Create button is pressed. It will check if the employee code already exists, and if it exists, it will abort the page submission and give the error message.
goto150
Interactive Grid.
Solution that I used to find duplicates among newly entered records for the MGR field I wanted to keep unique.
Right click on the MGR column and select Create Validation.
I must guarantee my collection exists. To do that I am going to create Dynamic Action with PL/SQL code:
Dynamic Action is going to be fired by Event = Save [Interactive Grid] with Fire on Initialization = TRUE (I need it even before the first Save action, just after my page gets loaded).
Reference:
APEX Collection.
Vinish Kapoor
Your examples and illustrations are excellent. It would help if you wrote tutorials. You can use the write a post button. 👍