Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I have created an event with a handler of several lines.

I need to debug those lines, so I connect the DB with Sybase Central, and set a breakpoint in the event, and I connect to the DB with DBISQL and trigger the event from DBISQL.

I can see that the event is triggered but it never breaks on the set breakpoint!

Is this because events make different own connection?

How can I debug an event then?

Thanks in advance

asked 19 May '20, 16:27

Baron's gravatar image

accept rate: 48%

You can certainly debug an event with the builtin debugger (*), and there is no need to move the code from the handler into a procedure to do so (although there may be other reasons to do that). You can even debug running events. But as events run on their own connection, you have to make sure the debugger is set to debug all users or the one user (aka the event owner) running the event.

That being said, I personally do not debug events but use the MESSAGE ... TO LOG statement and logging tables to log whether an event does work as expected or fails somehow, and I generally use error handling code there because there's no GUI that would present you an error message...

(*): Update: In my tests, it does not work as expected with v17.0.10, see comments below...

Another update: I have once again checked within the same v16 database,

  • I can debug events when using SQL Central running on a local database server, and
  • I cannot debug events when using SQL Central running on a local database server. (However, I can debug stored procedures there.)
permanent link

answered 20 May '20, 03:11

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

edited 27 May '20, 07:27


I just created a new event to test the debugging but I can't get it to work.

CREATE EVENT "USR"."DebugThisEvent"
  declare l_variable integer=1;

  message 'Started: '|| current timestamp type info to console;

     if l_Variable = 10 then
        leave CurrentLoop
     end if;

     message l_Variable type info to console;

     set l_Variable = l_Variable+1;
  end loop

I've set debugging for all users and set a breakpoint on the first message statement. Then in I-SQL I execute trigger event DebugThisEvent it runs successfully but the debugger is not stopping at the breakpoint

(20 May '20, 03:27) Frank Vestjens
Replies hidden

Well, before answering, I had just tested to debug a running event on a production database, and that surely worked as expected.

(20 May '20, 03:30) Volker Barth

nice, but how can I "make sure the debugger is set to debug all users or the one user running the event"

(20 May '20, 03:31) Baron
Replies hidden

The debugger prompts for "Which User Would You Like To Debug?" everytime you enter debug mode.

(20 May '20, 03:40) Volker Barth

Yes, it asks, and I leave the default answer as '*', but it still doesnt catch the breakpoint.

(20 May '20, 04:02) Baron

What version do you use? - I checked with, and I can reproduce the problem, as I cannot debug an event there, as well. For my answer, I had used an older version (, namely), and as stated, this works fine.

(20 May '20, 04:30) Volker Barth

I use

(20 May '20, 04:44) Baron

I checked in and in and in both versions an event can not be debugged.

So something along the way must have been changed

(20 May '20, 07:24) Frank Vestjens
showing 2 of 8 show all flat view

Move the code from the event into a stored procedure and call this procedure from within the event. That should do the trick.

I also use message '' type info to console to send info to the console of the database. That way you can use the console to see what happens.

permanent link

answered 20 May '20, 02:18

Frank%20Vestjens's gravatar image

Frank Vestjens
accept rate: 21%

edited 20 May '20, 02:20

Thanks, I am already doing this, but wanted to debug the real event how it works, having that I also pass parameters while triggering the event.

And also wanted to know the reason, why I can't catch the breakpoints!

(20 May '20, 03:02) Baron
Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 19 May '20, 16:27

question was seen: 1,335 times

last updated: 27 May '20, 07:27