On Apr 7, 2005, at 2:37 PM, James Black wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am using mysql 5.0.3, running under Solaris 8, and I believe the error
I am getting is not possible, but I don't know what I did wrong.


I do:
call assignItem('user', 1999, 97);//

I get:
ERROR 1172 (42000): Result consisted of more than one row

But, there is only one row possible, as the rid is unique.

I am wondering if there is something obvious I missed.

Thanx.

mysql> CREATE PROCEDURE assignItem (
    -> user CHAR(15),
    -> rid int,
    -> start int)
    -> BEGIN
    -> DECLARE itemtype CHAR(13);
    -> DECLARE curusecount INT DEFAULT 0;
    -> SELECT itemtype INTO itemtype FROM items WHERE rid=rid;

WHERE rid=rid? That is, WHERE 1999=1999? That would match all rows, would it not?


    -> END;//

SELECT itemtype FROM items WHERE rid=1999;//
+----------+
| itemtype |
+----------+
| PC |
+----------+

mysql> describe items;//
+----------+----------+------+-----+---------+----------------+
| Field    | Type     | Null | Key | Default | Extra |
+----------+----------+------+-----+---------+----------------+
| rid      | int(11)  | NO   | PRI | NULL    | auto_increment |
| lid      | int(11)  | NO   | MUL | 0       | |
| itemtype | char(4)  | NO   | MUL |         | |
| label    | char(12) | NO   | UNI |         | |
| status   | char(1)  | NO   |     |         | |
| layoutx  | int(11)  | YES  |     | NULL    | |
| layouty  | int(11)  | YES  |     | NULL    | |
| theta    | int(11)  | YES  |     | NULL    | |
+----------+----------+------+-----+---------+----------------+
- --
"Love is mutual self-giving that ends in self-recovery." Fulton Sheen
James Black    [EMAIL PROTECTED]

Michael


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to