Oracle SQL Developer
Oracle SQL Developer
Oracle SQL Developer
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Handling PL/<strong>SQL</strong> ErrorsTo handle unexpected <strong>Oracle</strong> errors, you can use the OTHERS handler. Within thishandler, you can call the functions <strong>SQL</strong>CODE and <strong>SQL</strong>ERRM to return the <strong>Oracle</strong> errorcode and message text.PL/<strong>SQL</strong> declares predefined exceptions globally in package STANDARD. You need notdeclare them yourself. You can write handlers for predefined exceptions using thenames in Table 7–1.Table 7–1ExceptionACCESS_INTO_NULLCASE_NOT_FOUNDCOLLECTION_IS_NULLCURSOR_ALREADY_OPENDUP_VAL_ON_INDEXINVALID_CURSORINVALID_NUMBERLOGIN_DENIEDNO_DATA_FOUNDNOT_LOGGED_ONPROGRAM_ERRORROWTYPE_MISMATCHSELF_IS_NULLSTORAGE_ERRORSUBSCRIPT_BEYOND_COUNTSUBSCRIPT_OUTSIDE_LIMITSYS_INVALID_ROWIDTIMEOUT_ON_RESOURCEPredefined PL/<strong>SQL</strong> ExceptionsDescriptionA program attempts to assign values to the attributes of an uninitialized objectNone of the choices in the WHEN clauses of a CASE statement is selected, andthere is no ELSE clause.A program attempts to apply collection methods other than EXISTS to anuninitialized nested table or varray, or the program attempts to assign values tothe elements of an uninitialized nested table or varray.A program attempts to open an already open cursor. A cursor must be closedbefore it can be reopened. A cursor FOR loop automatically opens the cursor towhich it refers, so your program cannot open that cursor inside the loop.A program attempts to store duplicate values in a column that is constrained bya unique index.A program attempts a cursor operation that is not allowed, such as closing anunopened cursor.n a <strong>SQL</strong> statement, the conversion of a character string into a number failsbecause the string does not represent a valid number. (In procedural statements,VALUE_ERROR is raised.) This exception is also raised when the LIMIT-clauseexpression in a bulk FETCH statement does not evaluate to a positive number.A program attempts to log on to <strong>Oracle</strong> with an invalid username or password.A SELECT INTO statement returns no rows, or your program references adeleted element in a nested table or an uninitialized element in an index-bytable.Because this exception is used internally by some <strong>SQL</strong> functions to signalcompletion, you should not rely on this exception being propagated if you raiseit within a function that is called as part of a query.A program issues a database call without being connected to <strong>Oracle</strong>.PL/<strong>SQL</strong> has an internal problem.The host cursor variable and PL/<strong>SQL</strong> cursor variable involved in anassignment have incompatible return types. When an open host cursor variableis passed to a stored subprogram, the return types of the actual and formalparameters must be compatible.A program attempts to call a MEMBER method, but the instance of the objecttype has not been initialized. The built-in parameter SELF points to the object,and is always the first parameter passed to a MEMBER method.PL/<strong>SQL</strong> runs out of memory or memory has been corrupted.A program references a nested table or varray element using an index numberlarger than the number of elements in the collection.A program references a nested table or varray element using an index number(-1 for example) that is outside the legal range.The conversion of a character string into a universal rowid fails because thecharacter string does not represent a valid rowid.A time out occurs while <strong>Oracle</strong> is waiting for a resource.7-22 <strong>SQL</strong> <strong>Developer</strong> Online Help