Solved

what is the best solution for primary key

Posted on 2014-09-21
4
271 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
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 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.
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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Processing of multiple cursor 6 47
Oracle Public Synonyms and Privileges 2 65
sort a spool into file output in oracle 1 30
ORA-02288: invalid OPEN mode 2 31
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to recover a database from a user managed backup
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

777 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