Generating a Oracle SQL Cursor from a user entered SQL Query

Feb 25 2015 3:18 AM
I'm Currently working on a small project where i have to generate a fully functional 
Oracle Curosr text (with params) based on a SQL query the user enters. I'm planing to do this as a C# program. 
currently having problems with generating the parameters for the Cursor.

Ex:

if the user enters something like:

SELECT a , b, c FROM TABLE t WHERE t.d = d_ AND t.e = e_

the generated cursor text should be like:

CURSOR get_data(d_ datatype , e_ datatype) IS
  SELECT a,b,c
  FROM TABLE t
  WHERE t.d = d_ 
  AND   t.e = e_ ;
it'll be great if someone can explain me what approach to take on this

Thanks in Advance.

Answers (1)