Subject | Re: [firebird-support] how to set field to be updated via parameter [FB1.5]? |
---|---|
Author | Helen Borrie |
Post date | 2008-03-01T03:43:18Z |
At 11:16 AM 1/03/2008, you wrote:
./heLen
>Hi,It can't be done this way. Parameters must be (or resolve to) contants. You can't pass database objects in parameters.
>
>I have a table TDATA with fields S1,S2,S2... etc.
>and want to create a stored procedure that updates a given field, which
>name is provided as an input parameter.
>
>So basically I need a stored procedure that has 2 input params -
>FIELDNAME and FIELDVALUE, and makes something like
>
>update TDATA set :FIELDNAME = :FIELDVALUE where ... ;
>
>but it seems impossible to set the field name this way.
> Is it really not possible, or I'm missing something?Well, I guess that was what you were missing. But, from Fb 1.5 onward, you can construct a run-time statement (a string) and execute that statement using EXECUTE STATEMENT syntax. If you've never heard of it, look it up in the Fb 1.5 release notes, where you'll find examples. (Or look it up in The Book, if you have it.)
./heLen