/****************************************************************************/
/* SYSTEM_ID : GF                                                           */
/* ERR_CODE ( FUNCTION )                                                    */
/* Created : 2017/06/02 17:06:55                                            */
/****************************************************************************/
CREATE     
function ERR_CODE(
	in_errcode       in varchar2  )
return varchar2
is
	indx     NUMBER ;
    errcode  NUMBER ;
begin
	indx := INSTR(in_errcode,'-');

	IF indx > 0 THEN errcode := TO_NUMBER(SUBSTR( in_errcode,indx ));
	ELSE errcode := -TO_NUMBER(in_errcode);
	END IF;

	return sqlerrm(errcode);

end ERR_CODE;
/
