Marcus
Marcus

Reputation: 3869

ORA-01722: invalid number for Number datatype in oracle

I am trying to insert a value in KPI_DEFINITION table and i am getting amn error ORA-01722: invalid number. The error is for KPI_FREQUENCY field which NUMBER datatype and it has trying to insert value '0,5'. I think number datatype allows integer as well as float values. But still its giving an error.

Insert into RATOR_MONITORING_CONFIGURATION.KPI_DEFINITION (KPI_DEF_ID,KPI_NAME,KPI_DESC,KPI_FREQUENCY) values ('10003881','Backlog Resul11t','Backlog Result11','0,5');

Upvotes: 0

Views: 3552

Answers (2)

Tharunkumar Reddy
Tharunkumar Reddy

Reputation: 2813

Possible data type for KPI_FREQUENCY in your case is number(2,1)
Modification of your insert statement

Insert into  RATOR_MONITORING_CONFIGURATION.KPI_DEFINITION (KPI_DEF_ID,KPI_NAME,KPI_DESC,KPI_FREQUENCY) 
    values ('10003881','Backlog Resul11t','Backlog Result11',0.5);

Upvotes: 2

user330315
user330315

Reputation:

In SQL numbers are not specified using single quotes.

Additionally: fractional digits are separated using a dot . not a comma. So you need to write this as:

Insert into RATOR_MONITORING_CONFIGURATION.KPI_DEFINITION 
  (KPI_DEF_ID,KPI_NAME,KPI_DESC,KPI_FREQUENCY) 
values 
  ('10003881','Backlog Resul11t','Backlog Result11', 0.5);
                                                      ^
                                                      Here

If KPI_DEF_ID is also a number column, remove the single quotes for that value as well:

For a complete documentation on how to specify numbers or string literals, please see the manual:

https://docs.oracle.com/database/121/SQLRF/sql_elements003.htm#i139891

Upvotes: 2

Related Questions