GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  PL/SQL
Go To First  |  Previous Question  |  Next Question 
 PL/SQL  |  Question 23 of 241    Print  
What is Pragma EXECPTION_INIT ? Explain the usage ?
 
The PRAGMA EXECPTION_INIT tells the complier to associate an exception with an oracle error. To get an error message of a specific oracle error.
 
     e.g. PRAGMA EXCEPTION_INIT (exception name, oracle error number)



  
Total Answers and Comments: 2 Last Update: January 31, 2008   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: kehri_anurag
 

Pragma exception_init  Allow you to handle the Oracle predefined message by you'r own message. means you can instruct compiler toassociatethe specific message to oracle predefined message at compile time.This way you Improve the Readbility of your program,and handle it accoding to your own way.

It should be declare at the DECLARE section.

example

declare

salary number;

FOUND_NOTHING exception;

Pragma exception_init(FOUND_NOTHING ,100);

begin

select sal in to salaryfrom emp where ename ='ANURAG';

dbms_output.put_line(salary);

exception

WHEN FOUND_NOTHING THEN

dbms_output.put_line(SQLERRM);

end;



Above answer was rated as good by the following members:
samareshp
January 13, 2006 02:07:29   #1  
kehri_anurag Member Since: January 2006   Contribution: 13    

RE: What is Pragma EXECPTION_INIT ? Explain...

Pragma exception_init Allow you to handle the Oracle predefined message by you'r own message. means you can instruct compiler toassociatethe specific message to oracle predefined message at compile time.This way you Improve the Readbility of your program and handle it accoding to your own way.

It should be declare at the DECLARE section.

example

declare

salary number;

FOUND_NOTHING exception;

Pragma exception_init(FOUND_NOTHING 100);

begin

select sal in to salaryfrom emp where ename 'ANURAG';

dbms_output.put_line(salary);

exception

WHEN FOUND_NOTHING THEN

dbms_output.put_line(SQLERRM);

end;


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
January 31, 2008 14:59:01   #2  
g_sidhu Member Since: August 2007   Contribution: 122    

RE: What is Pragma EXECPTION_INIT ? Explain the usage ?

PRAGMA EXCEPTION_INIT statement associate the declared exception with the standard Oracle server error number. PRAGMA EXCEPTION_INIT tells the compiler to associate an exception name with an Oracle error number. That allows you to refer to any internal exception by name and to write a specific handler for it.

PRAGMA (also called pseudoinstructions) is the keyword that signifies that the statement is a compiler directive which is not processed when the PL/SQL block is executed. Rather it directs the PL/SQL compiler to interpret all occurrences of the exception name within the block as the associated Oracle server error number.

Syntax

PRAGMA EXCEPTION_INIT(exception error_number);


 
Is this answer useful? Yes | No

 Related Questions

 There are two types of cursors, Implicit  Cursor and Explicit Cursor.PL/SQL uses Implicit Cursors for queries.User  defined cursors are called Explicit Cursors. They can be declared and 
Latest Answer : Cursors are of two types1. Implicit Cursors: -  Whenever we execute sql statements oracle server assigns a work area called private sql area to store precessed infomation. The most recently used work are can be accessed using SQL%. In implicit cursors ...

 WHERE  CURRENT OF clause in an UPDATE,DELETE statement refers to the latest row fetched from a cursor. Database Triggers 
Latest Answer : When referencing the current row from an explicit cursor, use the WHERE CURRENT OF clause. This allows you to apply updates and deletes to the row currently being addressed, without the need to explicitly reference the ROWID. You must include the FOR ...

 The PRAGMA EXECPTION_INIT tells the complier to associate an exception with an oracle error. To get an error message of a specific oracle error.      e.g. PRAGMA EXCEPTION_INIT 
Latest Answer : PRAGMA EXCEPTION_INIT statement associate the declared exception with the standard Oracle server error number. PRAGMA EXCEPTION_INIT tells the compiler to associate an exception name with an Oracle error number. That allows you to refer to any internal ...

 Function is called as part of an expression.   sal := calculate_sal ('a822');   procedure is called as a PL/SQL statement   calculate_bonus ('A822'); 
Latest Answer : Procedure can be called in the following waysa) CALL direcb) EXCECUTE from calling environmentc) from other procedures or functions or packagesFunctions can be called in the following ...

Latest Answer : Generally to process large number of records in pl/sql we use cursors . But cursors process records sequentially. It increases number of context switches between SQL and PL/SQL there by hampers performance. We may over come this problem using bulk binding.FOR ...
Read Answers (3) | Asked by : sandeep kelkar

Latest Answer : Using Bulk binding concepts, we can tune the PL/SQL job that takes long time due to millions of records. ...
Read Answers (5) | Asked by : Srinu

What is difference between varray and nested table.can u explain in brief and clear my these concepts.also give a small and sweet example of both these.
Read Answers (5) | Asked by : nayan

What is pragma? can any one give me the example of autonomous Transaction ?can we change the order of procedure parameter while calling procedure?
Read Answers (6) | Asked by : manali

Suppose, I've created a new database DB1 n i've created a table DB1.T1.Now, DESC T1 --> desplaying the table structure butselect * from DB1.T1 ---->giving--> table or view does not exist.. Can any one explain possible reason behind this.

Latest Answer : Rank Function can cause non-consecutive rankings if the tested values are the same. Whereas, the dense_rank function will always result in consecutive rankings. ...
Read Answers (2) | Asked by : ddkdhar


 Sponsored Links

 
Related Articles

Querying Data with Oracle XQuery

Querying Data with Oracle XQuery Starting with Oracle Database 10g Release 2 you can take advantage of a full featured native XQuery engine integrated with the database With Oracle XQuery you can accomplish various tasks involved in developing PHP Oracle XML applications operating on any kind of dat
 

Using Oracle XML DB Repository

Using Oracle XML DB Repository Another variation on accessing and manipulating XML content stored in Oracle database is provided by Oracle XML DB repository which is an essential component of Oracle XML DB mosgoogle NOTE Oracle XML DB repository also known as XML repository is a hierarchically organ
 

Using Oracle Database for Storing, Modifying, and Retrieving XML Data

Using Oracle Database for Storing Modifying and Retrieving XML Data With Oracle XML DB you have various XML storage and XML processing options allowing you to achieve the required level of performance and scalability One of the most interesting things about Oracle XML DB is that it allows you to per
 

XML Processing in PHP and Oracle Applications

Processing XML in PHP Oracle Applications As mentioned there are two alternatives when it comes to performing XML processing in your PHP Oracle application You can perform any required XML processing using either PHP s XML extensions or PEAR XML packages or Oracle s XML features mosgoogle In the fol
 

PHP Oracle Web Development

PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax The book is written by Yuli Vaseliev a well known author of different web development and programming books PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax is a good starting b
 

Getting Started with Oracle and ODP.NET

ODP NET Developer’ s Guide by Jagadish Chatarji Pulakhandam Sunitha Paruchuri A practical guide for developers working with the Oracle Data Provider for NET and the Oracle Developer Tools for Visual Studio 2005 Application development with ODP NET Dealing with XML DB using ODP NET Oracle
 

PHP Oracle Web Development Review

PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax The book is written by Yuli Vaseliev a well known author of different web development and programming books The author is also an expert in open source technologies and SOA Service Oriented Architecture But besides
 

Step by Step Oracle PL-SQL Tutorial

This introductory tutorial to PL SQL will help you to understand the basic concepts of PL SQL Please review the following tutorials and practice the sample SQL Statements on your local Oracle Database Please note that you must learn these basic things before we actually start getting in to Advanced
 

SOA Industry Usage

SOA Industry Usage First time usage of SOA tends to highlight the need for semantic interoperability While SOA provides framework for integration of cross Business operations with information flow in real time there is also a major semantic interoperability conflict that is not being addressed dir
 

Working with XML in Oracle

Working with XML in Oracle Introduction to XML Extensive markup language is the language which presents data in a human readable form of text The data can be anything from a purchase order or a stock quote or weather radar or a flight schedule it can be represented using XML XML is very similar to H
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape