1

I am trying to run a DB2 query in RazorSQL for getting the next val from a sequence but getting the following error. Can anybody plz help me out.

VALUES NEXT VALUE FOR SEQ_UPLOAD_MASTER;

ERROR: An undefined object or constraint name was detected.

DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: DB2INST1.SEQ_UPLOAD_MASTER Error Code: -204

Query = VALUES NEXT
VALUE FOR SEQ_UPLOAD_MASTER
Phoenix
  • 1,045
  • 1
  • 14
  • 22

1 Answers1

1

Thanks. I got the solution. I was trying with the wrong syntax. Correct one is

`select nextval for ARCH_TRANCHE.SEQ_UPLOAD_MASTER from sysibm.sysdummy1;`
  • 1
    Your original syntax was also correct, you just did not specify the sequence schema so DB2 was looking for it in the default schema: `DB2INST1.SEQ_UPLOAD_MASTER`, which equals to your authorization ID. You must have logged in as the user **db2inst1**. – mustaccio Jan 22 '15 at 12:24