By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,781 Members | 1,284 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,781 IT Pros & Developers. It's quick & easy.

Function parameter

P: n/a
X
Hi there,

I need to do something like this:

-- Function: public."ModifyOrder"(int4, text, int4)
CREATE FUNCTION public."ModifyOrder"(int4, text, int4) RETURNS void AS
'UPDATE orders SET $2 = $3 WHERE "OrderId" = $1;' LANGUAGE 'sql'
IMMUTABLE;
COMMENT ON FUNCTION public."ModifyOrder"(int4, text, int4) IS
'ModifyOrder(OrderId, FieldToUpdate, NewValue)';

where parameter $2 will be a text value that represent a column name.
Is there any way to do something like that?

I just want to be able to change values of several columns using this
function, writting something like this:

ModifyOrder(19283, "DestinationId", 5);

so that it will update the record with OrderId = 19283, and change
DestinationId to value 5.

Thanks.
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.