[UpdateDb]
select fnc_update_seikyusyo(&1, '{
  "title":"&7"
, "title_custom":"&9"
, "two_line_mode":"&5"
, "hext_flg":"&8"
, "no_kurikoshi":"&2"
, "no_grouping":"&4"
}')

[selectRecords]
select
  w.*
, w.title as tait
, w.uri_tn_dec as uritndec
from fnc_query_seikyusyo(&1, '{"sort_mode":"&6"}') w

[SelectRecords_Furi]
select
	han_name || ' ' || furikikan1 || ' ' || furikikan2 || ' ' || furikikan3 as furikikan
from(
	select 
		h09.mst_kbn,
		h09.han_cd,
		h09.han_name,
		h09.koumoku1 as furikikan1,
		h09.koumoku2 as furikikan2,
		h09.koumoku3 as furikikan3,
		h09.koumoku4,
		h09.koumoku5,
		coalesce(h09.koumoku6,''),
		h09.koumoku7,
		h09.koumoku8,
		h09.koumoku9,
		h09.koumoku10,
		h09.sort_key
	from m_hanyo h09
	left join m_tokui mt on (mt.tok_cd = '&2')
	left join m_hanyo h99a on (h99a.mst_kbn = '99' and h99a.han_cd = 'mtok-eig-f')
	where 1 = 1
	and h09.mst_kbn = '09'
	and coalesce(h09.koumoku6,'') = ''
	and ((coalesce(h99a.han_name,'') != '1') or (h09.koumoku12 = mt.eig_cd))
) w
order by han_cd

[SelectSyaban]
select 
  koumoku2 as image_cd
, koumoku3 as img_row
, koumoku4 as img_col
from m_hanyo
where 1 = 1
and mst_kbn = '99' 
and han_cd = 'syab-r0033'
and han_name = '1'

[SelectLogo]
select 
  koumoku2 as image_cd
, koumoku3 as img_row
, koumoku4 as img_col
from m_hanyo
where 1 = 1
and mst_kbn = '99' 
and han_cd = 'logo-r0033'
and han_name = '1'

[SelectImage]
select file_image
from m_image
where image_cd = '&1'

[SelectImageList]
select image_cd, file_image
from m_image
where image_cd like '&1%'
order by image_cd

[UpdateWork]
insert into w_basr0030 (
s_id, seikyu_ymd, tok_cd, del_flg, cre_id, cre_time, upd_id, upd_time
)
select
w1.s_id, w1.seikyu_ymd, w1.group_cd, 0, 'BASR0033', now(), 'BASR0033', now()
from (
select distinct w.s_id, w.seikyu_ymd, mt.group_cd
from w_basr0030 w
inner join m_tokui mt on (mt.tok_cd = w.tok_cd)
where w.s_id = &1
and mt.group_cd != ''
and not exists (select 1 from w_basr0030 w2 where w2.s_id = w.s_id and w2.seikyu_ymd = w.seikyu_ymd and w2.tok_cd = mt.group_cd)
) w1

[SelectMeisaiType]
select * from fnc_query_basr0037_meisai('{
  "disc_per_mode":"&1"
, "zei_multi_mode":"&2"
, "uri_tn_dec":"&3"
, "two_line_mode":"&4"
, "no_denkbn_mode":"&5"
}')




