Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Using REGEXP_LIKE in IF condition is throwing error at 'END IF;'

I am trying to use REGEXP_LIKE function in IF.

IF REGEXP_LIKE('NUM','^\\d{11}$')
  THEN
    BEGIN
     <My code>
    END
END IF;

Error coming at END IF is:

Syntax error. Partially recognized rules.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Please advise where I am going wrong.

>Solution :

You are getting an error because you are missing a semicolon after END within your IF statement. Below is an example of valid code:

BEGIN
    IF REGEXP_LIKE ('NUM', '^\\d{11}$')
    THEN
        BEGIN
            --Some code here
            NULL;
        END;

        --More code here
        NULL;
    END IF;
END;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading