<jsp:directive.page pageEncoding="UTF-8" />
<og:query command="{@command}" debug="{@debug}" maxRowCount="0" stopZero="true">
	select	RENDERER,EDITOR,DBTYPE,'' as DTYPE,CLM,NAME_JA,
			TABLE_NAME,SEQNO,
			CLS_NAME,USE_LENGTH,
			FGCOM,BIKO,SYSTEM_ID,FGJ,UNIQ
	from GF05
	where SYSTEM_ID  = '{@SYSTEM_ID}'
	and   TBLSYU     = '{@TBLSYU}'
	<og:where startKey="and">
		<og:and value="TABLE_NAME like '{@TABLE_NAME}%'" />
		<og:and value="CLM        like '{@CLM}%'" />
	</og:where>
	and   FGCOM		<= '5'
	and   FGJ		= '1'
	and (
			(
				(
						RENDERER not in ( 'MENU','DBMENU','CHBOX' )
					or	EDITOR   not in ( 'MENU','DBMENU','CHBOX' )
					or	CLS_NAME  != 'VARCHAR2'
				)
		--		and   TO_NUMBER(REPLACE(NVL(USE_LENGTH,'0'),',','.'),999.9) < 3
		--		and   USE_LENGTH in ( '1' , '2' )
				and	(
						CLM like 'FG%'
					or  CLM like 'CD%'
					or  CLM like 'KB%'
				)
			)
		or
			(	INSTR( BIKO, ':' ) = 0
				and	(
						CLM like 'FG%'
					or  CLM like 'CD%'
					or  CLM like 'KB%'
				)
			)
		or
			(
				CLS_NAME  != 'NUMBER'
				and	(
						CLM like 'SU%'
					or  CLM like 'KN%'
					or  CLM like 'TK%'
					or  CLM like 'SEQ%'
				)
			)
		or
			(
				CLS_NAME  != 'VARCHAR2'
				and	(
						CLM like 'NM%'
		--			or  CLM like 'KJ%'
		--			or  CLM like 'FG%'
		--			or  CLM like 'KB%'
		--			or  CLM like 'CD%'
		--			or  CLM like 'DY%'
				)
			)
		or
			(
				CLM like 'DY%'
				and	(
						RENDERER not in ( 'YMD','YMDH','MD','YM','DATE' )
					or	EDITOR   not in ( 'YMD','YMDH','MD','YM','DATE' )
					or	DBTYPE   not in ( 'YMD','YMDH','MD','YM','DATE' )
				)
			)
		or
			( regexp_instr( NAME_JA , '[０-９Ａ-Ｚａ-ｚァ-ヶ]' ) > 0 )
		)
	order by SYSTEM_ID,CLM,TABLE_NAME
</og:query>

<!-- UNIQ のみでユニークになるが、安全のため、SYSTEM_IDとTBLSYUだけは条件に加えておく -->
<og:hidden name="SQL" >
	UPDATE GF05 SET
			CLM 			= [CLM],
			NAME_JA 		= [NAME_JA],
			CLS_NAME		= [CLS_NAME],
			USE_LENGTH		= [USE_LENGTH],
			RENDERER		= [RENDERER],
			EDITOR			= [EDITOR],
			DBTYPE			= [DBTYPE],
			BIKO			= [BIKO],
			CDKH			= 'C',
			FGJ				= '1',
			DYUPD			= '{@USER.YMDH}',
			USRUPD			= '{@USER.ID}',
			PGUPD			= '{@GUI.KEY}'
	WHERE UNIQ		= [UNIQ]
	AND   SYSTEM_ID	= '{@SYSTEM_ID}'
	AND   TBLSYU	= '{@TBLSYU}'
</og:hidden>

<og:hidden name="noWritable">SYSTEM_ID,TABLE_NAME,SEQNO,DTYPE</og:hidden>
