Solved

what is the best solution for primary key

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

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

Suggested Solutions

Title # Comments Views Activity
MULTIPLE DATE QUERY 15 91
PL SQL Search Across Columns 4 52
Oracle dataguard 5 45
Need SQL Query to Find Foreign-keys Without Indexed Columns 4 25
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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.

861 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