-- MySQL stored procedure/* Set @ result = 0; Create procedure login (-- defines parameters, including in, out, And inout types in user varchar (10 ), in pass varchar (10), out result INT) Begin declare passd varchar (10); -- declare declares temporary variables and types, and then assigns values using set, the declare temporary variables can only be placed in the begin end region, and their scope is only in the begin end region. The set @ variable defines the global variable select password into passd from login where username = user; if passd like pass then -- If statement, end if should be followed, just like adding end case after case select 'login SUCCESS 'as massage; Set result = 1; elseselect 'login failed' as message; Set result = 0; end if; end; */-- call the Stored Procedure Call login ('root', 'root', @ result ); -- delete the Stored Procedure drop procedure logincreate procedure translate (id int) begincase idwhen 1 then select 'one' as Trans; when 2 thenselect 'two' as Trans; when 3 then select 'three 'as Trans; elseselect 'no trans' as Trans; end case; end;/* There are two use cases: 1. conditional variables select name, casewhen age> 10 then xxxxxelsexxxxend case2. conditional variables select name, Case agewhen> 10 then XXX else xxxxxsend case */