Hi,
I have a function(stored procedure) in the database. I need to pass the table name which is a variable. How do i do that?
Example :
I have 1st table : table name - cities
location | city
(text) | (text)
---------------------
1 bangalore
2 mangalore
Now from this table depending upon location 1 or 2, I need to select the particular city and each city is another table for me which contains different parameters like, population, num of educated ppl, and num of schools.
So, from this selected city, I need to select data from population column.
This needs to be done in stored procedures in pgsql and so, I would need a single query for this. If any one knows, please help me out.
I have a function(stored procedure) in the database. I need to pass the table name which is a variable. How do i do that?
Example :
I have 1st table : table name - cities
location | city
(text) | (text)
---------------------
1 bangalore
2 mangalore
Now from this table depending upon location 1 or 2, I need to select the particular city and each city is another table for me which contains different parameters like, population, num of educated ppl, and num of schools.
So, from this selected city, I need to select data from population column.
This needs to be done in stored procedures in pgsql and so, I would need a single query for this. If any one knows, please help me out.
Comment