Using the SQL Editor

The SQL Editor works similarly to many other text editors. Many of the same functions are available as in the PeopleCode Editor, for example, cut, paste, find, and replace.

Image: SQL Editor shortcut menu

When you right-click in an open SQL Editor window, the available functions appear in a pop-up menu:

SQL editor shortcut menu

This table describes the functions that are available in the SQL Editor but not the PeopleCode Editor:

Function

Description

Format Display

You do not need to format your SQL statements; you only need to use the correct syntax. When you save or validate, the system formats the code according to the rules in the PeopleCode tables, no matter how you entered it originally. It automatically converts field names to uppercase and indents statements. The resulting look of SQL is consistent with other programs in the system.

Resolve Meta SQL

If the SQL contains meta-SQL, select Resolve Meta SQL to expand the meta-SQL statement in the output window. The expanded meta-SQL appears in the Meta SQL tab.

Delete Statement

You can delete standalone SQL statements. This menu item is not enabled with SQL statements that have a database type of Default with no effective date, or for statements that have a database type of Default and an effective date of 01/01/1900.

This example, using Resolve Meta-SQL, shows how the following code expands:

%Join(COMMON_FIELDS, PSAEAPPLDEFN ABC, PSAESECTDEFN XYZ)

Image: Meta-SQL expanded in the output window

This example illustrates meta-SQL expanded in the output window.

Meta-SQL expanded in the output window

The SQL Editor and the PeopleCode Editor interfaces and functions are similar. You can add, delete, and change text; you can use the find and replace function; and you can validate the SQL. When you save a SQL definition, the code is automatically validated and formatted (indented, capitalized, and so on). You can select the colors for displaying keywords, comments, operators, and so on; these settings are shared with the PeopleCode Editor. You can also separately specify word wrap options.

See the documentation on the PeopleCode Editor for details on relevant functions.