Use CREATE LANGUAGE to load the language into the database

postgre娄据库创建下面函数时:报标题上的错误

解决办法,直接SQL查询面板运行: CREATE LANGUAGE 'plpgsql'

 

CREATE OR REPLACE FUNCTION get_department_path_id(integer)
  RETURNS character AS
  $BODY$DECLARE

    v_pid ALIAS FOR $1;
    v_id integer;
    v_result varchar(100);
 
BEGIN
    SELECT "NodeId" INTO v_id FROM tree WHERE "parendId"=v_pid;
        IF FOUND THEN
            v_result := get_department_path_id(v_pid) || '/' || v_id;
        ELSE
            RETURN 'ac';
        END IF;
    RETURN v_result;
END;
$BODY$

    LANGUAGE 'plpgsql' VOLATILE;

你可能感兴趣的:(sql)