MSCEWI3020

Negative values not supported for function.

Severity

Medium

Description

Snowflake does not support negative values for the function, then this will cause different behavior when executed.

Example Code

Input Code:

CREATE TABLE TABLE1
(
 COL0 NUMBER DEFAULT INSTR('CORPORATE FLOOR','OR', -3, 2),
 COL1 NUMBER DEFAULT INSTRB('CORPORATE FLOOR','OR', 3),
 COL2 NUMBER DEFAULT INSTRC('CORPORATE FLOOR','OR'),
 COL3 NUMBER DEFAULT INSTR2('CORPORATE FLOOR','OR', 3, 2),
 COL4 NUMBER DEFAULT INSTR4('CORPORATE FLOOR','OR', 3, 2)
);

Output Code:

Recommendations

  • Create a User Defined Function that can handle the negative parameter or look for another alternative.

  • If you need more support, you can email us at [email protected]

Last updated