프로시져 만드는데 자꾸 syntax error가 떨어집니다.
원인좀 알려주세요.
create function GET_ID ( v_gubun varchar )
returns varchar;
define v_final_id_seq integer;
define v_final_id varchar(20);
select substr(final_id,3,16)
into v_final_id_seq
from TB_ID
where ID_GUBUN = v_gubun;
IF v_final_id_seq is NULL THEN
let v_final_id = v_gubun || '0000000000000001';
INSERT INTO TB_ID VALUES(v_gubun,v_final_id);
return v_final_id;
END IF;
let v_final_id_seq = v_final_id_seq + 1;
let v_final_id = TO_CHAR(v_final_id_seq);
let v_final_id = v_gubun || LPAD(v_final_id,16,'0');
return v_final_id;
end function
|