java - Custom Error from mysql to jdbc -
i want write stored procedure in mysql validates data before insertion table. use jdbc send custom message "zipcode not valid" java can displayed on screen. such thing possible?
at first want underline @duffymo absolutely right.
...but if still want write such procedure snippet might help:
delimiter ;; create procedure insert_checked_zip(zipdata int) begin if (zipdata > 0) insert mytable (zipcode) values (zipdata); elseif select 'zip invalid'; end if; end ;; delimiter ;
note: checks if passed zip bigger 0
please think of doing these checks on gui level - less expensive , faster (to list 2 advantages).
Comments
Post a Comment