Search Results

Search found 1 results on 1 pages for 'xncroft'.

Page 1/1 | 1 

  • MySQL Stored Procedure: Boolean Logic in IF THEN

    - by xncroft
    I'm looking for the proper syntax (if this is possible in MySQL stored procedures) for using logical operators in an IF THEN statement. Here's something along the lines of what I would like to do, but I'm not certain if I should type "OR" or "||" in the IF ... THEN clause: DELIMITER $$ CREATE PROCEDURE `MyStoredProc` (_id INT) BEGIN DECLARE testVal1 INT DEFAULT 0; DECLARE testVal2 INT DEFAULT 0; SELECT value1, value2 INTO testVal1, testVal2 FROM ValueTable WHERE id = _id; IF testVal1 > 0 OR testVal2 > 0 THEN UPDATE ValueTable SET value1 = (value1+1) WHERE id=_id; END IF; END$$

    Read the article

1