MySQL Forums
Forum List  »  Stored Procedures

Re: Passing values between stored procedures
Posted by: gustavo bellino
Date: October 05, 2005 01:56PM

how can i do to compare an IN parameter in a 'select where' sentences.

this is the code

CREATE PROCEDURE insertOpe (

--- CLIENTE TABLE

IN id_var INT,

---para la tabla OPERADOR

IN user_var char(10),
IN password_var INT(11),

OUT message VARCHAR(20))
BEGIN
---DECLARE count INT DEFAULT 0;
DECLARE V1 INT DEFAULT 0;
DECLARE exit handler for 1062 rollback;
set message := "Error";
start transaction;

select count(*)into v1 from operador op where
(op.dni=id_var); <----------------------------- HERE. It is rigth?
if (v1>0)then
set message := "op exist";
rollback;
else

insert Operador (user,password,dni)
select user_var,password_var,id_var;
commit;
set message := "OK";
end if;

END/

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Passing values between stored procedures
2497
October 05, 2005 01:56PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.