Subject | Re: [firebird-support] MULTIPLE ROWS IN SINGLETON SELECT in SP |
---|---|
Author | Lucas Franzen |
Post date | 2004-01-21T10:50:23Z |
Tanz Anthrox schrieb:
plain SELECT when there are several records!)
Do you want to return all children???
Then change it to:
IF ( HAS_CHILDREN <> 0 ) THEN
BEGIN
FOR select child,childname from PR_BOMVIEW(:CHILD)
INTO :CHILD,:CHILDNAME
DO BEGIN
SUSPEND;
END
END
ELSE SUSPEND; /* if you want to return the records without childrten,
too */
AND:
Never use COUNT (*) for checking record existance.
Use EXISTS instead!
Luc.
> DOof course it does, if there is more than one child. (You can't do a
> BEGIN
> SELECT COUNT(*) FROM BOM b2 WHERE b2.PARENT=:CHILD INTO :HAS_CHILDREN;
> IF (HAS_CHILDREN<>0) THEN
> BEGIN
> select child,childname from PR_BOMVIEW(:CHILD) INTO :CHILD,:CHILDNAME; /* THIS LINE CAUSES MULTIPLE ROWS IN SINGLETON SELECT */
plain SELECT when there are several records!)
Do you want to return all children???
Then change it to:
IF ( HAS_CHILDREN <> 0 ) THEN
BEGIN
FOR select child,childname from PR_BOMVIEW(:CHILD)
INTO :CHILD,:CHILDNAME
DO BEGIN
SUSPEND;
END
END
ELSE SUSPEND; /* if you want to return the records without childrten,
too */
AND:
Never use COUNT (*) for checking record existance.
Use EXISTS instead!
Luc.