PL/SQL (MOSC)

MOSC Banner

Dynamic variables in PLSQL

edited Jun 28, 2014 5:00AM in PL/SQL (MOSC) 7 commentsAnswered

Hi

I have a dynamic SQL which returns multiple columns and the count of these columns may vary.

The query may return 2/3/4/5/..../20 columns depending upon the data present in the database.

Eg: The query may return select c1,c2 from dual or select  c1,c2,c3 from dual.

I'm trying to hold these values in individual variables as follows:

OPEN c1;
FETCH c1 INTO x1,x2,x3;

The problem statement is that I need to get the exact match of columns and variables to hold them.

Is there any thing like horizontal table type which holds data irrespective of the number of columns( something like ARRAYS in JAVA).

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center