Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

if else in mysql stored procedure

-- PL/SQL
BEGIN
    IF my_val = 1 THEN [...]
    ELSE [...]
    END IF;
END;
-- In a query
SELECT CASE WHEN my_col = 1 THEN 'Ok' ELSE 'Ko' END AS my_result;
 
PREVIOUS NEXT
Tagged: #mysql #stored #procedure
ADD COMMENT
Topic
Name
4+4 =