Last active
August 29, 2015 13:55
-
-
Save gtallen1187/8357499bc95c919547a3 to your computer and use it in GitHub Desktop.
create function charindex for postgres
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION CHARINDEX(text, text, integer) RETURNS integer AS $$ SELECT CASE WHEN strpos(substr($2, $3+1), $1) = 0 THEN 0 ELSE strpos(substr($2, $3+1), $1) + $3 END; $$ LANGUAGE SQL IMMUTABLE RETURNS NULL ON NULL INPUT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment