execute multiple create view statements in snowflake

Tags: ,



Is there a way to create multiple views in one query in Snowflake?

I keep getting error when I try this –

create or replace view forecast_view as
select * from forecast
where variable = 'Name'
    
go

create or replace view demand_view as
select * from demand
where variable = 'Name'

Error:

SQL compilation error: syntax error line 5 at position 0 unexpected 'go'.

I also tried this –

create or replace view forecast_view as
select * from forecast
where variable = 'Name';

create or replace view demand_view as
select * from demand
where variable = 'Name';

but it only executes the first create view statement.

Answer

There is no “go” command in SnowFlake:

SnowFlake Commands

Executing Multiple SQL Statements in a Stored Procedure



Source: stackoverflow