Phani
Phani

Reputation: 5427

Oracle CURSOR Fetch

I have a code like below:

CURSOR data_cur(username VARCHAR2)
IS
SELECT user_name as username,pass_word as password 
from User 
where user_name=username;

OPEN data_cur(username);
FETCH data_cur INTO data_rec;

IF data_cur%NOTFOUND
THEN
  vs_return := NULL;
END IF;

Now once the data is copied in to data_rec, is there any way that I get the value of something like data_rec.get(password);

And also my function declaration is getUserProperty(username, property).. Now let's say if I have lots of columns from the select query, then how could I return something data_rec.get(property) without hard coding like data_rec.password

Upvotes: 0

Views: 494

Answers (1)

Teja
Teja

Reputation: 13524

You can access the columns by using it as below.

data_rec.pass_word

Upvotes: 2

Related Questions