July 21st, 2011, 09:47 AM
Oracle 11g - Dynamic field reference
I am working on an application that requires very dynamic access to data. Users will build queries through the interface and the queries will be stored in VARCHAR fields for later use.
The function that later uses the query has no way of knowing the field names or data types used in the selection query.
This isn't an issue in any program language that I have used before but in this case, we want to do this in a package within Oracle rather than an external application.
I have no idea how to reference a field by its location or position in the query.
We need to get the list of fields so we know what each field is named and we need to be able to get at its value dynamically as well. If possible, checking the data type would be helpful too but that is less important in this case.
If we were doing this in say PHP, we could simply reference the query row and use a command like...
foreach($myrow as $field=>$value)
and this would walk through each field in the row giving us the field name and its value.
We need to do this same type of thing in our package.
Has anyone ever done anything like this?
A simple code snippet would be greatly appreciated.
July 21st, 2011, 03:42 PM
No clues yet?
Is there something like an EVAL function?
Something where I might be able to say...
MyVar := EVAL("mycursor.myfield");
I could make this work for me if something like this exists. I know "EVAL" itself doesn't but is there something that does the same function?