I have the following table
I have inserted Product B to it and it gives me an ID of 15
Do you use Oracle? It does not have an automatic PK_generator, nothing to work for your INSERT
silently. However, it has SEQUENCEs, so let's use its NEXTVAL
:
INSERT INTO Orders_tab (Orderno, Custno)
VALUES (Order_seq.NEXTVAL, 1032);
The INSERT operation is exactly the case for them, the purpose of a SEQUENCE
, you just have to use it explicitly. More described: Managing Sequences # Using Sequences
The node for Sequences is on the level of Tables, i.e. in the SQLdeveloper. Ours are ID_GENERATOR
, in every DB.