Monday, 17 September 2012

checking that the string does not contain any special character other then '_'




SELECT NVL(LENGTH(LTRIM(RTRIM(TRANSLATE('RAGHA **NDRA','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_','                                                               ')))), 0)
FROM DUAL;

other way:

op_type1 := replace(:blk_cgtm_op_type.op_type,' ','*');
   
    FOR i IN 1 .. length(op_type1)
    LOOP
        op_char := ASCII(SUBSTR(op_type1,i,1));
 
         
           IF OP_CHAR not BETWEEN 48 AND  57
           and OP_CHAR not BETWEEN 65 AND 90
           and OP_CHAR not BETWEEN 97 AND 122
           then
              l_found  := 1;
           end if;
    END LOOP;  
 
      IF L_FOUND = 1
      THEN
          alert_return := ovpkcs.fn_dispmsg('CG-MNT18',';', ';');  
   Raise FORM_TRIGGER_FAILURE;

     end if;
*********************************

No comments:

Post a Comment