Subject | Re: [firebird-support] multiple rows in singleton select |
---|---|
Author | Martijn Tonies |
Post date | 2003-07-02T06:44:50Z |
Hi,
Assuming multiple rows in PRODUCTS, you're selecting multiple rows
in a singleton select (INTO :prodid). In short, don't do this - but change
it like this:
prodid = gen_id(mygenerator, 1);
insert into products (...) values (:prodid, ...)
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com
> I am getting following error when executing the SP from .NetAhum... (see below)
>
> "multiple rows in singleton select"
>
> But, the SP doesn't contain any select (from table) statement. Just
> few Insert and two statements like -Aha! What do you call the above then? :-)
>
> sp:
>
> DECLARE VARIABLE prodid INTEGER;
> DECLARE VARIABLE ProductID INTEGER;
> BEGIN
> INSERT INTO products ..
>
> SELECT GEN_ID("MY_GENERATOR" , 0) FROM products INTO :prodid;
Assuming multiple rows in PRODUCTS, you're selecting multiple rows
in a singleton select (INTO :prodid). In short, don't do this - but change
it like this:
prodid = gen_id(mygenerator, 1);
insert into products (...) values (:prodid, ...)
> IF (:prodid IS NOT NULL) THENWell, yes. You don't need to SELECT GEN_ID either in a procedure.
> BEGIN
> INSERT INTO A ..
> INSERT INTO B ..
> INSERT INTO C ..
> END
>
> SELECT GEN_ID("MY_GENERATOR" , 0) FROM products INTO :ProductID;
> SUSPEND;
> END
>
>
> Is this because of select gen_id(..)?
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com