- --
- -- instr functions that mimic Oracle's counterpart
- -- Syntax: instr(string1, string2, [n], [m]) where [] denotes optional parameters.
- --
- -- Searches string1 beginning at the nth character for the mth occurrence
- -- of string2. If n is negative, search backwards. If m is not passed,
- -- assume 1 (search starts at first character).
- --
- CREATE FUNCTION instr(varchar, varchar) RETURNS integer AS $$
- DECLARE
- pos integer;
- BEGIN
- pos:= instr($1, $2, 1);
- RETURN pos;
- END;
- $$ LANGUAGE plpgsql STRICT IMMUTABLE;
- CREATE FUNCTION instr(string varchar, string_to_search varchar, beg_index
PostgreSQL模仿Oracle的instr函数
最新推荐文章于 2022-12-28 14:35:09 发布