September 18, 2009
鼓勵此網誌:0
1. 查詢時使用 mapping 的值做 order,在處理各年級升冪排序的時候,
會發生五年級筆畫較少卻被排在四年級前面的問題。(感謝緯駿提供方法)
| SELECT * FROM textbook ORDER BY decode(tgrade, '一年級', '01', '二年級', '02', '三年級', '03', '四年級', '04', '五年級', '05', '六年級', '06', '七年級', '07', '八年級', '08', '九年級', '09'); |
2. JAVA date 轉 oracle date,使用 to_date function。
| import java.util.Date; import java.text.SimpleDateFormat; SimpleDateFormat bartDateFormat =new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date now=new Date(); 塞 date 的時候用 "to_date('"+insertDate+"', 'YYYY-MM-DD HH24:MI:SS')" |



