Subject | Re: [firebird-support] How do you dynamically build a SQL Statement in a Stored Procedure? |
---|---|
Author | Helen Borrie |
Post date | 2006-05-01T22:41:45Z |
At 03:13 AM 2/05/2006, you wrote:
that's called within your procedure to parse out the individual
values successively in a loop.
parameter (although there has recently been Big Architectural Talk
about implementing something along these lines in Fb 2 +. If you
decide to write a SP, you would invoke the SP as
select blah, blah1, etc... from MySP(:list_as_a_varchar)
- meaning you still need to construct the list in your client code.
So - it is "doable". It's moot whether you would actually gain a
speed advantage but it might meet your expectations in terms of simplification.
./heLen
>I am trying to build a resultset from a list of ID Values. I wouldPass a string as a varchar of sufficient length and write a procedure
>like to do this in a stored procedure rather than in Delphi code
>because there are lots of queries to build the resultset, so it should
>be more efficient to do it in the database.
>
>1) How do I pass a stored procedure a list of ID values?
that's called within your procedure to parse out the individual
values successively in a loop.
>2) How cam I dynamically build a statement like Select X from TableIn DSQL you can't (yet) of course pass a list as a replaceable
>where ID value in ( Value list )?
parameter (although there has recently been Big Architectural Talk
about implementing something along these lines in Fb 2 +. If you
decide to write a SP, you would invoke the SP as
select blah, blah1, etc... from MySP(:list_as_a_varchar)
- meaning you still need to construct the list in your client code.
So - it is "doable". It's moot whether you would actually gain a
speed advantage but it might meet your expectations in terms of simplification.
./heLen