Subject | Re: [firebird-support] null row |
---|---|
Author | unordained |
Post date | 2012-08-28T14:32:38Z |
---------- Original Message -----------
From: Mahesh Pratihari <mahesh.pratihari@...>
If EXECUTE STATEMENT returns no rows, it leaves the local variables that you're
selecting-into as they were before (probably NULL by default). You're not
checking ROW_COUNT (which may or may not make sense here?), and you're also
hoping that :QRYSTR returns at most a single row. What you see as one blank row
is probably no rows at all, but you have no way to detect it. I'd recommend
instead that you write this as
FOR EXECUTE STATEMENT ... INTO ... DO
BEGIN
-- only runs if the query returned results, and runs for each row returned if
more than one
END
-Philip
From: Mahesh Pratihari <mahesh.pratihari@...>
> Could you please let me know why I am getting one null row while------- End of Original Message -------
> executing the query.
>
> EXECUTE STATEMENT :QRYSTR
> INTO
> :UID,:NAME,:ATTRIBUTETYPE,:ISSINGLETON,:ISAUTOINHERIT,
> :ISINHERIT,:ISCHECK,:ISIBLINGSINGLETON,:ORGPATH
>
> While executing the query separately I am not getting the null row.
If EXECUTE STATEMENT returns no rows, it leaves the local variables that you're
selecting-into as they were before (probably NULL by default). You're not
checking ROW_COUNT (which may or may not make sense here?), and you're also
hoping that :QRYSTR returns at most a single row. What you see as one blank row
is probably no rows at all, but you have no way to detect it. I'd recommend
instead that you write this as
FOR EXECUTE STATEMENT ... INTO ... DO
BEGIN
-- only runs if the query returned results, and runs for each row returned if
more than one
END
-Philip