Raise Application Error
Contents |
to your PL/SQL program. With many programming languages, unless you disable error checking, a run-time error such as stack overflow or division by zero raise_application_error vs raise stops normal processing and returns control to the operating system. With PL/SQL,
Pragma Exception_init And Raise Application Error
a mechanism called exception handling lets you bulletproof your program so that it can continue operating in the oracle raise presence of errors. This chapter contains these topics: Overview of PL/SQL Runtime Error Handling Advantages of PL/SQL Exceptions Summary of Predefined PL/SQL Exceptions Defining Your Own PL/SQL Exceptions How PL/SQL raise application error in sql server Exceptions Are Raised How PL/SQL Exceptions Propagate Reraising a PL/SQL Exception Handling Raised PL/SQL Exceptions Overview of PL/SQL Compile-Time Warnings Overview of PL/SQL Runtime Error Handling In PL/SQL, an error condition is called an exception. Exceptions can be internally defined (by the runtime system) or user defined. Examples of internally defined exceptions include division by zero and out of
Raise_application_error(-20001
memory. Some common internal exceptions have predefined names, such as ZERO_DIVIDE and STORAGE_ERROR. The other internal exceptions can be given names. You can define exceptions of your own in the declarative part of any PL/SQL block, subprogram, or package. For example, you might define an exception named insufficient_funds to flag overdrawn bank accounts. Unlike internal exceptions, user-defined exceptions must be given names. When an error occurs, an exception is raised. That is, normal execution stops and control transfers to the exception-handling part of your PL/SQL block or subprogram. Internal exceptions are raised implicitly (automatically) by the run-time system. User-defined exceptions must be raised explicitly by RAISE statements, which can also raise predefined exceptions. To handle raised exceptions, you write separate routines called exception handlers. After an exception handler runs, the current block stops executing and the enclosing block resumes with the next statement. If there is no enclosing block, control returns to the host environment. For information on managing errors when using BULK COLLECT, see "Handling FORALL Exceptions with the %BULK_EXCEPTIONS Attribute". Example 10-1 calculates a price
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn raise_application_error error number range more about Stack Overflow the company Business Learn more about hiring developers or posting raise application error in oracle triggers ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community
Raise_application_error Sqlerrm
Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Oracle: what is the situation to use RAISE_APPLICATION_ERROR? up vote https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/errors.htm 13 down vote favorite 5 We can use RAISE to fire an exception. What particular situations do we need to use RAISE_APPLICATION_ERROR? Thanks. oracle share|improve this question asked Nov 19 '09 at 2:56 Ricky 8,3982762100 I found a useful link for similar question. toadworld.com/platforms/oracle/b/weblog/archive/2010/07/14/… –gmail user Feb 6 '14 at 16:30 add a comment| 4 Answers 4 active oldest votes up vote 23 down vote accepted http://stackoverflow.com/questions/1760596/oracle-what-is-the-situation-to-use-raise-application-error There are two uses for RAISE_APPLICATION_ERROR. The first is to replace generic Oracle exception messages with our own, more meaningful messages. The second is to create exception conditions of our own, when Oracle would not throw them. The following procedure illustrates both usages. It enforces a business rule that new employees cannot be hired in the future. It also overrides two Oracle exceptions. One is DUP_VAL_ON_INDEX, which is thrown by a unique key on EMP(ENAME). The other is a a user-defined exception thrown when the foreign key between EMP(MGR) and EMP(EMPNO) is violated (because a manager must be an existing employee). create or replace procedure new_emp ( p_name in emp.ename%type , p_sal in emp.sal%type , p_job in emp.job%type , p_dept in emp.deptno%type , p_mgr in emp.mgr%type , p_hired in emp.hiredate%type := sysdate ) is invalid_manager exception; PRAGMA EXCEPTION_INIT(invalid_manager, -2291); dummy varchar2(1); begin -- check hiredate is valid if trunc(p_hired) > trunc(sysdate) then raise_application_error (-20000 , 'NEW_EMP::hiredate cannot be in the future'); end if; insert into emp ( ename , sal , job , deptno , mgr , hiredate ) values ( p_name , p_sal , p_job , p_dept , p_mgr , trunc(p_hired) ); exception when dup_val_on_index then raise_application_error (-20001 , 'NEW_EMP::employee called '||
SQL Server PRODUCTSDiscussion & Resources Benchmark Factory Code Tester for Oracle SharePlex SQL Navigator SQL http://www.toadworld.com/platforms/oracle/w/wiki/3349.raise-application-error Optimizer Spotlight Stat Toad Intelligence Central Toad Data Modeler Toad Data Point Toad Extension for Eclipse Toad for Hadoop Toad for IBM DB2 Toad for Oracle Toad for MySQL Toad for SQL Server Toad for SAP Solutions Toad MAC Edition Home » Platforms » Oracle » raise application Oracle Wiki » RAISE_APPLICATION_ERROR RAISE_APPLICATION_ERROR Oracle Community Join Overview Forum Blog Wiki Members Contents Oracle Wiki Oracle - Wiki Agile Development / DevOps Amazon APEX Big Data SQL Data Replication Database Administration Database Tuning Docker Enterprise Content Management Systems (ECM) Enterprise Manager Exadata EXPLAIN PLAN Network raise application error Management NoSQL & Hadoop Oracle Applications Oracle Architecture Oracle Cloud Oracle Clusterware Oracle Development Oracle R Enterprise Oracle12c Peoplesoft PL/SQL Development Scripting Languages SQL Reference ANSI Reserved Words Built-in Packages DBMS_ADDM DBMS_ALERT DBMS_APPLICATION_INFO DBMS_APPLY_ADM DBMS_AQ DBMS_AQADM DBMS_AQELM DBMS_ASSERT DBMS_AUTO_TASK_ADMIN DBMS_CAPTURE_ADM DBMS_COMPARISON (OTOC197) DBMS_CUBE DBMS_CUBE_ADVISE DBMS_DB_VERSION DBMS_DDL DBMS_DEBUG DBMS_DEFER DBMS_DEFER_QUERY DBMS_DEFER_SYS DBMS_DESCRIBE DBMS_ERRLOG DBMS_EXPORT DBMS_FGA DBMS_FLASHBACK DBMS_IOT DBMS_JOB DBMS_LOB DBMS_LOCK DBMS_LOGMNR DBMS_LOGMNR_CDC_PUBLISH DBMS_LOGMNR_CDC_SUBSCRIBE DBMS_LOGMNR_D DBMS_LOGSTBY DBMS_METADATA DBMS_MVIEW DBMS_OBFUSCATION_TOOLKIT DBMS_OFFLINE_OG DBMS_OFFLINE_SNAPSHOT DBMS_OLAP DBMS_ORACLE_TRACE_AGENT DBMS_ORACLE_TRACE_USER DBMS_OUTLN DBMS_OUTPUT DBMS_PCLXUTIL DBMS_PIPE DBMS_PREPROCESSOR DBMS_PROFILER DBMS_RANDOM DBMS_RECTIFIER_DIFF DBMS_REDEFINITION DBMS_REFRESH DBMS_REPAIR DBMS_REPCAT DBMS_REPCAT_ADMIN DBMS_REPCAT_AUTH DBMS_REPCAT_INSTANTIATE DBMS_REPCAT_RGT DBMS_REPUTIL DBMS_RESOURCE_MANAGER DBMS_RESOURCE_MANAGER_PRIVS DBMS_RESULT_CACHE DBMS_RESUMABLE DBMS_RLS DBMS_ROWID DBMS_RULE DBMS_RULE_ADM DBMS_SESSION DBMS_SHARED_POOL DBMS_SNAPSHOT DBMS_SPACE DBMS_SPACE_ADMIN DBMS_SPM DBMS_SQL DBMS_STANDARD Overview (PLS551) Programs (OTOC323) DBMS_STANDARD.COMMIT and COMMIT_CM (PLS556) DBMS_STANDARD.ROLLBACK_NR and _SV (PLS558) DBMS_STANDARD.SAVEPOINT DBMS_STANDARD.SET_TRANSACTION_USE INSERTING/UPDATING/DELETING (PLS553) RAISE_APPLICATION_ERROR DBMS_STATS DBMS_STORAGE_MAP DBMS_STREAMS DBMS_STREAMS_ADM DBMS_STREAMS_ADVISOR_ADM DBMS_SYSTEM DBMS_TRACE DBMS_TRANSACTION DBMS_TRANSFORM DBMS_TTS DBMS_UTILITY DBMS_WORKLOAD_CAPTURE DBMS_WORKLOAD_REPLAY DBMS_WORKLOAD_REPOSITORY DBMS_XPLN UTL_