Loop structure in select clause
I am writing a query where the number of columns is not fixed and dependent on the number of values provided by another table. Hence I am not able to write a static query that specifies the number of columns being selected. I need t开发者_C百科o apply something similar to a loop structure where the number of columns are created dynamically depending on the values provided. Is it possible to use loop structure in select clause ? In case this is not possible then I may have to use a procedure to build the query dynamically. Thanks in advance
Create your query dynamically and execute it using 'EXECUTE IMMEDIATE'. Refer http://download.oracle.com/docs/cd/B12037_01/appdev.101/b10807/13_elems017.htm for more details
精彩评论