Skip to content

Query Parameters

Query Parameters

DBeagle supports named $parameters so you can keep reusable SQL templates and supply values right before execution.

Parameter syntax

Use $name placeholders in SQL:

SELECT * FROM users WHERE status = $active;
SELECT * FROM orders WHERE date BETWEEN $start_date AND $end_date;
SELECT * FROM products WHERE category_id = $category_id;

Supported value types

TypeExample valueWhat DBeagle does
stringreadyWraps and escapes it as a SQL string literal
number42Inserts it as a numeric literal
booleanTRUEInserts TRUE or FALSE
nullNULLInjects a SQL NULL
rawSqlcurrent_date - interval '7' dayInjects the text exactly as entered

How the Parameters view works

When DBeagle sees parameters in the active file or selection:

  1. The Parameters view lists each placeholder.
  2. You choose a value type for each one.
  3. You enter the raw value.
  4. DBeagle validates the inputs before letting the query run.

The view tracks the current scope:

  • File scope when you are running the whole file
  • Selection scope when you are running only the selected SQL

Validation behavior

If any required parameter is missing or invalid, DBeagle blocks execution and focuses the Parameters view so you can fix it.

Examples

Strings and numbers

select *
from users
where status = $status
and user_id = $user_id;

Set:

  • $status as string
  • $user_id as number

Booleans

select *
from feature_flags
where enabled = $enabled;

Set $enabled as boolean and choose TRUE or FALSE.

Raw SQL

select *
from orders
where order_date >= $start_expr;

Set $start_expr as rawSql only when you intentionally want to inject SQL syntax rather than a quoted literal.

Use rawSql carefully. It is powerful, but it bypasses automatic quoting.

Persistence

DBeagle remembers parameter values per document or scratch where possible, so recurring queries are easier to rerun.

Resetting parameters

Use Reset Visible Query Parameters from the Parameters view action bar when you want to clear the current parameter set.

Layout tip

If you prefer the Parameters view on the right side of VS Code, move it into the Secondary Sidebar.

DBeagle parameters panel

The Parameters view with typed query parameter inputs.