Patrick
Patrick

Reputation: 73

round off column value in postgresql

I'm trying to round off column value with 2 decimal places.

create table ABC("NUM" real);----------created table

insert into ABC values(22.567333335555555); ---------inserted values

however I tried this query

select ROUND("NUM:,2) from ABC;

And getting the below Error message

ERROR:  function round(real, integer) does not exist
LINE 1:  select ROUND("NUM",2) from ABC;

I want to display the Answer should be two decimal value like as

NUM
-----
22.56

Upvotes: 4

Views: 8681

Answers (1)

PSR
PSR

Reputation: 40318

Try this it is working for me

 SELECT round( CAST("NUM" as numeric), 2) FROM ABC;

Upvotes: 11

Related Questions