I'm new to Oracle SQL; currently I'm trying to build a basic database and I'm running into a missing parenthesis error on my create table statements.
CREATE TABLE Employees ( EmployeeID NUMBER(8,0) NOT NULL, LastName VARCHAR2(20) NOT NULL, FirstName VARCHAR2(10) NOT NULL, Title VARCHAR2(30), TitleOfCourtesy VARCHAR2(25), Birthdate DATE(7), HireDate DATE(7), Address VARCHAR2(60), City VARCHAR2(15), Region VARCHAR2(15), PostalCode VARCHAR2(10), Country VARCHAR2(15), HomePhone VARCHAR2(24), Extension VARCHAR2(4), Notes VARCHAR2(600), Reportsto NUMBER(22, 8), PhotoPath VARCHAR2(255), CONSTRAINT Employees_EmployeeID_pk PRIMARY KEY(EmployeeID) )
The second table here might be related to something with the keys, but I can't seem to figure out where.
CREATE TABLE Orders( OrderID NUMBER(22,8) NOT NULL, CustomerID CHAR(5), EmployeeID NUMBER(22), TerritoryID VARCHAR2(20), OrderDate DATE(7), RequiredDate DATE(7), ShippedDate DATE(7), ShipVia NUMBER(22,8,0), Freight NUMBER(22,8,2), ShipName VARCHAR2(40), ShipAddress VARCHAR2(60), ShipCity VARCHAR2(15), ShipRegion VARCHAR2(15), ShipPostalCode VARCHAR2(10), ShipCountry VARCHAR2(15), CONSTRAINT Orders_OrderID_pk PRIMARY KEY(OrderID) )
I'm sorry if this question has been asked before, but the error code that oracle throws at me isn't telling me what's wrong or how I could potentially fix it. I seem to be limited by my own knowledge.
Any help appriciated.
EDIT: Fixed my issue, had to remove precision from date, and remove the 3rd variable from NUMBER.sqloracle
EMPLOYEES: remove "precision" from DATE columns.
ORDERS: the same; also, check NUMBER data types (what is (22, 8, 2) supposed to be)?
When working with Oracle, your tool might be able to give you a clue, before you even run your DDL/statement.
For example, in Oracle SQL Developer, our parser caught your two boo-boo's with the DATE column definition.
See the squiggley pink line - that's where the parser sees something that it doesn't expect to see. That's your HINT as to where exactly your problem is.
I know that's hard to see, so here's a close-up:
When you mouse over the warning, we try to assist with some syntax doc links, and expected next words.