MSCEWI3079

INSTR function converted to REGEXP_INSTR

Severity

Low

Description

When the Oracle source code uses the INSTR function with its fourth parameter, occurrence, it will be converted to the Snowflake function REGEXP_INSTR. Keep in mind that REGEXP_INSTR works with regular expressions so the substring to look for will be actually a regular so expression so it may be possible that some adjustments must be done to make it work properly.

Example Code

Input Code

SELECT INSTR('CORPORATE $ FLOOR','$', 3, 2) FROM DUAL;

Output Code

SELECT
REGEXP_INSTR('CORPORATE $ FLOOR','$', 3, 2) /*** MSC-WARNING - MSCEWI3079 - INSTR FUNCTION WAS CONVERTED TO REGEXP_INSTR. THE SECOND ARGUMENT MAY REQUIRE CHANGES ***/
FROM DUAL;

Modified output Code

SELECT
REGEXP_INSTR('CORPORATE $ FLOOR','\\$', 3, 2) /*** MSC-WARNING - MSCEWI3079 - INSTR FUNCTION WAS CONVERTED TO REGEXP_INSTR. THE SECOND ARGUMENT MAY REQUIRE CHANGES ***/
FROM DUAL;

Recommendations

Last updated