This discussion is archived
1 Reply Latest reply: Jul 31, 2013 9:41 AM by InoL RSS

Oracle forms 10gr2, how to restrict data to before saving

Ade2 Newbie
Currently Being Moderated


Hi All, want to restrict user id to a range of 0-9 or A-Z before my form can be saved. In order word the userid can be K111222 of BBR222111 but no spaces or special characters in the userID. I want this to be a function that will return True of False as I will need this test outside the form too.

 

In pre_insert of the form, i want to call this function

 

   function checkID(userid) return    Boolean is

   BEGIN

   IF usreid not between 0-9 or A-Z -- please provide the logic to use here thanks.

   then Return false;

  else

return true;

END;

/

Thank you.

  • 1. Re: Oracle forms 10gr2, how to restrict data to before saving
    InoL Guru
    Currently Being Moderated

    You can use TRANSLATE for this:

     

    select rtrim(ltrim(translate('AD@123','0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',

                                          '                                    ')

               )) X

    from dual;

     

    X

    --

    @                      

     

    So, your IF would be:

     

    if rtrim ( ... etc. ) is not null then

       return FALSE;

    else

       retun TRUE;

    end if;

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points