VSQL function failing on CASE
I am somewhat new to VSQL so bear with me. I am not sure why this function is failing. The issue is in the CASE statement, but I am not sure why. I set the variables and began my CASE. What am I missing?
As always, thank you all in advance for your time.
create function fn_MyFunction (AllHeaders varchar(4000)) return varchar(50)
\set subStr '"X-Forwarded-For:"'
\set strAllHeaders AllHeaders
\set p1 0
\set p2 0
when position(:subStr in :strAllHeaders ) > 0 then
\set p1 = position(:subStr IN cast(:strAllHeaders as varchar(4000)))+19
Syntax error at or near "case" at character 145