Subject | Re: Building query strings in stored procedures? |
---|---|
Author | willogibbo |
Post date | 2005-05-20T14:26:17Z |
>layered IF NULL statements etc you should also look into the COALESCE
> If you need the speedup or (for another reason) intend to try with
and case statements in FB they will help a lot (but can likley not
get you all the way).
> This have some advantages in terms of speed and syntax and type safety.Tim
>
> Tim
Very helpful to have pointers to COALESCE and CASE statements - I'm
sure they will be useful.
I'm not sure if you're saying I should avoid the use of EXECUTE
STATEMENT or not. For the time being I am still trying to do various
speed benchmarking against the other two approaches (straight SQL
queries and layered IF NULL .. SPs).
Playing around with 'EXECUTE STATEMENT' further, i've run into another
problem, which is trying to specify more than one column to be
selected. i.e. in doing:
FOR EXECUTE STATEMENT
'SELECT (' || TEXTCOL || ') FROM ' || TABLE_NAME || QUERYSTRING
INTO :ASSETID, :UNITIDENT
DO
BEGIN
SUSPEND;
END
this works fine when TEXTCOL input is just one column name, but it
doesn't seem to work if it's something like "assetid, unitident". Is
the comma here causing some kind of problem? How else could I specify
multiple columns to be selected?
Thanks, Will