?
Solved

what is the best solution for primary key

Posted on 2014-09-21
4
Medium Priority
?
277 Views
Last Modified: 2014-09-23
hi
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 ?
0
Comment
Question by:NiceMan331
[X]
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
4 Comments
 
LVL 11

Expert Comment

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

CREATE TABLE t1 (c1 NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY, 
                   c2 VARCHAR2(10));

Open in new window

0
 

Author Comment

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

Accepted Solution

by:
Mark Geerlings earned 2000 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.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

770 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