Case construct in stored procedure

Bart Pietercil bart.pietercil at gmail.com
Wed Sep 26 04:11:03 CDT 2007


Hi List,

could somebody explain to me how the case statement in this stored  
procedure could be acceptable to Valentina. It is now refused with:

Error: Kernel error: 0x71000. line 11:24: expecting ')', found '='


create or replace procedure spLogin(in vc_logon varchar,IN  
vc_password varchar,OUT userid long)
begin
	
	set userid = select recid from tbl_users where user_logonname =  
vc_logon AND user_password = vc_password;
	IF userid IS NOT null then
		SET @user_id = userid;
		update tbl_users SET last_login_dt = now() WHERE recid = @user_id;
	else
	set users_in_table = SELECT count(recid) FROM TBL_USERS;
	CASE TRUE
		when (users_in_table = 0) then
			raise 50002,'no users in table';
		when (users_in_table > 0) then
			raise 50001, 'invalid login';
	end case
	END if
exception
	call cm_CoreErrorHandler();
end

Do I have to use IF construct for this kind of logic ?

TIA

Bart Pietercil


More information about the Valentina mailing list