PL/SQL (MOSC)

MOSC Banner

Package function returns the same sequence nextval - parallel query?

edited Mar 15, 2021 5:39PM in PL/SQL (MOSC) 1 commentAnswered

I want to share a very weird situation and looking for an explanation. My database is 12.2 EE. A merge-insert statement failed with unique constraint error (col_pk is unique key column)


Merge into table a ... insert (col_pk,..)... values (pkg_call.get_nextval, ..._);


I expected pkg_call.get_nextval to return "new" value for each row inserted but, it returned the same value for all the records inserted.


--- pkg_call ---


create or replace package pkg_call as

function get_nextval (iv_seq_type in varchar2)

  return number;

end;

/


create or replace package body pkg_call as

function get_nextval(iv_seq_type in varchar2)

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