title: Oracle dynamic database link from variables
body: <p>i have 3 oracle databases: db1, db2, db3.
  I have created database links from db1 to db2 and db3, called db002link and db003link.
  Now i have a procedure which takes as input a date and takes different actions on tables according to that input. One of them though requires to connect to one of the db2 or db3 databases. Before the execution of the procedure, i don't not know to which one, as it depends on the data gathered by the procedure itself in previous steps.
  So i need to concatenate some variables to create the db link and then connect through it.</p>
  
  <p>i have the variable v_dbnumber which is varchar(3) and looks like '003' for instance and is the result of a select from a table. I have tried the following:</p>
  
  <pre><code>v_dbconn := 'db'||v_dbnumber||'link'
  </code></pre>
  
  <p>But then the next step, <code>select * from s1.t1@v_dbconn</code> gets a compilation error for the procedure: ORA-04052, ORA-00604, ORA-02019 referring to the non existing connection. But the object is shown as:
  @v_dbconn instead of @db003link.</p>
  
  <p>Can somebody please help me with this?</p>