---
description: Translation reference to convert Teradata MACRO statement to Snowflake
---

# Macros

{% hint style="info" %}
**Important Notice: Migration of Documentation Website**

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

[Official Snowflake Snowconvert Documentation](https://docs.snowflake.com/en/migrations/snowconvert-docs/translation-references/teradata/README)

For any immediate assistance or if you encounter any issues, please contact our support team at [snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com).

Thank you for your understanding.
{% endhint %}

## Description

Teradata's MACRO statement is translated to Snowflake MACRO syntax.

For more information on Teradata MACRO, check [here](https://docs.teradata.com/r/scPHvjfglIlB8F70YliLAw/9DrmMbAITa43q4~JmBnkdA).

{% hint style="info" %}
Some parts of the output code are omitted for clarity reasons.
{% endhint %}

## Sample Source Patterns

### Create Macro Transformation

**Teradata**

{% tabs %}
{% tab title="Macro" %}
{% code title="IN -> Teradata_01.sql" %}
```sql
-- Additional Params: -t JavaScript
CREATE MACRO new_table (col1 INTEGER, col2 VARCHAR(12))
AS
(
	insert into table1 (col1, col2) values (:col1, :col2);
	select * from table1 where col1 = :col1;
);
```
{% endcode %}
{% endtab %}
{% endtabs %}

**Snowflake**

{% tabs %}
{% tab title="JavaScript Macro" %}
{% code title="OUT -> Teradata_01.sql" %}
```sql
CREATE OR REPLACE PROCEDURE new_table (COL1 FLOAT, COL2 VARCHAR(12))
RETURNS STRING
LANGUAGE JAVASCRIPT
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"teradata"}}'
EXECUTE AS CALLER
AS
$$
    // SnowConvert Helpers Code section is omitted.
    
    // ** SSC-EWI-0022 - ONE OR MORE IDENTIFIERS IN THIS STATEMENT WERE CONSIDERED PARAMETERS BY DEFAULT. REFERENCED TABLE NOT FOUND. **
    EXEC(`INSERT INTO table1 (col1, col2)
    VALUES (:1, :2)`,[COL1,COL2]);
    INSERT_TEMP(`SELECT * from table1 where col1 = :1`,[COL1]);
    return tablelist;
$$;
```
{% endcode %}
{% endtab %}
{% endtabs %}

## Known Issues

#### 1. Macro transform to store procedure

The Teradata Macro is transformed to a stored procedure since Snowflake does not support Macros.

## Related EWIs

1. [SSC-EWI-0022](../../../general/technical-documentation/issues-and-troubleshooting/conversion-issues/general/ssc-ewi-0022): One or more identifiers in this statement were considered parameters by default.
