SQL Procedures
These procedures are called in Snowsight (or any SQL client) to manage the 42Forms application.
All procedures are in the FORTY_TWO_FORMS_APP.CORE schema.
core.reset_admin
Section titled “core.reset_admin”NOTE: Consumer admin must also run GRANT CALLER statements after install to enable per-user data access (Restricted Caller Rights). See docs/POST_INSTALL_GUIDE.md for the required SQL. External access integration for Cortex LLM (Business Critical accounts) Note: External access integrations are created at the account level by the consumer and granted to the application. The app requests this via manifest privileges. ── Emergency admin recovery ───────────────────────────────────────────────── DEPRECATED: This procedure is a no-op placeholder. Do not rely on it. For emergency admin recovery, connect to the Hybrid Tables directly and update the organizationmember table in FORTY_TWO_FORMS_DB.APP_DATA.
Signature:
CALL FORTY_TWO_FORMS_APP.CORE.RESET_ADMIN(target_email VARCHAR);Parameters:
| Name | Type | Description |
|---|---|---|
target_email | VARCHAR | - |
Returns: VARCHAR
View procedure body
BEGIN RETURN 'Not available in SPCS mode. Use the API container shell for admin recovery.';END;core.set_license
Section titled “core.set_license”── License management stored procedures ────────────────────────────────────── Set license tier (creates user if not exists, switches if already has a different tier)
Signature:
CALL FORTY_TWO_FORMS_APP.CORE.SET_LICENSE(username VARCHAR, tier VARCHAR);Parameters:
| Name | Type | Description |
|---|---|---|
username | VARCHAR | - |
tier | VARCHAR | - |
Returns: VARCHAR
View procedure body
BEGIN INSERT INTO core.license_commands (username, seat_type) VALUES (:username, :tier); RETURN 'License command queued: ' || :username || ' → ' || :tier;END;core.revoke_license
Section titled “core.revoke_license”Revoke paid tier (drops to view)
Signature:
CALL FORTY_TWO_FORMS_APP.CORE.REVOKE_LICENSE(username VARCHAR);Parameters:
| Name | Type | Description |
|---|---|---|
username | VARCHAR | - |
Returns: VARCHAR
View procedure body
BEGIN INSERT INTO core.license_commands (username, seat_type) VALUES (:username, 'view'); RETURN 'License revoked: ' || :username || ' → view';END;core.list_users
Section titled “core.list_users”List all users with their tiers
Signature:
CALL FORTY_TWO_FORMS_APP.CORE.LIST_USERS();Returns: TABLE (username VARCHAR, seat_type VARCHAR)
View procedure body
DECLARE res RESULTSET DEFAULT ( SELECT username, seat_type FROM core.license_commands WHERE processed = TRUE QUALIFY ROW_NUMBER() OVER (PARTITION BY username ORDER BY created_at DESC) = 1 );BEGIN RETURN TABLE(res);END;core.add_act_license
Section titled “core.add_act_license”Convenience aliases
Signature:
CALL FORTY_TWO_FORMS_APP.CORE.ADD_ACT_LICENSE(username VARCHAR);Parameters:
| Name | Type | Description |
|---|---|---|
username | VARCHAR | - |
Returns: VARCHAR
View procedure body
BEGIN CALL core.set_license(:username, 'act'); RETURN 'Act license set for: ' || :username;END;core.add_build_license
Section titled “core.add_build_license”Signature:
CALL FORTY_TWO_FORMS_APP.CORE.ADD_BUILD_LICENSE(username VARCHAR);Parameters:
| Name | Type | Description |
|---|---|---|
username | VARCHAR | - |
Returns: VARCHAR
View procedure body
BEGIN CALL core.set_license(:username, 'build'); RETURN 'Build license set for: ' || :username;END;core.add_admin_license
Section titled “core.add_admin_license”Signature:
CALL FORTY_TWO_FORMS_APP.CORE.ADD_ADMIN_LICENSE(username VARCHAR);Parameters:
| Name | Type | Description |
|---|---|---|
username | VARCHAR | - |
Returns: VARCHAR
View procedure body
BEGIN CALL core.set_license(:username, 'admin'); RETURN 'Admin license set for: ' || :username;END;core.suspend_app
Section titled “core.suspend_app”── Suspend / Resume procedures ───────────────────────────────────────────── Allow the consumer to manually suspend and resume the compute pool to save credits.
Signature:
CALL FORTY_TWO_FORMS_APP.CORE.SUSPEND_APP();Returns: VARCHAR
View procedure body
BEGIN ALTER SERVICE core.forty_two_forms_service SUSPEND; ALTER COMPUTE POOL forty_two_forms_pool SUSPEND; RETURN 'Service and compute pool suspended.';END;core.resume_app
Section titled “core.resume_app”Signature:
CALL FORTY_TWO_FORMS_APP.CORE.RESUME_APP();Returns: VARCHAR
View procedure body
BEGIN ALTER COMPUTE POOL forty_two_forms_pool RESUME; ALTER SERVICE core.forty_two_forms_service RESUME; RETURN 'Compute pool and service resumed.';END;