I cannot figure out the syntax issue with the following code. When I run it, I get error
ORA-00907: missing right parenthesis
Can anyone point out my flaw please?
CREATE OR REPLACE VIEW LATESTAPPLICATIONS AS
SELECT *
FROM application_history
WHERE entry_time IN
(SELECT entry_time
FROM application_history
GROUP BY application_number; )
ORDER BY entry_number;
Here is the table definition for application_history
. I ideally want to only view application numbers with the latest time-stamps.
CREATE TABLE "APPLICATION_HISTORY"
( "ENTRY_NUMBER" NUMBER(28,0),
"APPLICATION_NUMBER" NUMBER(16,0) CONSTRAINT "APP_NUM_NN" NOT NULL ENABLE,
"ACTIVE" CHAR(1) DEFAULT 0 CONSTRAINT "ACTIVE_NN" NOT NULL ENABLE,
"STATUS" VARCHAR2(40) DEFAULT 'APPLICATION ENTERED' CONSTRAINT "STATUS_NN" NOT NULL ENABLE,
"DATE_APPROVED" DATE,
"DATE_APPLIED" DATE DEFAULT SYSDATE CONSTRAINT "DATE_APPLIED_NN" NOT NULL ENABLE,
"ENTRY_TIME" TIMESTAMP (6) DEFAULT SYSDATE,
CONSTRAINT "ENTRY_NUM_PK" PRIMARY KEY ("ENTRY_NUMBER")
USING INDEX ENABLE
)
You have a semi-colon at the last but 1 line. GROUP BY application_number; )
Remove it and you should be fine.
Semi-colon acts as the query terminator in Oracle, as you had placed it before the ) Oracle could not find it.