Skip to main content

CALL PROCEDURE

Introduced or updated: v1.2.637

Executes a stored procedure by calling its name, optionally passing arguments if the procedure requires them.

Syntax

CALL PROCEDURE <procedure_name>([<argument1>, <argument2>, ...])

Examples

This example demonstrates how to create and call a stored procedure that converts a weight from kilograms (kg) to pounds (lb):

CREATE PROCEDURE convert_kg_to_lb(kg DECIMAL(4, 2)) 
RETURNS DECIMAL(10, 2)
LANGUAGE SQL
COMMENT = 'Converts kilograms to pounds'
AS $$
BEGIN
RETURN kg * 2.20462;
END;
$$;

CALL PROCEDURE convert_kg_to_lb(10.00);

┌────────────┐
│ Result │
├────────────┤
22.0462000
└────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today