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 196 of 241    Print  
Is it possible to use commit or rollback in exception section.

  
Total Answers and Comments: 1 Last Update: August 29, 2007     Asked by: Chitendra ranjan 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: archie123
 

Yes you can use commit or rollback in exception block;

select * from test123;
A
----------
51

Declare
s varchar2(2);
Begin
update test123 set a = a+10;
select a into s from test123 where a=20;
exception
when others then
rollback;
dbms_output.put_line('test'|| s);
End;
SQL> /
test

PL/SQL procedure successfully completed.

SQL> select * from test123;

A
----------
51



Above answer was rated as good by the following members:
bhatnagar_neeraj
August 28, 2007 18:56:03   #1  
archie123        

RE: Is it possible to use commit or rollback in except...

Yes you can use commit or rollback in exception block;

select * from test123;
A
----------
51


Declare
s varchar2(2);
Begin
update test123 set a a+10;
select a into s from test123 where a 20;
exception
when others then
rollback;
dbms_output.put_line('test'|| s);

End;
SQL> /
test

PL/SQL procedure successfully completed.

SQL> select * from test123;

A
----------
51


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    

 Related Questions

 Declarative part, Executable part and Exception part. Datatypes PL/SQL 
Latest Answer : All has given the right answer and I am repeating the same.There are the three component of PL/SQL program block1) Declarative( Where you can decalre the variable which would be used as a part of exceution using DECLARE statement).2) Exceution( Part of ...

          Cursor C1 is          Select empno,          ename from 
Latest Answer : Commit in this context will not do anything except the commiting the changes into database, done using DML statements. However, if the cursor is created with FOR UPDATE  clause, it will raise runtime exception as commit, in that case, would also ...

Is it possible to use Transaction control Statements such a ROLLBACK or COMMIT in Database Trigger ? Why ?
 It  is  not  possible.  As  triggers are defined for each table, if you use COMMIT   of    ROLLBACK  in  a  trigger,  it  

          I.  done using Database triggers.          ii. done using Integarity Constraints. I & ii. Exception 
Latest Answer : create table a ( b number, c number check (c >100) );create or replace trigger t1 before insert on a begindbms_output.put_line('this is before insert trigger'); end;create or replace trigger t2after insert on a begindbms_output.put_line('this ...

 Exception  is  the  error  handling  part  of  PL/SQL  block. The types are Predefined and user defined. Some of Predefined exceptions are.      
Latest Answer : Hi all, Exception is nothing but Error. Exception can serve as an ALERT message also. (using RAISE_APPLICATION_ERROR)There are two types of exceptions: 1> Pre-defineddefine exception (2> User define exception. System define exception predefine ...

 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 ...

       PROCEDURE name (parameter list.....)     is     local variable declarations      BEGIN      
Latest Answer : [CREATE [OR REPLACE]] PROCEDURE procedure_name[(Optional Parameters)] {IS | AS} [PRAGMA AUTONOMOUS_TRANSACTION;] [local declarations] BEGIN executable statements [EXCEPTION exception handlers] END [name]; ...

       FUNCTION name (argument list .....) Return datatype is     local variable declarations     Begin          
Latest Answer : create or replace function function_name(formal parameters list with only IN mode) return datatypeislocal variable declarationsbegin executable statments; return value;end function_name; ...

Latest Answer : A warning or error condition is called an exception. An exception may raise in a pl/sql block due to designing faults, coding mistakes or hardware failure. If an exception raises in a block it terminates the process and control transfers to ...
Read Answers (7) | Asked by : Beena

What is the output of the following pl/sql block ?declare v_empno emp.empno%type;begin select empno into v_empno from emp where empno = 10;exception when others then dbms_output.put_line ( 'no data found'); when no_data_found then dbms_output.put_line ( 'ther is no data found ');end;
when others then *ERROR at line 6:ORA-06550: line 6, column 2:PLS-00370: OTHERS handler must be last among the exception handlers of a blockORA-06550: line 0, column 0:PL/SQL: Compilation unit analysis 
Read Answers (5) | Asked by : Kishorebabu


 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
 

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
 

What is Oracle Net Service

Oracle Net Services provides enterprise-wide connectivity solutions in distributed, heterogeneous computing environments. Oracle Net Services eases the complexities of network configuration and management, maximizes performance, and improves network diagnostic capabilities. Oracle Net, a component
 

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