1

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 ); 
2
  • 2
    INT(10,2) looks very suspicious. Could you please try NUMERIC(10,2) Commented Sep 15, 2021 at 7:07
  • int is a synonym for number(38). Also by definition int is an integer number, it even cannot have a scale. Commented Sep 15, 2021 at 8:18

2 Answers 2

6

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> 
Sign up to request clarification or add additional context in comments.

Comments

3

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> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.