Solved

what is the best solution for primary key

Posted on 2014-09-21
4
268 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
4 Comments
 
LVL 11

Expert Comment

by:Radek Baranowski
Comment Utility
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
Comment Utility
i'm working on oracle 10g database , 6i developer
0
 
LVL 34

Accepted Solution

by:
Mark Geerlings earned 500 total points
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now