Compare two strings using stored procedure in Mysql
- Only need one (1) equals sign to evaluate
SET @tempo = 'test'
IF @tempo = 'test'
SELECT 'yes'
ELSE
SELECT 'no'
return yes of this output
DECLARE @tempo VARCHAR(20)
SET @tempo = 'test1'
IF @tempo = 'test'
SELECT 'yes'
ELSE
SELECT 'no'
return no in this output
you can also use interger as value
set below type code for integer
SET @temp = 1
IF @temp = 1
SELECT 'yes'
ELSE
SELECT 'no'
return yes
IF @temp = 2
SELECT 'yes'
ELSE
SELECT 'no'
return no
0 komentar:
Post a Comment