Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
I already have a table whose name is EMP_DETAILS. It has 3 column, one is NAME (VARCHAR2(150)), EMP_ID(NUMBERS(5,0)) and another one is SALARY(INTEGER(5,0)). I want to alter the datatype of column SALARY to FLOAT.

Primary Key is EMP_ID.

For that t wrote a query which is, ALTER TABLE EMP_DETAILS MODIFY SALARY float(5,0);

When ever I want to insert some value into this table I didn't insert any value into this.

Actually I want to Know what is the syntax to get the float value.
Posted
Updated 15-Dec-14 4:51am
v5
Comments
DamithSL 15-Dec-14 10:11am    
do you have unique or primary key in EMP_DETAILS table?
ZurdoDev 15-Dec-14 10:40am    
The error seems pretty clear. You're trying to insert duplicate data. So, what is the question exactly?
Bittu14 15-Dec-14 10:49am    
Yes I know that. But I tried the bellow query:

ALTER TABLE EMP_DETAILS
MODIFY SALARY float(5,0);

Is there is any syntactical error?
ZurdoDev 15-Dec-14 10:50am    
What happens when you try to do this?
Bittu14 15-Dec-14 10:53am    
Then the error was occurred. That is:
Error starting at line : 37 in command -
ALTER TABLE EMP_DETAILS
MODIFY SALARY float (5,0)
Error report -
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:

1 solution

Note, that FLOAT is a floating-point number with a binary precision, so you can't set the number of digits before and after the decimal.
See:
https://docs.oracle.com/cd/B28359_01/server.111/b28285/sqlqr06.htm#CHDJJEEA[^]
http://psoug.org/definition/FLOAT.htm[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900