-- メーカー名からメーカーコード取得 失敗時は0
CREATE OR REPLACE FUNCTION s_get_makercd(character varying) RETURNS integer AS
$BODY$
DECLARE
    i_makernm ALIAS FOR $1;   -- メーカー名

    makerc integer;
BEGIN

    SELECT makercd INTO makerc FROM t_maker WHERE s_get_nocase_text(makernm) LIKE s_get_nocase_text(i_makernm) AND delflg = FALSE;
    IF NOT FOUND THEN
        RETURN 0;
    ELSE
        RETURN makerc;
    END IF;
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;
