DROP FUNCTION IF EXISTS FN_DEC_AES;

CREATE FUNCTION FN_DEC_AES
    (I_VALUE VARCHAR(200)
    ) RETURNS VARCHAR(200) DETERMINISTIC
/******************************************************************************
/*
/* Module       : AES128 복호화
/* Program Name : FN_DEC_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 CAST(AES_DECRYPT(UNHEX(I_VALUE),'dPtm24dnpqtjqltmdkaghsmsqlalf!@#') AS CHAR)
	INTO   O_RET_VALUE
	FROM   DUAL
	;

	RETURN O_RET_VALUE;

END;
