| Ocalt Query Language
Pricing Dashboard ocalt.com v1.0

Operations

Named, reusable OQL procedures stored server-side. Define once, execute by name from any query. Operations accept arguments and return values. Equivalent to stored procedures — but in OQL.

VerbDescription
DEFINE NEW OPERATION AS "name" OPEN NEST ... CLOSE NESTDefine and store an operation
EXECUTE OPERATION "name" SET ?resultExecute a stored operation
EXECUTE OPERATION "name" WITH ?args SET ?resultExecute with arguments — accessible as !REQUEST(key) inside
LIST OPERATIONS SET ?opsList all defined operations in the namespace
DESCRIBE OPERATION "name" SET ?defGet definition and metadata for an operation
DELETE OPERATION "name"Remove a stored operation

Define an operation

DEFINE NEW OPERATION AS "get_top_products" OPEN NEST QUERY "products" FROM "shop" SORT BY "sales" LIMIT 10 SET ?rows AFTER RETURN ?rows CLOSE NEST AFTER EMIT "Defined"

Execute it

EXECUTE OPERATION "get_top_products" SET ?products AFTER EMIT ?products
Try it ›

Operation with arguments

(* Define *) DEFINE NEW OPERATION AS "send_welcome" OPEN NEST EMAIL "Welcome to OQL!" TO !REQUEST(email) WITH "Welcome" AFTER RETURN true CLOSE NEST (* Execute with args *) NEW JSON OBJECT OPEN NEST SET "email" AS "new@user.com" CLOSE NEST SET ?args AFTER EXECUTE OPERATION "send_welcome" WITH ?args SET ?ok AFTER EMIT ?ok

List / Delete

LIST OPERATIONS SET ?ops AFTER EMIT ?ops DELETE OPERATION "send_welcome" AFTER EMIT "Deleted"