How Do I Generate a Primary Key Value?

If an entity object is updateable, chances are that new records will be inserted through it, and that being the case, it may well need to have a primary key value allocated to it. In Oracle Forms or PL/SQL, this is generally achieved using a database sequence to provide the unique key value, which can then be used in one of three ways:

image

FIGURE 6-3. The ADF Business Component Browser

image In the insert statement Including a reference to <sequence name>.NEXTVAL directly as the value of the key column

In a trigger ...

Get Oracle JDeveloper 10g for Forms & PL/SQL Developers: A Guide to Web Development with Oracle ADF now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.