var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Dynamic SQL
We are trying to build a front end using forms where the user can select both the columns he wants to see and the where clause. The Result of the query build should be spooled to an excel.
In the cursor we select all the columns in the table never mind if the user has selected it or not. But while spooling, we need to select only the selected columns.
Sample code used:
TYPE cv_type IS REF CURSOR;
OPEN cv FOR
'SELECT * FROM TERRITORY_MASTER WHERE ROWNUM';
FETCH cv into temp;
EXIT WHEN cv%NOTFOUND;
Now how to bring only the selected columns into dbms output.
Note : I have the user selected columns separated by comma, in a variable
Re: Dynamic SQL
Presumably using logic something like:
If you wanted to make this more generic you would have to use DBMS_SQL, which allows you to interrogate the cursor at runtime to see the column definitions using DESCRIBE_COLUMNS.
IF <user selected COL1> THEN
v_record := v_record||','||temp.col1;