Manage stored procedures

更新时间:
复制 MD 格式

Overview

On the OceanBase Developer Center (ODC) home page, click a connection name. In the navigation pane on the left, click the Stored Procedure tab to view a list of stored procedures in the current database.

From the list of stored procedures, you can view the structure tree of an object or right-click the object to access its management operations. You can also double-click a stored procedure name to open its management page.

Structure tree

In the list of stored procedures, click the drop-down icon 下拉按钮2 next to a stored procedure name to display its structure tree, as shown in the following figure.

The structure tree of a stored procedure has up to three levels. You can right-click an item at any level to view its management options. For more information about these operations, see the management operations table in the Management operations section.

image.png

Management operations

By default, stored procedure names in the list are sorted in ascending order by the first character.

Quick actions

The upper-right corner of the structure tree provides the following actions:

Action key

Description

Create

Click the Create icon to create a stored procedure.

Filter

Click the Filter icon to show valid or invalid stored procedures.

Batch Compile

Click the Batch Compile icon to compile stored procedure objects in a batch. Options include the following: Compile All Objects and Compile Invalid Objects.

Refresh

After performing management operations, refresh the structure tree to see the latest information.

Right-click actions

Right-click an item in the structure tree to open a context menu with options for managing the object. The following table describes these operations.

Action

Description

View

Open the stored procedure management page to view all details of the stored procedure, such as basic information, parameters, and code.

Create

Open the page for creating a stored procedure. Follow the steps to create a new one.

Edit

Open the stored procedure editing page. The statement that defines the stored procedure appears. You can then edit the stored procedure in the window.

Compile

Compile the target stored procedure.

Run

Run the current stored procedure.

In ODC V4.0.0 and later, you can set a parameter value to DEFAULT, NULL, or an empty string.

Export

Export data from a single table. For more information, see the Export and Import a Single Table document.

Download

Download the SQL file of the stored procedure object.

Delete

Delete the current stored procedure.

Refresh

After performing management operations, refresh the structure tree to see the latest information.

Stored procedure management page

数据库对象-管理存储对象-参数

In the list of stored procedures, double-click a stored procedure name to open its management page. This page displays the following information:

Feature

Description

Basic Information

Displays information such as Stored Procedure Name, Creator, Creation Time, and Last Modified Time.

Parameters

Displays information such as Name, Pattern, Data Type, Length, and Default Value. You can click the refresh icon to refresh the parameters.

DDL

Displays the script that defines the stored procedure, and provides the Edit, Download, Find, Format and Refresh buttons.

Note

Click the Edit icon to open the PL object editing window.

Stored procedure editing page

In the stored procedure list, right-click the target item and click Edit on the context menu to open the stored procedure editing page. The definition statement for the stored procedure appears in the code area on the editing page, where you can edit it. Additionally, the toolbar provides the following buttons:

Feature

Description

Confirm Changes

Click to apply the changes.

Compile

Compile the statements on the current page.

Note

  • If the code references an invalid external object, the line containing the object name is highlighted during compilation.

  • After the compilation is complete, the compilation status is displayed in the Compilation Result. If an alert exists, the alert details are also displayed.

Run

Click this button 运行 to run the statements in the code area.

Note

In ODC V4.0.0 and later, you can set a parameter value to DEFAULT, NULL, or an empty string.

Format

Click this button to format the selected SQL statements or all SQL statements in the current window. This includes actions such as indenting, adding line breaks, and highlighting keywords.

Find/Replace

Enter text in the find box to search the script. Then, enter text in the replace box to replace the search results.

Undo

Revert the script to its state before the last operation.

Redo

After you perform an Undo operation, it re-executes the undone operation on the script.

Case

Transforms selected statements in a script into one of the following formats: All Uppercase, All Lowercase, or Title Case.

Indent

Provides two options, Add Indent and Remove Indent, to add or remove indentation for selected statements in a script.

Comment

Provides the Add Comment and Uncomment actions to convert selected statements in a script to comments or to SQL statements.

IN Value Conversion

A tool for batch conversion. It is useful for formatting copied row or column results from a data query.

After pasting batch data into the SQL editor, select the copied data and click the IN Value Conversion button to convert the data into the in('A','B') format.

  • The column value separator is a line feed.

  • The row value separator is a space or a TAB character.

Stored procedure run results page

After executing the stored procedure, you can view the Results and DBMS Outputs.

Features

Description

Run Result

The Run Result tab shows the running status, parameters, type, value, return type, and return value of the stored procedure.

DBMS Output

The DBMS Output tab shows the DBMS output from the stored procedure.