SQL Language (MOSC)

MOSC Banner

How to get INSERT ALL to work with Identity Column

edited Aug 1, 2018 4:54PM in SQL Language (MOSC) 3 commentsAnswered ✓

Hi,

While testing the identity and INSERT ALL, I have an interesting observation, say I have employee table and a employee phone table. There is a employee with 2 phone number, I would like to do the following:

create table employee (id number primary key, display_name varchar2(8));

create table employee_phone (id number generated always as  identity primary key, employee_id number,phonetype varchar2(8),phonenumber varchar2(8));

insert /* pojen */ all

into employee values (seq_po.nextval,'d'||seq_po.nextval)

into employee_phone (employee_id,phonetype,phonenumber) values (seq_po.nextval,'H','p'||seq_po.nextval)

into employee_phone (employee_id,phonetype,phonenumber) values (seq_po.nextval,'C','p'||seq_po.nextval)

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center