Sidebar

Mobile navigation sidebar

Sidebar

Mobile navigation sidebar

Back to Documentation
Features

Snippets

Use and customise PL/SQL code snippets to accelerate database code authoring.

Snippets

Nexo SQL Studio ships with PL/SQL and SQL snippets that save you from boilerplate. Snippets are triggered by a short prefix keyword and expanded by pressing Tab.

Using Snippets

Type the snippet prefix in any .sql, .pls, .pkb, .pks, .prc, or .fnc file and press Tab (or select from the completion list with Ctrl+Space).

Example — Create a procedure:

Type proc and press Tab:

CREATE OR REPLACE PROCEDURE procedure_name (
    p_param1 IN VARCHAR2
) AS
BEGIN
    -- TODO
    NULL;
END procedure_name;
/

Example — Exception block:

Type excep:

EXCEPTION
    WHEN OTHERS THEN
        ROLLBACK;
        DBMS_OUTPUT.PUT_LINE('Error: ' || SQLERRM);
        RAISE;

Built-in Snippet Library

Prefix Expands to
proc CREATE OR REPLACE PROCEDURE …
func CREATE OR REPLACE FUNCTION …
pkg Package spec skeleton
pkgb Package body skeleton
trigger CREATE OR REPLACE TRIGGER …
cursor Cursor declaration + loop
begin BEGIN … EXCEPTION … END;
if IF … THEN … END IF;
loop LOOP … EXIT WHEN … END LOOP;
forloop FOR i IN … LOOP … END LOOP;
pldoc PL/SQL documentation block
excep Exception handler block
bulk BULK COLLECT INTO … FORALL …
dyn EXECUTE IMMEDIATE …

Snippets View

Use the Snippets / Reports view to create folders, create snippets, filter entries, edit associated connections, and insert snippets into the active editor.

Documentation Snippets (pldoc)

The pldoc snippet inserts a structured documentation block above a procedure or function:

/**
 * <Short description>
 *
 * @param p_param1  Description of parameter
 * @return          Description of return value
 */

You can customise the pldoc template by referencing a folder that contains your own pldoc.json file:

// settings.json
"nexo-sql-studio.pldoc.path": ".vscode"