From: Peter Brawley Date: May 2 2005 2:47pm Subject: Re: NEED HELP IN IF STATEMENT List-Archive: http://lists.mysql.com/mysql/183498 Message-Id: <42763D82.7010405@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=======AVGMAIL-42763D8324DD=======" --=======AVGMAIL-42763D8324DD======= Content-Type: multipart/alternative; boundary=------------020700060104090905020409 --------------020700060104090905020409 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Shawn, Madderla, >Don't you need to DECLARE the variable "mvalidate" before you can use it? It's declared as OUT mvalidate varchar(10). PB ----- SGreen@stripped wrote: >madderla sreedhar wrote on 05/02/2005 03:10:07 AM: > > > >>Can u please execute the following procedure in MySql >>and tell me where I had gone wrong because on my >>system the same code is giving error near line >>" := 'TRUE' " >> >>CREATE PROCEDURE cart_items_validate >>(IN mcustid INT ,IN mprodid varchar(10), >>OUT mvalidate varchar(10)) >> >>BEGIN >> >>DECLARE rowexists INT(6); >> >> >>select count(*) into rowexists from esr_cartitems_data >> >>where customer_id=mcustid and item_id=mprodid; >> >>if rowexists>0 THEN >> mvalidate := 'TRUE' >>else >> mvalidate := 'FALSE'; >>end if; >> >>END; >> >> >>Any help is welcome . >> >> >> >>Thanks, >> >>Sreedhar. >> >>__________________________________________________ >>Do You Yahoo!? >>Tired of spam? Yahoo! Mail has the best spam protection around >>http://mail.yahoo.com >> >> >> > >Don't you need to DECLARE the variable "mvalidate" before you can use it? >You already declare rowexists, try adding another declare. > > >Shawn Green >Database Administrator >Unimin Corporation - Spruce Pine > > > > > > > > >------------------------------------------------------------------------ > >No virus found in this incoming message. >Checked by AVG Anti-Virus. >Version: 7.0.308 / Virus Database: 266.11.1 - Release Date: 5/2/2005 > > --------------020700060104090905020409 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Shawn, Madderla,

>Don't you need to DECLARE the variable "mvalidate" before you can use it?

It's declared as OUT mvalidate varchar(10).

PB

-----

SGreen@stripped wrote:
madderla sreedhar <sreesind@stripped> wrote on 05/02/2005 03:10:07 AM:

  
Can u please execute the following procedure in MySql
and tell me where I had gone wrong because on my
system the same code is giving error near line 
"  := 'TRUE' "

CREATE  PROCEDURE cart_items_validate
(IN mcustid INT ,IN mprodid varchar(10),
OUT mvalidate  varchar(10))

BEGIN

DECLARE rowexists INT(6);


select count(*) into rowexists from esr_cartitems_data

where customer_id=mcustid and item_id=mprodid;

if rowexists>0 THEN
   mvalidate := 'TRUE'
else
   mvalidate := 'FALSE';
end if;

END;


Any help is welcome .



Thanks,

Sreedhar.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

    

Don't you need to DECLARE the variable "mvalidate" before you can use it? 
You already declare rowexists, try adding another declare.


Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine






  

No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.1 - Release Date: 5/2/2005
--------------020700060104090905020409-- --=======AVGMAIL-42763D8324DD======= Content-Type: text/plain; x-avg=cert; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: "AVG certification" No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.1 - Release Date: 5/2/2005 --=======AVGMAIL-42763D8324DD=======--