2014年2月12日 星期三

[SQL]multiple rows into a single column



參考:https://community.oracle.com/message/3788432
select deptno,
       rtrim (xmlagg (xmlelement (e, ename || ',')).extract ('//text()'), ',') enames
from emp
group by deptno

2013年11月18日 星期一

[JAVA]日期比對 CompareTo

Date date1 = sdf.parse("2009-12-31");
Date date2 = sdf.parse("2010-01-31");
 
System.out.println(sdf.format(date1));
System.out.println(sdf.format(date2));
 
if(date1.compareTo(date2)>0){
   System.out.println("Date1 is after Date2");
}else if(date1.compareTo(date2)<0){
   System.out.println("Date1 is before Date2");
}else if(date1.compareTo(date2)==0){
   System.out.println("Date1 is equal to Date2");
}else{
   System.out.println("How to get here?");
}


http://www.mkyong.com/java/how-to-compare-dates-in-java/

2013年7月31日 星期三

[JSTL]判斷該欄位是否為空值

在JSTL裡,判斷欄位是否為空值

用 empty

ex: empty each.remCuser             判斷rmeCuser為空的
      not empty each.remCuser     判斷rmeCuser不為空的

[JAVA]比對Collection的值是否一樣

可以用containsKey去檢查map的key是否一樣
如此就不用一個一個去比對


http://www.roseindia.net/tutorial/java/core/hashMap/containsKey.html

HashMapContainsKey.java
package net.roseindia.java;
import java.util.HashMap;
public class HashMapContainsKey {
public static void main(String[] arr) {
/* Create object of HashMap */
HashMap<Integer, String> obMap = new HashMap<Integer, String>();
/* Add value in HashMap */
obMap.put(new Integer(1), "Bharat");
obMap.put(new Integer(2), "Gyan");
obMap.put(new Integer(4), "Vrishti");
obMap.put(new Integer(3), "Sarika");
obMap.put(new Integer(5), "Rohit");
obMap.put(new Integer(6), "Parineeta");
/* Check key present in HashMap or not */
System.out.println("Returns :" + obMap.containsKey(1));
System.out.println("Returns :" + obMap.containsKey(8)); } }

2013年3月5日 星期二