I try to select max value from table
SELECT MAX(cid) FROM itemconfiguration;
However when table itemconfiguration
is empty th
Just use Coalesce or NVL to handle NULLs.
The following code will return 0 if MAX(cid)
is NULL
SELECT COALESCE(MAX(cid), 0)
FROM itemconfiguration
SELECT NVL(MAX(cid), 0) FROM itemconfiguration;
Can replace a number when max return null using ISNULL ,
ISNULL(MAX(cid),0) FROM itemconfiguration;