Skip to main content

CHARINDEX vs POSITION(with 3 parameters)

  • October 18, 2017
  • 1 reply
  • 4 views

Slaagh
Forum|alt.badge.img+1
  • Participating Frequently

Hello,

I am on the process of converting an ugly SQL string that has lots of CHARINDEX. I understand that the equivalent to CHARINDEX is POSITION, but POSITION only takes 2 parameters. Is there a Vertica function that is similar to CHARINDEX in the sense that it can take 3 parameters? ( expressionToFind , expressionToSearch [ , start_location ] )

As always thank you all for your help

1 reply

marcothesane
Forum|alt.badge.img+1
  • Participating Frequently
  • October 18, 2017

You will probably mean:
SQL>SELECT
...> INSTR('Harry''s and Sally''s Bar','''',2,2)
...> AS pos_of_second_apo_from_pos_2
...>;
pos_of_second_apo_from_pos_2
18