Skip to Main Content

APEX

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!

Return Key Into Item Code

Alter BoyNov 1 2018 — edited Nov 1 2018

Hi,

The APEX built-in 'Return Key Into Item' function is great, but I'd like to use it manually. Is there a specific function it uses to do this?

To elaborate, I want to make a manual row processor from pl/sql code. I have a trigger that creates a primary key if my value is null, which is why I use the 'Return Key Into Item' function, however I would like to make this a manual thing in my own code. I would like to create a record, have that primary key generated, be able to capture the value of that primary key in a variable, and then continue my pl/sql code with the ability to refer to that primary key.

As a basic example:

Insert Into Employees (Name, Job) values ('Matthew', 'Astronaut'); -- This table also has Employee_PK, but left it out because my trigger will supply that value

-- Code to take the value of that Employee_PK and store it in variable primaryKeyValue

dbms_output.put_line(primaryKeyValue); -- I should get the value of the primary key in that newly created record

Any help is appreciated, thank you.

Matthew

This post has been answered by Mike Kutz on Nov 1 2018
Jump to Answer
Comments
Post Details
Added on Nov 1 2018
5 comments
1,671 views