Reputation: 401
I tried to create a new table (tableB) with a foreign key constraint to another table (tableA) and just wondering if I can create along with this all constraints and indexes needed. My goal would be to have a single create table
statement with no need of an alter table…
statement afterwards and no other create index…
statement. Is this possible? Thanks for any hint in advance :)
create table tableA
(
id number
, constraint tableApk primary key (id)
);
create table tableB
(
id number
, constraint tableBfk foreign key (id) references tableA (id)
on delete cascade
using index (
create index tableBfkidx on tableB (id)
)
);
Upvotes: 6
Views: 7477
Reputation: 50047
That isn't allowed. Per the documentation a using_index_clause can only be specified for unique or primary constraints.
Best of luck.
Upvotes: 12