Manage functions

更新时间:
复制 MD 格式

In OceanBase Developer Center (ODC), click a connection name to open the connection. In the navigation pane on the left, click the Functions tab to view the function list. The function list shows the function objects in the database of the current connection.

In the function list, you can view the structure tree of an object or right-click a target object to perform management operations. You can also double-click a function name to open its management page.

Structure tree

In the function list, click the drop-down icon next to a function name to display its structure tree. The structure tree of a function can have up to three levels. Right-click an item at any level to view available operations. For more information about the operations, see the tables under Management operations.

Management operations

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

Quick actions

The following quick actions are available in the upper-right corner of the structure tree view:

Operation

Description

Create

Click the Create icon to create a function.

Filter

Click the Filter icon to show valid or invalid functions.

Batch Compile

Click the Batch Compile icon to compile function objects in batches. Options include the following: Compile All Objects and Compile Invalid Objects.

image.png

Refresh

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

Right-click menu

Right-click a target item in the structure tree to open a menu of management operations. The following table describes these operations.

Operation

Description

View

Opens the function management page to view all information about the current function, such as basic information, parameters, and code.

Create

Opens the Create Function page. Follow the steps to create a new function object.

Edit

The Function Management page displays the statements that define the current function, which you can edit in the window.

Compile

Compiles the target function.

Debug

Opens the Debug page to debug the current function.

Note
  • Upgrade to OBServer V2.2.77 or later. Some earlier versions have known PL debugging issues that may cause OBServer to become unstable.

  • In ODC versions earlier than V3.2.2, the debug feature is unavailable when you connect to the target instance through OBProxy. Connect directly to the target instance in ODC.

  • ODC V3.2.2 and later versions support PL debugging when you connect to OBServer through OBProxy.

  • ODC V4.0.0 and later versions support setting parameter values to DEFAULT, NULL, or an empty string.

Run

Runs the current function.

Export

Exports data from a single table. For more information, see Single-table export and import.

Download

Downloads the SQL file of the function object.

Delete

Deletes the current function.

Refresh

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

Function management page

image.png

Double-click a function name in the function list to open the function management page. This page displays the following information:

Features

Description

Basic Information

Displays information such as Function Name, Return Type, and Creator.

Parameters

Displays parameter information such as Name, Order, Mode, Data Type, and Default Value. Click the Refresh icon to refresh the parameters.

DDL

Displays the script that defines the function. It also provides buttons for Edit, Download, Find, Format, and Refresh.

Note

Clicking the Edit icon opens the PL object editing window.

Function editing page

Right-click a target item in the function list and click Edit to open the function editing page. The code area on this page displays the definition statement of the function, which you can edit. The toolbar provides the following buttons:

Features

Description

Confirm Changes

Click to update

New

Modify.

Compile

Compiles the statements on the current page.

Run

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

Stop

Click this button to stop the running statements.

Debug

Click this button to open the Debug page and debug the PL object in the code area.

Format

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

Find/Replace

Enter content in the find box to search the script. After finding the content, you can enter new content in the replace box to replace it.

Undo

Reverts the script to the state before the last operation.

Redo

After an Undo operation, re-applies the undone operation to the script.

Case

Provides three options: ALL UPPERCASE, all lowercase, and Capitalize First Letter. Converts the selected text in the script to the corresponding format.

Indent

Provides two options: Add Indent and Remove Indent. Adds or removes indents for the selected statements in the script.

Comment

Provides two options: Add Comment and Remove Comment. Converts the selected statements in the script into comments or back into SQL statements.

IN Value Conversion

A batch conversion tool for formatting copied row or column results when you query data.

Paste the batch data into the SQL editing area, select the data, and click the IN Value Conversion button. The data is converted to the `in('A','B')` format.

  • The column value delimiter is a line feed.

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

Code Snippet

Provides built-in and custom syntax snippets for you to view and reference. For more information, see Code snippets.

Download

Downloads the SQL file of the function object.