2

I created a Sequence batch_id_seq in Snowflake. But when I am running the query "select batch_id_seq.nextval" from outside snowflake environment, I am getting the below error:

SQL compilation error: error line 1 at position 7 invalid identifier 'BATCH_ID_SEQ.NEXTVAL'

The query is working fine from within Snowflake Worksheet. Can anyone let me know what needs to be done to resolve the issue.

user2238999
  • 121
  • 1
  • 1
  • 4

2 Answers2

3

Most likely you are at different schema SELECT CURRENT_SCHEMA():

select batch_id_seq.nextval

=>

select <schema_name_here>.batch_id_seq.nextval
Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275
  • 1
    This is probably correct. It's also possible that you're in the wrong database, or you're using a role that doesn't have the proper grants. – Pepik Oct 26 '21 at 20:16
0

Kindly check if the role you are using has the proper rights and grants to be able to access the schema.

ekibet
  • 176
  • 2
  • 8