/****************************************************************************/
/* SYSTEM_ID : GF                                                           */
/* INDEX_BIKO ( FUNCTION )                                                  */
/* Created : 2017/06/02 17:22:01                                            */
/****************************************************************************/
CREATE     
function INDEX_BIKO(
	XSYSTEM_ID   in varchar2 ,
	XTBLSYU      in varchar2 ,
	XTABLE_NAME  in varchar2 ,
	XINDEX_NAME  in varchar2  )
return varchar2
is
    rtn     varchar2(2000);

	CURSOR codeC1 IS SELECT CLM
					FROM	GF07
					WHERE	SYSTEM_ID   = XSYSTEM_ID
					AND		TBLSYU      = XTBLSYU
					AND		TABLE_NAME  = XTABLE_NAME
					AND		INDEX_NAME  = XINDEX_NAME
					AND		FGJ			= '1'
					ORDER BY SEQNO;

	codeRec codeC1%ROWTYPE;

begin
	rtn := '' ;

	OPEN	codeC1;

	LOOP
		FETCH codeC1 INTO codeRec;
		EXIT WHEN codeC1%NOTFOUND;

		rtn := rtn || codeRec.CLM || ',' ;

	END LOOP;
	CLOSE codeC1;

	rtn := substr( rtn,1,lengthb(rtn)-1 );

	return rtn;

end INDEX_BIKO;
/
