Skip to main content

Stored Procedures: rpc()

You can call stored procedures as a "Remote Procedure Call".

That's a fancy way of saying that you can put some logic into your database then call it from anywhere. It's especially useful when the logic rarely changes - like password resets and updates.

final res = await supabase
.rpc('hello_world')
.execute();

Examples#

Call a stored procedure#

This is an example invoking a stored procedure.

final res = await supabase
.rpc('hello_world')
.execute();

With Parameters#

final res = await supabase
.rpc('echo_city', params: { 'name': 'The Shire' })
.execute();

With count option#

You can specify a count option to get the row count along with your data. Allowed values for count option are exact, planned and estimated.

final res = await supabase
.rpc('hello_world')
.execute(count: CountOption.exact);