Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 Oracle PL/SQL: SEQUENCE: Autonumber into two tables Jump to:  
Category: >> Oracle PL/SQL >> SEQUENCE: Autonumber into two tables Bookmark and Share

<< 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');


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 254 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?