I have a requirement where I have to select name of DB link (there are many DB links) from a table into bind variable and then fetch data from a table which is available in all DB links however data is different depending on DB link used. I am not getting a solution to use bind variables value as DB link.
This is my code:
select statement for fetching DB link into bind variable
SELECT DB_LINK into :v_db_link from reagions_db_links;
Then I have to use it for fetching data from table
SELECT reagion_id, region_name from Table_details@:v_db_link
I have tried to concatenate like below however its not working
SELECT reagion_id, region_name from Table_details@||:v_db_link
Please suggest me a solution, since I could have many DB links depending upon region selected by USER I am putting it into bind variable and then want to use it for fetching data from a table.