PL/SQL Dev debug Oracle stored procedures, triggers, and functions

Source: Internet
Author: User

There are too many uncertainties in the path we are going to take. The admonishing of others, a flash of our own, and occasional gains and losses are all changing our fate. The world is unpredictable, and there is no need to hold things too long. No one can take anything. Why bother with a person, a moment, or something. Only when you get started and want to get it done can you start with your fate, nature, or mind. Don't worry, don't worry, don't be sad, don't be salty or light.

The following describes how to debug a function. Other debugging operations are the same.
1. debugging location

Debugging in PL/SQL Dev is usually required.ProgramThere are two places:
1). New-> test window:

2) Right-click the program to be debugged and choose test.

2. debugging process

1) enter the test window through the debugging position, for example:


Click position 1 (or press F9) to enter the debugger. Position 2 shows the input and output parameters declared by the program. If the parameter is input, enter the corresponding input values here, the output parameters are displayed after debugging.
2) Press F9 to enter the start modulation ,:


Among them: 1 ---- interrupt debugging, 2 ---- single-step debugging. The simple point is to execute the program step by step. The green arrow indicates that all programs have been run. If there is a breakpoint setting, you can also jump to the next breakpoint.
 3) Click single-step debugging to enter the function,


Here, you can try single-step debugging and run the program step by step
4). set breakpoints,
In the text area, click the left-side border. If a row number is displayed, that is, the position of the row number,


Click the Green Arrow to directly run to the breakpoint setting.
5 ).Monitor variables,


The position 1 is the monitoring window. This window displays the variables you want to monitor. You can copy the variables you want to monitor to this window, you can also right-click the variable and choose add variable to monitor (Location 2 ).
Continue the single-step execution. You can see the changes in the value of the monitoring variable (location 3.

3. Permission issues (ORA-0131)

 1) When debugging the program, the error is ORA-0131: insufficient privileges,


The reason is that the user permission is insufficient because the debug connect session system permission is missing.
2) solution: log on to the database as a sys user and perform the authorization operation:

1SQL> GrantDebug connect sessionTo User_name;

Note: 1. Some netizens pointed out that the debug any procedure permission should also be granted. After testing, this permission does not need to be granted!
2. You can view the permission information from the session_privs table in the data dictionary (You need to log on with user_name):

 1 SQL > Conn Scott /  Tiger;  2 SQL>   Select   *   From  Session_privs;  3   Privilege  4   --  --------------------------------------  5   Create  Session  6   Unlimited tablespace  7   Create  Table  8   Create  Cluster  9   Create  Sequence  10   Create   Procedure  11   Create   Trigger  12   Create  Type  13  Create  Operator  14   Create  Indextype  15   Debug connect session  16 Debug Any   Procedure  17   12 Rows selected

The following describes how to debug a function. Other debugging operations are the same.
1. debugging location

In general, there are two places to debug the program in PL/SQL Dev:
1). New-> test window:

2) Right-click the program to be debugged and choose test.

2. debugging process

1) enter the test window through the debugging position, for example:


Click position 1 (or press F9) to enter the debugger. Position 2 shows the input and output parameters declared by the program. If the parameter is input, enter the corresponding input values here, the output parameters are displayed after debugging.
2) Press F9 to enter the start modulation ,:


Among them: 1 ---- interrupt debugging, 2 ---- single-step debugging. The simple point is to execute the program step by step. The green arrow indicates that all programs have been run. If there is a breakpoint setting, you can also jump to the next breakpoint.
 3) Click single-step debugging to enter the function,


Here, you can try single-step debugging and run the program step by step
4). set breakpoints,
In the text area, click the left-side border. If a row number is displayed, that is, the position of the row number,


Click the Green Arrow to directly run to the breakpoint setting.
5 ).Monitor variables,


The position 1 is the monitoring window. This window displays the variables you want to monitor. You can copy the variables you want to monitor to this window, you can also right-click the variable and choose add variable to monitor (Location 2 ).
Continue the single-step execution. You can see the changes in the value of the monitoring variable (location 3.

3. Permission issues (ORA-0131)

 1) When debugging the program, the error is ORA-0131: insufficient privileges,


The reason is that the user permission is insufficient because the debug connect session system permission is missing.
2) solution: log on to the database as a sys user and perform the authorization operation:

1SQL> GrantDebug connect sessionTo User_name;

Note: 1. Some netizens pointed out that the debug any procedure permission should also be granted. After testing, this permission does not need to be granted!
2. You can view the permission information from the session_privs table in the data dictionary (You need to log on with user_name):

 1 SQL > Conn Scott /  Tiger;  2 SQL>   Select   *   From  Session_privs;  3   Privilege  4   --  --------------------------------------  5   Create  Session  6   Unlimited tablespace  7   Create  Table  8   Create  Cluster  9   Create  Sequence  10   Create   Procedure  11   Create   Trigger  12   Create  Type  13  Create  Operator  14   Create  Indextype  15   Debug connect session  16 Debug Any   Procedure  17   12 Rows selected
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.