title: PL SQL variable reference in a column
body: <p>I have a requirement where i have a table column containing an expression that should get appended as a where clause  to a select stmt in a procedure. </p>
  
  <p>The expression has reference to variables available in the procedure.</p>
  
  <pre><code>Declare 
  Query varchar2(4000);
  Expression varchar2(4000);
  Value varchar2(10):= 'abc';
  Valuex varchar2 := 'def';
   ... n number of variables declared
   Cursor c1 is select expression from tableabc where some condition;
  Begin
  Expression := output of c1 cursor
  Query := ‘select 1 from dual where 1 = 1 ';
   Query := query || expression;
  -- now i will use a ref cursor to evaluate query
  End;
  </code></pre>
  
  <p>Table abctable has a expression column thta stores :</p>
  
  <p>And 'abc'=value</p>
  
  <p>The value being referred in this expression is the one declaree in pl sql block.</p>
  
  <p>How can i achieve this as this is not working.
  I want the value in expression column to be replaced with the one available in pl sql block. I dont want to use replace function as expression column can refer valuex variable or any of the n variable declared in pl sql block. Can the expression be stored in the column in a way that once retrieved in pl sql block it gets replaced with the variable value. </p>
  
  <p>Thanks</p>