This discussion is archived
1 Reply Latest reply: Sep 13, 2013 5:33 AM by Su.gi RSS

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

newbi_egy Explorer
Currently Being Moderated

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 Newbie
    Currently Being Moderated

    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.

Legend

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