Debugger Logpoints and use of variables in Message?

Stew Stryker

Member³
I'm running Beta v13.0.0.1872.

I was trying to use this new feature to set a Logpoint. The basics seem to work fine, but I can't seem to get a variable value to display. Maybe I'm not understanding how to reference it?

Here's my little function and the Logpoint:

PSD%20v13.0.0.1872%20-%2064%20bit%20Logpoint.png


When I run that function from the Test Window using the debugger, I get the following DBMS Output:

1.726 FINDSTRBETWEEN.14: Start pos: :istartpos

I expected it would show the variable value, not the name.

Thanks,

Stew

The function source is originally fromhttp://oraclecoder.com/tutorials/find-string-between-start-string-and-end-string--2971

Reproduced here for your testing:

Code:
CREATE OR REPLACE FUNCTION findstrbetween(pstring      IN VARCHAR2,
                                          pstartstring IN VARCHAR2,
                                          pendstring   IN VARCHAR2) RETURN VARCHAR2 IS
    retval VARCHAR2(1000);
    istartpos INTEGER;
    iendpos INTEGER;

    vreststring VARCHAR2(1000);
BEGIN
    istartpos := INSTR(pstring, pstartstring) + LENGTH(pstartstring);
    vreststring := SUBSTR(pstring, istartpos, LENGTH(pstring) - istartpos + 1);
    iendpos := INSTR(vreststring, pendstring) - 1;
    retval := SUBSTR(vreststring, 1, iendpos);

    RETURN retval;
END findstrbetween;

 
It seems that variable values are not supported in the message text. It does make a lot of sense though. We'll add this.
 
Oh, I guess it's my mistake! I thought the point of using the variables was for the messages. Now I remember that the documentation mentions it in the context of defining a Condition, not for the Logpoint messages.

Thanks for adding this handy feature!

Stew
 
Correction. You can use the following variables in a message:
  • [TIMESTAMP] - The number of seconds since the start of the program
  • [TIME] - The current time
  • [DATE] - The current date
  • [BREAKPOINT] - The program name and line number of the breakpoint
  • [PASS] - The pass counter
  • [:VARNAME] - The value of a PL/SQL variable
The last one is the one you need. If you specify the following message for your breakpoint, it will show the value of the "istartpos" variable:

[timestamp] [breakpoint]: Start pos: [:istartpos]

Even though there is a selection list to insert these message variables (including [:varname]), I'm not sure why this is not documented in the User's Guide. We'll add this.
 
Thanks for the instructions.
I stupidly removed out the brackets! :-(

I can see the variable value now (even though it's a record variable, which is great that it's supported).

A question though: If I put this Logpoint in a loop that runs 5k times, wouldn't you expect me to get 5k rows of Logpoint output. I got the first 25, then it stopped. My DBMS Output buffer size is set to 0 and Enabled.

Thanks,

Stew
 
Back
Top