Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Issue when querying a "select for update pl/sql" function

user8849805Jan 28 2018 — edited Jan 30 2018

Hi,

I've created a simple function in PL/SQL (called FUNC_COUNTER) which makes a SELECT FOR UPDATE to generate and maintain a counter (stored in an Oracle TABLE).

When I execute the PL/SQL function in a BEGIN END, my function returns my counter value.

Ex : It returns 1230, 1231, 1232...

But when I try to select my PL/SQL in a SELECT query, I'm obtaining a null value :

ex :

SELECT FUNC_COUNTER() FROM dual;

-> NULL

Then I've tried to create another PL/SQL that calls my first function and it works well.

This new function returns my counter valueq : ex : 1233, 1234...

I always could call my functions in a SELECT from DUAL query.

Why this time it is not possible please ?  (is there any lock issue ?)

Regards

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 27 2018
Added on Jan 28 2018
24 comments
1,065 views