From the Oracle Forum

Hi all. I'm developing a simple database system that holds staff, customers and booking details for photography service. I've four tables - package, admin, customer and booking. Right now I'm in the process of creating application which has simple forms in it. The form I'm trying to work around is to add new staff to admin table. So my question: is it possible to return the staff ID (PK) in the form before a row is being inserted? I don't want users to input the ID as I've set the values etc. in the sequence. The default setting in the attributes hides the ID and that doesn't allow a row to be inserted because it says the ID is null.

Is it possible to return the PK in the form? I've found only one posts that's close enough to my problem. That, or I haven't been looking for the right stuff :(

DECLARE
get_pkx NUMBER;
BEGIN
SELECT PROJECT_SEQ.nextval into get_pkx from dual;
return get_pkx;
END;

This code is from the last post from the URL I provided. I run the code without being sure what 'get_*pkx' refers to and I got the same error as the OP. And is it right if I run the code in the normal SQL window?

Hope someone can point me in the right direction. Thanks.

Regards,
Atikah

You need to compile the above piece of code into a function and use the output as your PK and populate in the form. Later insert the same value into the table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.