what is the best solution for primary key

Posted on 2014-09-21
Last Modified: 2014-09-23
i'm using oracle forms , when i have in my database tables having primary key , number , should have incremental value by 1 record by record
when i have in a form : header & tabular blocks  based on main & sub tables
think now i'm in the header block , while inserting new record , what is the best trigger to use to set new value for the record ID , then so on for the tabular block ?
Question by:NiceMan331
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 11

Expert Comment

by:Radek Baranowski
ID: 40336202
IDENTITY column is now available on Oracle 12c version, see this:

                   c2 VARCHAR2(10));

Open in new window


Author Comment

ID: 40336315
i'm working on oracle 10g database , 6i developer
LVL 35

Accepted Solution

Mark Geerlings earned 500 total points
ID: 40336412
Don't use a database trigger to provide the primary key value.  That can cause problems in Oracle Forms:  the users will get "record updated by another user" message if they ever try to change a record that was just inserted.  Use a pre-insert trigger in the header block to retrieve the next sequence value for the header record.  Use a pre-insert trigger in each child or detail block to retrieve the next sequence value for the primary key in each of those blocks.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question