<jsp:directive.page pageEncoding="UTF-8" />
<og:query command="{@command}" debug="{@debug}" maxRowCount="0" stopZero="true" quotCheck="false" >
	select A.SYSTEM_ID,A.TABLE_NAME,A.NAME_JA,A.CLM,A.CLM_NAME,A.KBSAKU,A.SUBSYS,A.UNIQ,A.FGJ
	from GE82 A
	where A.SYSTEM_ID = '{@SYSTEM_ID}'
	and   A.TBLSYU    = '{@TBLSYU}'
	and ( A.SUBSYS != '**' or A.SUBSYS is null )
	and   A.FGJ       = '1'
	<og:where startKey="and">
		<og:and value="A.TABLE_NAME like '{@TABLE_NAME}'" />
		<og:and value="A.CLM        like '{@CLM}'" />
	</og:where>
	and   exists (
			select 1 from GE82 B
			where A.SYSTEM_ID in ( B.SYSTEM_ID , 'GE' , '**' )
			and   A.TBLSYU    = B.TBLSYU
			and   A.CLM       = B.CLM
			and   B.SUBSYS    = '**'
	)
	order by A.SYSTEM_ID,A.TABLE_NAME,A.SEQNO
</og:query>

<og:value key="lblKey" value="C" />

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