java - Servlet catch unique constraint exception -
i'm trying insert info table named rmas
.
the table format is
|rcode|rname|vcode|vanme
here, set primary key rcode.
when i'm inserting record existing rcode, displays ora-0000-1 unique constraint violated..
if i'm using next code, displays message in case of other errors.
catch(exception e) { //out.println("rcode exists"); }
so, want grab primary key exception , display "rcode exist". possible? if yes, how?
thanks in advance
exception
parent of exception. if have catch(exception e) { }
block written exceptions fall category. need find exception compiler returning. if compiler returns exception sqlintegrityconstraintviolationexception
next block come
catch(sqlintegrityconstraintviolationexception e) { // error message integrity constraint violation } catch(nullpointerexception e) { // null pointer exception occured. } catch(exception e) { // other error messages }
in way can have number of exception blocks. create sure more specific exception types first written , parent exceptions
java oracle exception servlets unique-constraint
No comments:
Post a Comment