Documentation

SQL Manage Procedures

SQL Manage Procedures

The Procedures & Functions activity lists every stored routine in the current database — both procedures and user-defined functions — with mode-aware parameter tables, DDL viewers, and one-click drop/edit. It is the fastest way to audit or evolve a codebase-worth of server-side logic.

Quick Start

  1. Open the activity from a database's context menu (or press Ctrl+Shift+P and search for Procedures).
  2. Use the search box to filter by name; the count badge updates live.
  3. Click a row to expand its parameter table with mode (IN/OUT/INOUT), name, type, and default.
  4. Use the hover actions to Edit, Show DDL, or Drop.
  5. Click New to open a fresh CREATE PROCEDURE or CREATE FUNCTION template in the SQL Editor.

The List

Each row shows an icon that distinguishes routines by kind:

  • PROCEDURE — imperative routines invoked with CALL or EXEC.
  • FUNCTION — scalar or table functions callable from SELECT.

Hover actions:

ActionEffect
Edit Loads the routine's DDL into the SQL Editor for modification.
Show DDL Opens the DDL viewer with the full CREATE PROCEDURE / CREATE FUNCTION.
Drop Confirms, then issues DROP PROCEDURE / DROP FUNCTION.

Parameter Table

Expanding a routine lazily fetches its parameter metadata and renders it as a compact table:

Mode Name Type Default
INp_tenant_idINTEGER
OUTp_totalNUMERIC(12,2)
INOUTp_batch_idUUIDgen_random_uuid()

Mode chips are color-coded: green for IN, amber for OUT, blue for INOUT. Routines with no parameters show a clear empty state.

Creating a Procedure or Function

Click New to open a template in the SQL Editor. A typical procedure:

CREATE OR REPLACE PROCEDURE archive_stale_orders(p_before TIMESTAMP)
LANGUAGE plpgsql
AS $$
BEGIN
    INSERT INTO orders_archive
    SELECT * FROM orders WHERE created_at < p_before;

    DELETE FROM orders WHERE created_at < p_before;
END;
$$;

A scalar function:

CREATE FUNCTION full_name(p_first VARCHAR, p_last VARCHAR)
RETURNS VARCHAR
LANGUAGE SQL
IMMUTABLE
AS $$
    SELECT p_first || ' ' || p_last;
$$;

Dialect Notes

  • PostgreSQL distinguishes PROCEDURE (no return value, called with CALL) from FUNCTION. Both may declare LANGUAGE plpgsql, sql, plpython3u, etc.
  • MySQL / MariaDB uses DELIMITER around routine bodies; the SQL Editor sets this automatically.
  • SQL Server supports CREATE OR ALTER PROCEDURE; parameters use the @name prefix.
  • Oracle supports packages that bundle multiple procedures/functions — the list groups them by package name where applicable.
  • SQLite does not support stored procedures; the activity shows an empty state.

Ready to try VisuaLeaf?

Download and start managing your MongoDB databases with ease.

Download Free Trial