Search code examples
oracle-sqldevelopersnowflake-cloud-data-platform

Can we have Table Declaration in Snowflake similar to Oracle SQL?


I am trying to make use of Table declaration syntax and creating the same in Snowflake SQL.

I've gone through the snowflake community & documentations and all I could find is Table variable directly being assigned similar to SQL table variable or making use of a Table function.


Solution

  • generally Snowflake doesn't allow indexes nor type declarations.

    other than that, you have two options:

    • use JS stored procedures, but they are not meant to return a range of values, all you can do is make a temporary table and put your set in there
    • use UDFs, that are (or well, can be) SQL and can return a table, but have a limited set of functionality