【问题标题】:execute multiple create view statements in snowflake在雪花中执行多个创建视图语句
【发布时间】:2021-02-05 23:00:03
【问题描述】:

有没有办法在 Snowflake 的一个查询中创建多个视图?

我尝试这个时总是出错 -

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'

错误:

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

我也试过这个-

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';

但它只执行第一个创建视图语句。

【问题讨论】:

  • 您的查询是存储过程吗?
  • 你想在哪里执行这些语句?
  • 我在 Snowflake Web 应用程序和 Python 中执行它们。我在 Snowflake 中通过在 Run 按钮中选择 run both queries 来解决它。在 python 中,我只是将它们作为单独的查询运行。没有太大的区别,所以只是分别运行它们。

标签: sql snowflake-cloud-data-platform


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-05
    • 1970-01-01
    • 2020-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多