The function sqlcode returns the number code associated with the most recently raised exception. sqlcode is meaningful only in an exception handler. Outside a handler, sqlcode always returns 0.