<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld"
	version="2.0">
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" />
<jsp:directive.page errorPage="/jsp/common/error.jsp" />
<og:head headType="result" />
<jsp:directive.include file="/jsp/custom/result_info.jsp" />

<og:columnCheck
	command   = "NEW"
/>

<og:query command="NEW" dbid="{@DBID}" debug="{@debug}" maxRowCount="{@maxRowCount}">
	<jsp:text>
		select A.OBJECT_NAME AS OBJ_NAME,B.LINE AS SEQNO,'' AS CLM ,
				'' AS CLS_NAME,'' AS USE_LENGTH,'' AS CLM_NAME,
				'' AS TABLE_NAME ,'' AS MAX_LENGTH,
				B.TEXT , '{@SYSTEM_ID}' AS SYSTEM_ID,'{@TBLSYU}' AS TBLSYU
		from USER_OBJECTS A inner join USER_SOURCE B
		on    A.OBJECT_NAME = B.NAME
		where A.OBJECT_TYPE = 'TYPE'
		and   B.TYPE        = 'TYPE'
		and   not A.OBJECT_NAME like '%ARRAY'
	</jsp:text>
		<og:where startKey="and">
			<og:and value = "A.OBJECT_NAME like '{@OBJ_NAME}%'" />
		</og:where>
	<jsp:text>
		order by A.OBJECT_NAME,B.LINE
	</jsp:text>
</og:query>

<og:tableFilter classId="DBARG"
		keys="TEXT,SEQNO,CLM,CLS_NAME,USE_LENGTH,CLM_NAME,MAX_LENGTH"
		vals="TEXT,SEQNO,CLM,CLS_NAME,USE_LENGTH,CLM_NAME,MAX_LENGTH" />

<og:query command="NEW" dbid="{@DBID}" debug="{@debug}" maxRowCount="100000" scope="request">
	<jsp:text>
		select CLM,MAX(USE_LENGTH) AS MAX_LENGTH
		from (
			select COLUMN_NAME AS CLM,
				( CASE WHEN DATA_PRECISION IS NULL 
							THEN to_char(DATA_LENGTH)
							ELSE (	CASE WHEN DATA_SCALE = 0 
										THEN to_char(DATA_PRECISION)
										ELSE DATA_PRECISION || ',' || DATA_SCALE
								  	END )
						 END ) AS USE_LENGTH
			from USER_TAB_COLUMNS
			where INSTR(TABLE_NAME,'$') &lt; 1 
		)
		group by CLM
	</jsp:text>
</og:query>

<og:tableMerge
	action     = "UNION_CLM"
	slaveKeys  = "CLM"
	unionClms  = "MAX_LENGTH"
/>

<og:query command="NEW" dbid="{@DBID}" debug="{@debug}" maxRowCount="100000" scope="request">
	<jsp:text>
		select CLM,CLM_NAME
		from GF80
	</jsp:text>
	<og:where>
		<og:and value = "FGJ		in  ('0','1')"		/>
		<og:and value = "SYSTEM_ID	=  '{@SYSTEM_ID}'"	/>
		<og:and value = "TBLSYU	=  '3'"				/>
	</og:where>
</og:query>

<og:tableMerge
	action     = "UNION_CLM"
	slaveKeys  = "CLM"
	unionClms  = "CLM_NAME"
/>

<form onSubmit="return oneClick();" method="POST" action="forward.jsp" target="RESULT" >
<og:writeCheck>
	<og:submit  value="entry"   lbl="ENTRY" accesskey="E" />
	<og:submit  value="reset"   lbl="RESET" accesskey="R" />
	<og:input type="reset" name="command" lbl="MSG0011" td="false" />
<br />
</og:writeCheck>

<og:view
	viewFormType = "HTMLTable"
	command    = "NEW"
	noWritable = "SYSTEM_ID,TBLSYU,"
	checked    = "true"
	startNo    = "{@startNo}"
	pageSize   = "10000" />

<og:hidden name="SQL" >
  <jsp:text>
	INSERT INTO GF81
		(SYSTEM_ID,TBLSYU,OBJ_NAME,SEQNO,CLM ,CLS_NAME,USE_LENGTH,
		 TABLE_NAME,MAX_LENGTH,CLM_NAME,
		 CDKH,FGJ,DYSET,DYUPD,USRSET,USRUPD,PGUPD)
	VALUES
		([SYSTEM_ID],[TBLSYU],[OBJ_NAME],[SEQNO],[CLM],[CLS_NAME],[USE_LENGTH],
		 [TABLE_NAME],[MAX_LENGTH],[CLM_NAME],
		 'A','1','{@USER.YMDH}','{@USER.YMDH}','{@USER.ID}','{@USER.ID}','{@GUI.KEY}')
  </jsp:text>
</og:hidden>

<og:hidden name="SQL2" >
	<jsp:text>
		DELETE FROM GF81
		WHERE SYSTEM_ID = [SYSTEM_ID]
		AND   TBLSYU    = [TBLSYU]
		AND   OBJ_NAME  = [OBJ_NAME]
	</jsp:text>
</og:hidden>
</form>

<jsp:directive.include file="/jsp/common/htmlend.jsp" />
</jsp:root>
