DROP FUNCTION IF EXISTS FN_ENC_AES;

CREATE FUNCTION FN_ENC_AES
    (I_VALUE VARCHAR(200)
    ) RETURNS VARCHAR(200) DETERMINISTIC
/******************************************************************************
/*
/* Module       : AES128 암호화
/* Program Name : FN_ENC_AES
/* Description  : 평문을 암호화해 반환한다.
/*
/*                Input  : I_VALUE => 평문
/*                OutPut : 암호화된 값
/*
/* Program History
/*
/*----------------------------------------------------------------------------
/*   Date        CSR NO.             Name      Description
/*----------------------------------------------------------------------------
/* 2021-06-28                       gagamel    Initial Release
/******************************************************************************/

BEGIN

	DECLARE O_RET_VALUE VARCHAR(200);
	
	SELECT HEX(AES_ENCRYPT(I_VALUE,'dPtm24dnpqtjqltmdkaghsmsqlalf!@#'))
	INTO   O_RET_VALUE
	FROM   DUAL
	;

	RETURN O_RET_VALUE;

END;