---------- Original Message ----------- From: Mahesh Pratihari <[email protected]> > Could you please let me know why I am getting one null row while > 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. ------- End of Original Message -------
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
