Quick Search:
 
 Oracle PL/SQL: SEQUENCE: Autonumber into two tables Jump to:  
Category: >> Oracle PL/SQL >> SEQUENCE: Autonumber into two tables  

<< lastnext >>

Snippet Name: SEQUENCE: Autonumber into two tables

Description: Use a SEQUENCE autonumber and insert into two tables.

Also see:
» SEQUENCE: Demo code and Examples
» SEQUENCE: Find sequence MAX value
» SEQUENCE: Reset a sequence to a predef...
» SEQUENCE: get sequence value into vari...
» SEQUENCE: Create sequence demo

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 06th, 2009

INSERT INTO <table_name>
(<column_name>)
VALUES
(<sequence_name>.CURRVAL); 
 
CREATE SEQUENCE seq_id;
 
INSERT INTO table_one
(site_id, first_name, last_name)
VALUES
(seq_site_id.NEXTVAL, 'Mike', 'Rogers');
 
INSERT INTO table_two
(unit_id, site_id, unit_name)
VALUES
(seq_id.NEXTVAL, seq_site_id.CURRVAL, 'Programmer');


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org