[selectRecords] select --H sh.den_no,han.han_name ,to_date(sh.syori_ymd, 'YYYYMMDD') as syori_ymd , (case sh.nyuka_yotei_ymd when '' then null else to_date(sh.nyuka_yotei_ymd, 'YYYYMMDD') end) as nyuka_yotei_ymd --D , sm.hin_cd,hin.hin_nm,sm.tani,sm.hacyu_su --, (sm.tanka * &19) as tanka --, (sm.kingaku * &19) as kingaku , (sm.tanka) as tanka , (sm.kingaku) as kingaku , sh.sir_cd,sh.sir_nm --, (case &19 * sm.hacyu_su when 0 then 0 else sm.genka_gaku / sm.hacyu_su end) as gen_tanka --, (sm.kingaku - coalesce(sm.genka_gaku,0)) * &19 as arari -- , (case sm.hacyu_su when 0 then 0 else sm.genka_gaku / sm.hacyu_su end) as gen_tanka -- , (sm.kingaku - coalesce(sm.genka_gaku,0)) as arari , tan.tan_nm from t_sir_m sm inner join t_sir sh on (sm.den_no = sh.den_no) left join m_sir msir on (msir.sir_cd = sh.sir_cd) left join m_hanyo han on (sh.prc_sts = han.han_cd and mst_kbn = '01') left join m_tanto tan on (tan.tan_cd = sh.tan_cd) left join m_hin hin on (hin.hin_cd = sm.hin_cd) where 1 = 1 and sh.del_flg = 0 and hacyu_flg = 1 and (sh.syori_ymd >= '&2' or '' = '&2') and (sh.syori_ymd <= '&3' or '' = '&3') and (sh.sir_cd >= '&4' or '' = '&4') and (sh.sir_cd <= '&5' or '' = '&5') and (sh.tan_cd >= '&6' or '' = '&6') and (sh.tan_cd <= '&7' or '' = '&7') and (sm.hin_cd >= '&8' or '' = '&8') and (sm.hin_cd <= '&9' or '' = '&9') and (hin.cat_cd >= '&10' or '' = '&10') and (hin.cat_cd <= '&11' or '' = '&11') and (sh.den_no >= fnc_to_number('&12') or '' = '&12') and (sh.den_no <= fnc_to_number('&13') or '' = '&13') --and (sm.hin_nm like '%&14%' or '' = '&14') and ((fnc_translate_case(sm.hin_nm) LIKE '%'||fnc_translate_case('&14')||'%') or ('&14' = '')) order by sm.hin_cd,sh.syori_ymd,sh.den_no,sm.row_no ;