Results 1 to 4 of 4
Thread: Java and PL SQL
- 08-10-2012, 03:26 AM #1
Member
- Join Date
- May 2012
- Posts
- 15
- Rep Power
- 0
Java and PL SQL
Hi guys, I'm trying to figure out how can I catch an error validating data in MySQL
So basically my MySQL trigger says:
So I want to know if the string in my insert sentence is empty, how can I return a message with a simple System.out.print that indicates to the user that in order to proceed he needs to fill the field in his form.Java Code:Begin If new.string="" then // string carries the content of a JtextField // return an error string Else // insert into MySQL the data End
Knowing this basic example I'll be able to create complex ones, thanks in advance!
- 08-10-2012, 03:59 AM #2
Re: Java and PL SQL
Not a Java question. Moving to Forum Lobby.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 08-10-2012, 04:16 AM #3
Member
- Join Date
- May 2012
- Posts
- 15
- Rep Power
- 0
Re: Java and PL SQL
My bad I'm sorry, won't happen again :)
- 08-10-2012, 09:35 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Java and PL SQL
From stackoverflow.
You want the RuiDC one, using signal...presuming you are on 5.5+.
That should throw a sql error up to the calling SQL and on to Java.Please do not ask for code as refusal often offends.


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks