Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confusing error about missing left parenthesis in SQL statement

Tags:

sql

oracle

SQLPLUS says I have missing left parenthesis with this statement in my sql script..

CREATE TABLE people(
    id INT NOT NULL PRIMARY KEY,
    name VARCHAR2
);

I had uploaded my script with sftp, could that have played around with the script?

like image 625
fenerlitk Avatar asked Apr 17 '12 19:04

fenerlitk


People also ask

How do you solve missing left parentheses in SQL?

ORA-00906: missing left parenthesis Parentheses also are required around subqueries in WHERE clauses and in UPDATE table SET column = (SELECT...) statements. Action: Correct the syntax, inserting a left parenthesis where required, and retry the statement.

How do you solve missing right parentheses in SQL?

To correct this error, you must find the part of code that contains the missing right parenthesis, insert the missing symbol in the correct spot, and run the statement again.

What does missing right parenthesis mean in SQL?

ORA-00907: missing right parenthesis error occurs when a left parenthesis is used without a right parenthesis to close it in SQL statements such as create table, insert, select, subquery, and IN clause. The right parenthesis is missing. All parentheses must be used in pairs.

What is invalid identifier in SQL?

Ora-00904 Error Message “Invalid Identifier” Error Ora-00904 means you are attempting to execute an SQL statement that is one of the following: The SQL statement includes an invalid column name. The SQL statement includes a column name which does not currently exist.


1 Answers

VARCHAR2 is a type that needs a maximum size/length. Try something like...

varchar2(50)

Your missing left parenthesis is the parenthesis that surrounds the size.

CREATE TABLE people(
    id INT NOT NULL PRIMARY KEY,
    name VARCHAR2(50) 
);
like image 139
Sam DeHaan Avatar answered Oct 09 '22 05:10

Sam DeHaan