Adds or removes a break point in the current debugger session.
DEBUG BREAK POINT <connection_name> STATEMENT <statement_name> AT offset [ID <break_name> | TRANSIENT | REMOVE ]
DEBUG BREAK POINT [<connection_name> [STATEMENT <statement_name>]] AT offset IN <ObjectType> [<ParentName>.]<ObjectName> [ID <break_name> | TRANSIENT | REMOVE]
connection_name ::= identifier
statement_name ::= identifier
offset ::= integer
break_name ::= identifier
ObjectType ::= TRIGGER | PROCEDURE | FUNCTION
ParentName ::= identifier
ObjectName ::= identifier
The DEBUG BREAK POINT statement adds or removes a break point in the current debugger session. A break point may be set in such way to affect only a script executing on a certain query handle (syntax 1), or it may be set in a database object, such as stored procedure, trigger or user defined function, so it affects any debuggee connection that executes the specified database object (syntax 2). When using the second syntax to set a break point in a database object, the connection name and statement name are optional. If no connection name is specified, the break point is in effect on all debuggee connections of the current debugger session. If no statement name is specified but the connection name is specified, the break point is in effect on all query handles on the specified debuggee connection.
The successful execution of this statement adds a row into the ::DEBUG_BREAKS table.
The offset is the absolute character location from the beginning of the SQL script. The beginning of the script includes the declaration section of the script although execution can never be suspended in the declaration section. The offset does not have to be at the exact starting location of a SQL statement. It can be any character in the statement where the execution should be suspended. As far as the debugger is concern, each statement in an SQL script contains all characters after the semi-colon of the previous statement up to and including the semi-colon of the current statement. Thus, 0 can always be used as the offset for a break point to suspend the execution before executing the first statement in the SQL script because there is no executable statement before the first statement.
When connection_name is specified, it must be a debuggee connection owned by the current debugger session. See DEBUG CONNECTION for more information.
statement_name must specify a valid query handle on the debuggee connection. See ::DEBUG_STATEMENTS and ::stmt.name for additional information.
The TRANSIENT clause specifies that break point only exists until the next stoppage in execution of the debuggee. Its main purpose is to support the Run-To or Trace-Into type of functionality.
The REMOVE clause removes all break points at the specified location.
// Given the following script (without any comment) as the script to
// be debugged
DECLARE i Integer;
i = 0;
WHILE i < 3 DO
i = I + 1;
// Either of the following statements will suspend the execution
// before the executing the line "i = 0":
DEBUG BREAK POINT "CONN0001xxxx" STATEMENT "STMT0001yyyy" AT 0;
DEBUG BREAK POINT "CONN0001xxxx" STATEMENT "STMT0001yyyy" AT 23 ID "B1";
// Setting the following break point then execute the script
// on the debuggee to simulate tracing into the script
DEBUG BREAK POINT "CONN0001xxxx" STATEMENT "STMT0001yyyy" AT 0 TRANSIENT;
DEBUG WAIT; // wait for the any debuggee suspension
// Suppose a UDF is created with the following script
CREATE FUNCTION testfuncts.getMaxID() RETURNS integer
DECLARE i integer;
i = ( SELECT max( id ) FROM myIDs );
IF i IS NULL THEN
i = 1;
END; --End function definition
// This statement will suspend the execution on any debuggee
// connection as soon as the UDF is entered
DEBUG BREAK POINT AT 0 IN FUNCTION testfuncts.getMaxID;
// This statement will suspend the execution before evaluating the
// "IF …" statement in the function for any SQL script
// executed on connection "CONN0001xxxx"
DEBUG BREAK POINT "CONN0001xxxx" AT 108 IN FUNCTION testfuncts.getMaxID;
// This statement removes the last break point
DEBUG BREAK POINT "CONN0001xxxx" AT 108 IN FUNCTION testfuncts.getMaxID REMOVE;