MySQL Forums
Forum List  »  Newbie

Creating a FUNCTION where table names can vary?
Posted by: AJ M
Date: March 25, 2006 11:23PM

Say in my function I have the following line:

update TABLENAME set roc = day40/6 where id=counter;

The thing is is that tablename can refer to many different tables, hence in the function call I want to be able to pass the value as a character

For example, if i go myfunction("A");

I want it to do update A set roc = day40/6 where id=counter;

If I call myfunction("B");

I want it to do update B set roc = day40/6 where id=counter;


Is there a way to create a function whereby I can pass it the name of my table as a paramter and have it substitute the name of the table in the select, insert, update, etc.... statements?

Options: ReplyQuote


Subject
Written By
Posted
Creating a FUNCTION where table names can vary?
March 25, 2006 11:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.