1
votes

I'm tring to validate whether the name length is met with the required value or not.

I made a code but it works in a bad way I'm trying to see the entered name whether is less then 3 or not and return a Boolean to print the message or not. in some cases the code prevent any entered date and the other is saving the data even if it's less then 3 .

my code is

if length(':P11_first_name') < 3 then
return true;
else
return false;
end if;

what I need to do to solve this problem.

1
Perhaps you should use: if length(:P11_first_name) < 3 then without 'Lukasz Szozda
"in some cases the code prevent any entered date" - when does it do that, as the condition can never be true? Maybe some other check is involved? I assume 'date' was a typo of 'data', but if it's really a date check then it's not related to what you've shown.Alex Poole
its data but I wrote it date.. sorryimohd23
If you need just simple check you can use validations: docs.oracle.com/database/121/HTMDB/bldr_validate.htm#HTMDB04018Dmitriy

1 Answers

5
votes

Don't put the item name in single quotes. You're checking whether the literal string ":P11_first_name" has a length less than 3. That string will always be exactly 14 characters. You want

if length( :p11_first_name ) < 3
then
  return true;
else
  return false;
end if;