0
CREATE SEQUENCE CountBy1
    START WITH 1
    INCREMENT BY 1
    MINVALUE 0;

CREATE TABLE TEST_SEQ (ID INT, NAME VARCHAR(200));

INSERT INTO TEST_SEQ values (NEXT VALUE FOR CountBy1,'Manoj Pandey');

shows this error

SQL Error: ORA-00917: missing comma
3
  • 1
    Which query is getting the error? Commented Dec 24, 2013 at 8:31
  • On docs.oracle.com/cd/B12037_01/server.101/b10759/… I don't see NEXT VALUE FOR as a possible syntax. Commented Dec 24, 2013 at 8:34
  • 2
    Trivial syntax error arising from failure to read the documentation. Commented Dec 24, 2013 at 8:38

2 Answers 2

4

Try this:

INSERT INTO TEST_SEQ values (CountBy1.NEXTVAL,'Manoj Pandey');
Sign up to request clarification or add additional context in comments.

Comments

1

To retrieve the next value in the sequence order, you need to use nextval.

INSERT INTO TEST_SEQ values (CountBy1.nextval,'Manoj Pandey');

The ID field would be assigned the next number from the TEST_SEQ sequence.

Refer this for more info: SEQUENCE EXAMPLE

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.