Иван Гладуш
Иван Гладуш

Reputation: 642

How to select next element from sequence in snowflake?

I use default snowflake db browser. Now I'm trying to select element from sequence. I specified db, schema and after that I run two next queries

create or replace sequence seq_01 start = 1 increment = 1;
select seq_01.nextval;

And got No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command. Can I get next element from sequence without connecting to warehouse?

Upvotes: 1

Views: 1567

Answers (1)

Simeon Pilgrim
Simeon Pilgrim

Reputation: 25903

Select statements run on warehouses. Selecting a sequence number is a select, and while it's tiny, it seems like a slippery slope argument.

Select statements of all kinds produce results, those are cached/allow time travel, so something has to do that work, and doing work is how Snowflake gets paid.

Upvotes: 1

Related Questions