Home > Back-end >  oracle : Missing right parenthesis
oracle : Missing right parenthesis

Time:09-16

I have a problem, I don't understand why do I have this error

Here's the code

        CREATE TABLE Deposit
        (   ac_no Int(15),
        customer_name Varchar(35),
        branch_name Varchar(30),
        Amount Int(10,2),
        credit_date Date
        );

CodePudding user response:

Because integers don't have size nor precision.

Also, use VARCHAR2 instead of VARCHAR (that's not an error, but Oracle recommends so).

SQL> CREATE TABLE deposit
  2  (
  3     ac_no           INT,
  4     customer_name   VARCHAR2 (35),
  5     branch_name     VARCHAR2 (30),
  6     amount          INT,
  7     credit_date     DATE
  8  );

Table created.

SQL>

CodePudding user response:

As @Littlefoot already said, INT data type has no precision or scale. If you want precision and scale in your numbers, then use number data type instead.

SQL> CREATE TABLE deposit
  2  (
  3     ac_no           number(15),
  4     customer_name   VARCHAR2 (35),
  5     branch_name     VARCHAR2 (30),
  6     amount          number(10,2),
  7     credit_date     DATE
  8  );

Table created.

SQL>
  • Related