Results 1 to 3 of 3

Thread: IF Confusion

  1. #1
    Join Date
    Nov 2006
    Posts
    8

    Unanswered: IF Confusion

    I've written an IF such that...

    IF (SELECT SUM(a.balance + a.overdraft) AS "Funds Available"
    FROM Account a
    WHERE a.accountID = "12345") < 0
    THEN
    ROLLBACK
    ELSE
    COMMIT
    ENDIF;

    But this is wrong and I can't find any comprehensible details online. Can anyone explain how I'm supposed to structure this?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    is the manual any use?
    just a minor point.. you are using INNODB tables I presume

  3. #3
    Join Date
    Nov 2006
    Posts
    8
    Yeah, I'd looked at that.

    Solved it now. Basically, the code was correct but it has to be in a procedure or function for it to work which wasn't explicitly stated. I had assumed it could be in the general code.

Posting Permissions

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