With a create index
command.
Sample parent table:
SQL> create table parenttable
2 (id int primary key);
Table created.
Your child table (this code isn't changed in any way):
SQL> CREATE TABLE ChildTable (
2 id NUMBER GENERATED as IDENTITY,
3 cnt004_id int not null,
4 tariff_dist NUMBER not null,
5 foreign key (cnt004_id) references ParentTable(id)
6 );
Table created.
Create index:
SQL> create index i1_ct_cnt004 on childtable (cnt004_id);
Index created.
SQL>
Because, unlike primary key constraints - for which Oracle automatically creates unique index that supports it (if it doesn't exist):
SQL> select index_name, uniqueness, constraint_index
2 from user_indexes where table_name = 'PARENTTABLE';
INDEX_NAME UNIQUENES CON
------------------------------ --------- ---
SYS_C0010080 UNIQUE YES
SQL>
Oracle doesn't do the same for foreign key constraints, so - you have to do it yourself (if you want to have that column indexed).