I am using oracle database
When inserting a row into a table, I need to find the maximum value of the column and increase it by 1 and use this value in the row that I am inserting.
INSERT INTO dts_route
(ROUTE_ID, ROUTE_UID, ROUTE_FOLDER)
VALUES (
(SELECT MAX(ROUTE_ID) + 1 FROM route) ,
ROUTE_UID,
ROUTE_FOLDER)
This works fine if they have at least one entry in the table. But returns null when they are not records in the table.
How can I get the default value of 1 if they are not in the table.
source
share