PL/SQL (MOSC)

MOSC Banner

How to return not null column for a set of values in ref cursor

edited Jul 17, 2020 5:04AM in PL/SQL (MOSC) 1 commentAnswered

Hi All,

I am on Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

We have the following table structure -
Col1
Col2
Rate
Amount

Col1      Col2      Rate      Amount
A           B           10
C           D                           20
E           F           30

As can be seen in above example, either Rate or Amount will be populated for a combination of Col1 and Col2.

We will have the input parameters as Col1 and Col2.
I have to write a Ref Cursor to return the 3 values i.e. Col1, Col2, Rate/Amount (whichever is not null).

Is it possible to have a single query which fetches the respective value with the correct column name i.e

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