Wednesday, 8 July 2015

Regular Experssion

 declare 
 v1 varchar2(20) := 'abcdefg'; 
 begin 
 if regexp_like(v1, '.*b*') then null; end if; 
 v1 := regexp_replace(v1, '.*b*', 'a'); 
 dbms_output.put_line(v1); 
 end; 

declare
 lastname varchar2(50);
 begin
 if regexp_like(lastname, '\W') then null;
 end if;
end;

INSERT ALL
INTO t VALUES('XYZ123')
INTO t VALUES('XYZ 123')
INTO t VALUES('xyz 123')
INTO t VALUES('X1Y2Z3')
INTO t VALUES('123123')
INTO t VALUES('?/*.')
INTO t VALUES('\?.')
SELECT * FROM dual;

No comments:

Post a Comment