Andrew
Andrew

Reputation: 427

Oracle SQL missing comma error

I have been staring at this insert statement and the resulting ORA-00917: missing comma error for a while now and can not seem to find the cause. It sure looks to me like I have all the comma's i need.

INSERT INTO Person (PERSONID, FIRSTNAME, LASTNAME, EMAIL, PHONE, STATUS, RECORDSTATUS, INSERTDATE, INSERTEDBY)
values(1, 'Andrew', 'Hayes', 'myemail', '123456789', 'A', 'A', sysdate(), 0);

I don't think it's necessary but here is the schema if it helps:

CREATE TABLE PERSON
(
  PERSONID      NUMBER                          NOT NULL,
  FIRSTNAME     VARCHAR2(100 BYTE)              NOT NULL,
  LASTNAME      VARCHAR2(100 BYTE)              NOT NULL,
  EMAIL         VARCHAR2(200 BYTE)              NOT NULL,
  PHONE         VARCHAR2(100 BYTE)              NOT NULL,
  STATUS        VARCHAR2(50 BYTE)               DEFAULT 'A'        NOT NULL,
  RECORDSTATUS  VARCHAR2(50 BYTE)               DEFAULT 'A'        NOT NULL,
  INSERTDATE    DATE                            NOT NULL,
  INSERTEDBY    NUMBER                          NOT NULL
)

Upvotes: 1

Views: 590

Answers (1)

sameh.q
sameh.q

Reputation: 1709

Your problem is with SYSDATE(), it don't take parenthesis!

It should be used only as SYSDATE, without ()

Correct use:

SELECT SYSDATE FROM DUAL;

Your use:

SELECT SYSDATE() FROM DUAL;

Upvotes: 6

Related Questions