[maxcd] select MAX(stoku_cd +1 ) from m_tokui; [load_grdList] select tok_cd, tok_nm, tok_kana, tok_tan, case when zip_no = '' then '' else left(zip_no,3)||'-'||right(zip_no,4) end as zip_no, addr1, addr2, addr3, addr4, tel_no, fax_no, mob_no, email, tori_cond, tori_kbn, shime_dd, pay_m, pay_d, biko1, biko2, biko3, biko4 --cast(date_part('year',age(current_date,birth))as char(3)), --adrres1, --adrres2, --adrres3, --case when birth = '' then '' --else substr(birth,1,4)||'/'||substr(birth,5,2)||'/'||substr(birth,7,2) --end as birth, --substr(birth,1,4)||'/'||substr(birth,5,2)||'/'||substr(birth,7,2) as birth, --to_char(to_date(birth,'yyyymmdd'),'yyyy/mm/dd') as birth, --tel_no, --biko from m_tokui where 1=1 and (tok_cd like '%:tok_cd%' or '' = ':tok_cd') and (tok_nm like '%:tok_nm%' or '' = ':tok_nm') and (tel_no like '%:tel_no%' or '' = ':tel_no') and (tori_cond like '%:tori_cond%' or '' = ':tori_cond') --and (('' = ':shain_nm') or (shain_nm like '%:shain_nm%')) --and (('' = ':post_no') or (post_no like ':shozokucd%')) --and (('' = ':old') or (cast(date_part('year',age(current_date,birth))as char(3)) = ':old')) --and (('' = ':birth') or (cast(birth as char(10)) = 'birth%')) --and (('' = ':gender') or (case sex when '1' then 'j' when '2' then '' end like ':gender%')) order by tok_cd; [existtok] select 1 from m_tokui where tok_cd = ':tok_cd'