1 Reply Latest reply: Sep 13, 2013 7:33 AM by Su.gi RSS

    how to prevent a text item from accepting numbers and symbols ?

    salute-Salem

      hi all ,

      db and dev 10g rel2 ,

      i've a text item , and i want the user to only insert charachters into it , not numbers or symbols ?

       

      thanks

        • 1. Re: how to prevent a text item from accepting numbers and symbols ?
          Su.gi

          HI

          first create this procedure into in your form or in database

           

          CREATE or replace PROCEDURE proc_name

          (

             var_string  VARCHAR2

          )

          IS

             ll           NUMBER (5);

             asc_value   NUMBER (5);

             bool VARCHAR2(5);

           

           

          BEGIN

           

           

             ll := LENGTH (var_string);

             bool := 'FALSE';

           

           

             FOR i IN 1 .. ll

             LOOP

                asc_value := ASCII (SUBSTR (var_string, i, 1));

                IF not (( asc_value >= 65 AND asc_value <= 90) or (asc_value >= 97 AND asc_value <= 122)

            )

            THEN

              RAISE_APPLICATION_ERROR(-20045,'Only Character allowed');

                   EXIT;

                END IF;

              END LOOP;

          END;

           

          and then

          in when-validate-item of that field

          call the above procedure like

           

          if :field_name is not null then

          proc_name(:field_name);

          end if;

           

           

          Hope  this will help.