1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.vci.common.exception;
 
public class ORAUniqueProperties {    
    
    public static String getUniqueIndexName(Object obj) {
        String index = "";
        try {
            String str = obj.toString();
            if (str.indexOf("ORA-00001") < 0) {
                return "";
            }
            index = str.substring(str.indexOf("(") + 1, str.indexOf(")"));
            index = index.substring(index.indexOf(".") + 1);
        } catch (Exception e) {
            e.printStackTrace();
            index = "";
        }
        return index;
    }
}