---
title: "Stored procedure / UDF migration"
description: "Stored procedure / UDF migration"
canonical: https://www.smartmigrate.ai/workloads/stored-procedure-udf-migration
htmlPath: /workloads/stored-procedure-udf-migration
markdownPath: /workloads/stored-procedure-udf-migration.md
schema: Service
updatedAt: 2026-02-19T00:00:00.000Z
---
# Stored procedure / UDF migration
Stored procedure / UDF migration
Canonical: https://www.smartmigrate.ai/workloads/stored-procedure-udf-migration
Public path: /workloads/stored-procedure-udf-migration
Markdown resource: /workloads/stored-procedure-udf-migration.md
## Workload scope

Stored procedure and UDF migration covers procedural control flow, custom functions, dynamic SQL, error handling, side effects, and test harnesses for converted routines.

## Shared migration method

Treat routines as executable application logic. Inventory parameters, return types, dependencies, temporary objects, transactional assumptions, dynamic SQL, error paths, schedules, and callers. Decide whether each routine should become a target-native routine, a tested SQL model, or an external service or orchestration step; do not hide a runtime dependency inside a syntax conversion claim.

The accepted conversion includes test fixtures for normal, boundary, invalid, and retry paths, plus a clear ownership and deployment sequence for every dependent object.

## Routine controls

- Make input/output contracts and side effects explicit before rewriting control flow.
- Replace implicit session state and temporary-object assumptions with durable, observable target patterns.
- Parameterise dynamic SQL and validate identifiers, types, and failure paths.
- Run deterministic tests before integration, reconciliation, and cutover rehearsal.

## When to use a pair-specific guide

Use a retained pair-specific page when the source runtime creates a specific decision—for example notebook macros, Hive-style scripts, Oracle packages, or target routine limitations. The shared guide owns the common assessment and test method.

<!-- Related paths are generated from the remaining published, pair-specific guides. -->

<!--

## Related migration paths

- [Databricks to BigQuery](/migrations/databricks-to-bigquery/stored-procedure-udf-migration) - Convert Databricks UDFs and notebook macros to BigQuery routines with parity for typing, control flow, dynamic SQL, and error handling, validated with tests.
- [Databricks to Snowflake](/migrations/databricks-to-snowflake/stored-procedure-udf-migration) - Convert Databricks UDFs and macro-style notebook utilities to Snowflake UDFs/procedures with parity for typing, control flow, dynamic SQL, and error handling.
- [Hadoop legacy cluster to BigQuery](/migrations/hadoop-legacy-cluster-to-bigquery/stored-procedure-udf-migration) - Convert Hive/Impala/Spark UDFs and procedural utilities to BigQuery routines with parity for typing, NULL/regex behavior, and side effects with cutover gates.
- [Hive to BigQuery](/migrations/hive-to-bigquery/stored-procedure-udf-migration) - Convert Hive UDFs and macro ETL utilities to BigQuery routines with parity for typing, NULL/regex/time behavior and side effects, validated with harnesses.
- [Impala to BigQuery](/migrations/impala-to-bigquery/stored-procedure-udf-migration) - Convert Impala/Hive UDFs and script-driven logic to BigQuery routines with parity for typing, error handling, and side effects, validated with harnesses.
- [Impala to Snowflake](/migrations/impala-to-snowflake/stored-procedure-udf-migration) - Convert Impala/Hive UDFs and script-driven utilities to Snowflake routines with parity for typing, NULL/regex/time behavior, dynamic SQL, and side effects.
- [Netezza to BigQuery](/migrations/netezza-to-bigquery/stored-procedure-udf-migration) - Convert Netezza UDFs and procedures to BigQuery routines with parity for typing, NULL/time behavior, dynamic SQL, and side effects, validated with harnesses.
- [Oracle to BigQuery](/migrations/oracle-to-bigquery/stored-procedure-udf-migration) - Convert Oracle PL/SQL procedures, packages, and triggers to BigQuery routines with parity for control flow and side effects, validated with harnesses.
- [Redshift to BigQuery](/migrations/redshift-to-bigquery/stored-procedure-udf-migration) - Convert Redshift procedures and UDFs to BigQuery routines with parity for control flow, dynamic SQL, typing, and side effects, validated with tests and gates.
- [Redshift to Snowflake](/migrations/redshift-to-snowflake/stored-procedure-udf-migration) - Convert Redshift UDFs and procedures to Snowflake routines with parity for typing, NULL/time behavior, dynamic SQL, side effects, and idempotency checks.
- [Snowflake to BigQuery](/migrations/snowflake-to-bigquery/stored-procedure-udf-migration) - Migrate Snowflake procedures and UDFs to BigQuery routines with parity for control flow, typing, and error handling, validated by harness and reconciliation.
- [Spark SQL to BigQuery](/migrations/spark-sql-to-bigquery/stored-procedure-udf-migration) - Convert Spark SQL UDFs and macro utilities to BigQuery routines with parity for typing, NULL/time behavior, and side effects, validated with test harnesses.
- [Teradata to BigQuery](/migrations/teradata-to-bigquery/stored-procedure-udf-migration) - Convert Teradata procedures, macros, and UDFs to BigQuery routines with parity for control flow, dynamic SQL, error handling, and typing using validation gates.
- [Teradata to Snowflake](/migrations/teradata-to-snowflake/stored-procedure-udf-migration) - Convert Teradata procedures, macros, and UDFs to Snowflake routines with parity for typing, NULL/time behavior, dynamic SQL, side effects, and idempotency.
- [Vertica to BigQuery](/migrations/vertica-to-bigquery/stored-procedure-udf-migration) - Convert Vertica UDFs and ETL utilities to BigQuery routines with parity for typing, NULL/time behavior, dynamic SQL, and side effects, validated by harnesses.

-->

## Review points

- Routine boundaries and side effects
- Input/output typing and error behavior
- Dynamic SQL and transaction assumptions
- Replayable tests for converted functions and procedures

## Acceptance criteria

A stored procedure / udf migration page is complete when the migration team can identify source assets, understand conversion assumptions, review unsupported or ambiguous constructs, run validation checks, and decide whether the workload is ready for cutover.

For each related path, confirm that the child page explains what changes, how conversion works, which patterns are supported, what can drift, and which evidence is required before production traffic moves to the target platform.

<!-- Source: Git-managed MDX content derived from migrated Sanity workload metadata and migration workload child pages. -->
Intent: 