I have a few questions concerning stored procedures:
1. If I create a stored procedure (like the one below), why does the returned values not change, though in the stored prcoedure the id has been generated?
2. Is there any better way to hand over multiple values and how can I unset global varaibles?
thx
Philip
delimiter | drop procedure if exists create_obj |
CREATE PROCEDURE `create_obj` ( out success int(2), out success_msg varchar(255), out obj_id int(10), inout obj_hostname varchar(255), inout obj_type varchar(25) ) LANGUAGE SQL not deterministic begin declare done int default 0; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; insert into idsdb.obj values (NULL,obj_hostname,obj_type); if ! done then select LAST_INSERT_ID() into obj_id; set success = 1; set success_msg = concat("added host with object id: ", obj_id); else set success = -1; set success_msg="Could not insert new object"; end if; end |
call create_obj(@a,@b,@id,'test1','ddd')| select @a,@b,@id |
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]