It's late Friday afternoon and things are not working as I think it should or I could just be tired and can not think straight, so I would be happy for some help, thanks in advance ...

I want to know the expected behaviour for try/catch and EXCEPTION

I thought:

CREATE PROCEDURE DUMMIE
BEGIN TRY
    ---calls other functions which makes different inserts
END TRY
BEGIN CATCH
   -- If the inserts fails I end up here without any display of error       
   -- messages
   -- I can do rollback and call another procedure which does a      
   -- insert and do commit
END CATCH;

Is this wrong?

What I get: when the inserts fails I get an pop-up with an error message but I also end up in catch section, but the procedures are not called...

and I can also add that this procedure should be used in a scheduled job...scheduled event

EXCEPTION

If I only got (in my procedure)

EXCEPTION WHEN OTHERS THEN

shouldn't this catch all types of errors in the procedure without displaying any error messages? And I would then be able to do rollback and call other procedures, do commit??

This question is marked "community wiki".

asked 31 Jan '14, 10:23

M%20G's gravatar image

M G
629253044
accept rate: 42%

edited 31 Jan '14, 18:59

Volker%20Barth's gravatar image

Volker Barth
39.5k355539811

2

Please show us the actual code, and the actual error message (popup).

Note that not all SQL codes are treated as exceptions; e.g., row not found.

(31 Jan '14, 14:56) Breck Carter
1

In addition to Breck's advice: To cite from Ivan, there are differences between errors noted during the opening and the fetching of result sets - cf. this FAQ (I don't claim it does relate anyhow to your question, not n´knwoing the actual code):

How to Form an Exception Handler

(31 Jan '14, 19:04) Volker Barth

What is the reason for the failure of INSERT?

(04 Feb '14, 15:24) Elmi Eflov
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×258
×19
×7

question asked: 31 Jan '14, 10:23

question was seen: 1,759 times

last updated: 04 Feb '14, 15:24