Oracle 12c New Feature – Identity Columns I investigated - TopicsExpress



          

Oracle 12c New Feature – Identity Columns I investigated a new Oracle 12c capability that allows the DEFAULT clause for a column to specify the NEXTVAL or CURRVAL pseudo-columns. This post discusses identity columns which can be specified in the CREATE TABLE and ALTER TABLE statements. This new feature allows you to specify that a column should be automatically populated from a system-created sequence. Creating Identity Columns First an example of a table without an identity clause: CREATE TABLE transaction1 ( transaction_id NUMBER, holding_id NUMBER, transaction_type NUMBER, transaction_date DATE, credit_value NUMBER, debit_value NUMBER ); This definition creates the following table SQL> DESC transaction1 Name Null? Type ----------------------------------------- -------- ------------------------ TRANSACTION_ID NUMBER HOLDING_ID NUMBER TRANSACTION_TYPE NUMBER TRANSACTION_DATE DATE CREDIT_VALUE NUMBER DEBIT_VALUE NUMBER In its simplest form the IDENTITY clause can be specified as follows: CREATE TABLE transaction2 ( transaction_id NUMBER GENERATED AS IDENTITY, holding_id NUMBER, transaction_type NUMBER, transaction_date DATE, credit_value NUMBER, debit_value NUMBER ); This definition creates the following table: SQL> DESC transaction2 Name Null? Type ----------------------------------------- -------- ------------------------ TRANSACTION_ID NOT NULL NUMBER HOLDING_ID NUMBER TRANSACTION_TYPE NUMBER TRANSACTION_DATE DATE CREDIT_VALUE NUMBER DEBIT_VALUE NUMBER Note that a NOT NULL constraint has been automatically created for the TRANSACTION_ID column
Posted on: Sun, 03 Nov 2013 07:21:31 +0000

Trending Topics



class="stbody" style="min-height:30px;">
Qualif CDM Zone Europe: Résultats ! GROUPE A: Rép.
Been in the far east for more than half my life and its time to
Micoplasmose em Aves: Picada de mosquito e batedeira 15/07/2012
los amo Almejack Guerra , Carla Antonia Muñoz Pedraza , Cristian
OK LADIES JOIN ME!! (From Lala Suerte Siete ) Ladies our Spa
On 9/3/14 we responded to a seriously injured hiker at the 6350
My new hat from tomorrows sunrise & new day will be a multitasking
I would like to thank each and every one of you that came out to

Recently Viewed Topics




© 2015