Results 1 to 4 of 4

Thread: Java and PL SQL

  1. #1
    garnachito is offline Member
    Join Date
    May 2012
    Posts
    18
    Rep Power
    0

    Default 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:

    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
    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.

    Knowing this basic example I'll be able to create complex ones, thanks in advance!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Java and PL SQL

    Not a Java question. Moving to Forum Lobby.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    garnachito is offline Member
    Join Date
    May 2012
    Posts
    18
    Rep Power
    0

    Default Re: Java and PL SQL

    My bad I'm sorry, won't happen again :)

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,791
    Rep Power
    19

    Default 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.

    ** This space for rent **

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •