1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Transactions

Discussion in 'SQL PL/SQL' started by monkey, Apr 18, 2014.

  1. monkey

    monkey Long Term Member

    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    230
    Hello!
    I am the beginner and have to write first translactin in sql in my life.
    Plese, can someone tell me, when I write it in oracle sql developer, does anything come after :
    EXCEPTION
    WHEN OTHERS THEN

    or is that all that has to be in the line?
    Does anyone know any easy example in oralce sql developer?
    MANY THANKS PEOPLE!!!:confused:
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,345
    Likes Received:
    347
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    You're writing PL/SQL; you should probably get the following text:


    http://shop.oreilly.com/product/0636920024859.do


    so you can learn how to write PL/SQL properly.


    EXCEPTION is a PL/SQL block where you, the programmer, handle exceptions in a hopefully graceful manner. They generate error messages the users see; I have some blog posts on how to generate error messages the users can possibly understand:


    http://dfitzjarrell.wordpress.com/2008/03/04/what-was-that-masked-message/
    http://dfitzjarrell.wordpress.com/2008/05/02/ive-never-seen-that-error-before/
    http://dfitzjarrell.wordpress.com/2012/06/26/nullified-remains/


    Possibly those will help you.
     
  3. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    626
    Likes Received:
    129
    Trophy Points:
    810
    Location:
    Russian Federation
    Hi.
    I wanted to add to the aforesaid :
    If you the beginning developer, then it is desirable for you as to use documentation.
    If you the beginning developer, then it is desirable for you used documentation, a concept.
    All basic information for acquisition of skills, fixing of skills you can подчерпнуть from documentation.

    For exampe on Oracle docs 11gr2:

    Transaction Processing and Control

    PL/SQL Error Handling


    it would be good that you paid attention to such books as:

    ps/sql programing (5 and 6 (for oracle 12c) edition )
    pl/sql programming in simple steps

    and etc
     
  4. ocprep

    ocprep Forum Advisor

    Messages:
    277
    Likes Received:
    76
    Trophy Points:
    410
    Location:
    Orlando, Florida
    The EXCEPTION section is used to trap exceptions. Basically this means something has gone wrong with the PL/SQL execution and an error has been raised. If an error occurs in a PL/SQL block and no EXCEPTION section exists, the execution of PL/SQL code stops -- all changes are rolled back, and the session that was executing the block will receive an error generated by Oracle.

    If a section exists, the developer can use code in this section to determine what behavior will occur. This may be to stop execution of the code and return an error to the user, or it may be to ignore the error if it is one that is expected (for example a query that returned no data), or it may be to perform an action to correct the problem.

    The section you provided is incomplete. Basically it is missing code to tell Oracle 'what to do' when an unknown exception occurs.