[lockUpdate]
lock table M_CONTROL in EXCLUSIVE MODE

[getStockWp]
select
	 DTS_YM
	,CD_SUPPLIER
	,CD_SHIPMENT
	,CD_WP
	,CD_GRADE
	,WEIGHT_STOCK
	,UNIT_PRICE_STOCK
	,MONEY_STOCK
	,FLG_DELETE
FROM T_STOCK_WP
where FLG_DELETE = 0
and DTS_YM = '&1'
and CD_SUPPLIER = &2
and CD_SHIPMENT = &3
and CD_WP = &4
and CD_GRADE = &5

[getNowTax]
select
 CASE
	WHEN greatest(TAX_START_DAY , TO_DATE('&1', 'yyyymmdd')) = TO_DATE('&1', 'yyyymmdd') THEN NEW_TAX
	ELSE NOW_TAX
 END NOW_TAX
FROM M_CONTROL
where DT_START <= TO_DATE('&1', 'yyyymmdd')
and DT_END >= TO_DATE('&1', 'yyyymmdd')
and ID = &2

[getNewSlipNo]
select
 NO_SLIP
from LOCK_TABLE
where ID = &1
&2

[updateSlipNo]
update LOCK_TABLE set
NO_SLIP = &2
where ID = &1

[getLastDay]
select
 to_char(((date_trunc('month', (to_date('&1' || '&2' , 'yyyymm')) ::timestamp + interval '1 month')) ::date - 1), 'dd') LASTDAY

[getSysdatetime]
select
--#24316 2022.06.07 MOD STT
--		  TO_CHAR( SYSDATE, 'yyyymmddhh24miss' ) AS STR_VALUE
 TO_CHAR(now(), 'yyyymmddhh24miss') AS STR_VALUE
--#24316 2022.06.07 MOD END
from dual

