Subject | Re: [firebird-support] Stored procedure to work with specified table/fields? |
---|---|
Author | Helen Borrie |
Post date | 2004-06-19T00:40:34Z |
At 11:17 PM 18/06/2004 +0000, you wrote:
working with.
execute the contents of the string. See the release notes AND ALSO the
caveats.
and implement a session ID using a generator. You can housekeep these
tables at idle times...
/heLen
>Hi All,Yup. SPs need to know at compile time what database objects they are
>
>I'd like to write a stored procedure that is generic and independent
>of hard coded table and field names. For instance:
>
>create procedure spTest(sTable VarChar(255), sField VarChar(255))
> returns (pResult Integer)
>as
>Begin
> select :sField from :sTable
> where this = that
> into :pResult;
>
> suspend;
>End
>
>This barfs with a parsing error.
working with.
>Is there anyway to do this?EXECUTE STATEMENT lets you build up a custom DSQL string at run-time and
execute the contents of the string. See the release notes AND ALSO the
caveats.
>IThis is *not* a recommended technique. Create "permanent" temporary tables
>need to write a series of stored procedures to work against
>temporary tables that are created and dropped on the fly so the
>table names won't be known until runtime.
and implement a session ID using a generator. You can housekeep these
tables at idle times...
/heLen