This is a discussion on Procedure error: 'chceckVote' in 'field list' within the MySQL Database forums, part of the Database Forums category; CREATE PROCEDURE addVoteAll (profil_Id int ( 11 ) , commmen_Id int ( 11 ) , grande_ smallint ( 1 )) NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER COMMENT '' ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
CREATE PROCEDURE addVoteAll (profil_Id int ( 11 ) , commmen_Id int
( 11 ) , grande_ smallint ( 1 )) NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER COMMENT '' BEGIN DECLARE checkVote smallint(2) DEFAULT 0; SET @checkVote = (select count(*) from vote where profilId=3 and commentId=3); IF chceckVote=0 then INSERT INTO vote (voteId,profilId,commentId,grande) VALUES (null,profil_Id,commmen_Id, grande_); END IF; commit; END; Unknown column 'chceckVote' in 'field list' whats wrong? |
|
|||
|
On 23 Apr 2007 01:29:03 -0700, lukasz_sabat@o2.pl wrote:
>CREATE PROCEDURE addVoteAll (profil_Id int ( 11 ) , commmen_Id int >( 11 ) , >grande_ smallint ( 1 )) > NOT DETERMINISTIC > CONTAINS SQL > SQL SECURITY DEFINER > COMMENT '' >BEGIN >DECLARE checkVote smallint(2) DEFAULT 0; > SET @checkVote = (select count(*) from vote > where profilId=3 and >commentId=3); >IF chceckVote=0 then >INSERT INTO vote (voteId,profilId,commentId,grande) VALUES >(null,profil_Id,commmen_Id, grande_); >END IF; >commit; >END; > >Unknown column 'chceckVote' in 'field list' > >whats wrong? Change the "where" in your SET statement to "having" |
|
|||
|
On 23 Apr 2007 01:29:03 -0700, lukasz_sabat@o2.pl wrote:
>DECLARE checkVote smallint(2) DEFAULT 0; >SET @checkVote = (select count(*) from vote > where profilId=3 and >commentId=3); >IF chceckVote=0 then ______^ One c too many... -- ( Kees ) c[_] Solution: A more subtle problem. (#15) |
![]() |
| Thread Tools | |
| Display Modes | |
|
|