Trying to create a sequence in Oracle using the ExecuteNonQuery
The SQL is
col a new_value SEQ
SELECT NVL(MAX(ID)+1,1) a FROM DBUSER.TABLENAME;
CREATE SEQUENCE DBUSER.SEQ_ACCOUNT
INCREMENT BY 1 START WITH &SEQ NOCACHE
Ideally, what I'm trying to do is create a sequence where the start value is the next available value in the column (so 2 if the ID is 1 etc)
But I'm getting the ORA-00900 Invalid SQL error. This runs fine in SQL developer and SQL plus so I know it's valid SQL. Is it something that can only be run in SQL Developer and SQL Plus?
col[umn]is a client command, and the&is a client substitution variable..Those mean something to SQL Developer and SQL*Plus, but not all clients, and not for this kind of call. Is there a reason you're not querying the current maximum with one (query) call, then doing a second (non-query) call to create the sequence?