Scenario:
I wish to define a constant for the DUP_VAL_ON_INDEX error code:
GCN_DUP_VAL_ON_INDEX CONSTANT NUMBER := -1;
However, I would like to set the value programmatically:
GCN_DUP_VAL_ON_INDEX CONSTANT NUMBER := DUP_VAL_ON_INDEX.ERRCODE;
Is there a way to do this w/out creating a custom function like this?:
CREATE OR REPLACE FUNCTION GET_DUP_VAL_ERR_CODE
RETURN INTEGER
IS
BEGIN
raise dup_val_on_index;
EXCEPTION
WHEN OTHERS THEN
RETURN SQLCODE;
END;
/
forallwill raise a single error for the entire data-set rather than a single record in that data-set. What happens if you want to do something else for only a single record? Is such a situation possible?save exceptionsclause )