I want to check if valid phone number is inserting in table, so my trigger code is here:
select start_index
into mob_index
from gmarg_mobile_operators
where START_INDEX = substr(:new.contact_info,0,3);
if (REGEXP_LIKE (:NEW.CONTACT_INFO,'^(?:'|| mob_index ||')[-,:]{0,1}[0-9][0-9][-,:]{0,1}[0-9][0-9][-,:]{0,1}[0-9][0-9]')) then
found := 1;
end if;
I've checked my regex: "^(?:555)[-,:]{0,1}[0-9][0-9][-,:]{0,1}[0-9][0-9][-,:]{0,1}[0-9][0-9]" on several online tools and it is correct.
When I run my trigger, it compiles successfully, but during inserting a row following error is shown:
insert into GMARG_CONTACTS
(CLINET_ID,CONTACT_INFO,contact_type_id)
values
(0,'555194117','Mobile')
Error report -
SQL Error: ORA-12728: invalid range in regular expression
ORA-06512: at "HR.GMARG_TRIGGER_CONTACT", line 12
ORA-04088: error during execution of trigger 'HR.GMARG_TRIGGER_CONTACT'
12728. 00000 - "invalid range in regular expression"
*Cause: An invalid range was found in the regular expression.
*Action: Ensure a valid range is being used.
So, if my regex is correct, why does oracle shows error?
I tried to find answer, or redifine my regex, but no forward steps...
thank you in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…