Question
· Oct 16, 2017

casting of the extracted value in sql

Hi World

I've a problem when in extract a float value from my database

the problem is that i get  an interger instead of  float.

my record is 2,56 but when i do a select , the request extract only 2

can you have a solution  for it.

thank you

Discussion (4)1
Log in or sign up to continue
Class dc.demo Extends %Persistent
{

Property ChildPrice As %Library.Float;

ClassMethod Test()
{
  ;d ##class(dc.demo).Test()

  ..%KillExtent()
  obj=..%New()
  obj.ChildPrice=2.56
  obj.%Save()
  
  &sql(select ChildPrice into :ChildPrice from dc.demo where %ID=1)
  ChildPrice,!
}

}

My result:
USER>##class(dc.demo).Test()
2.56

What will be the result you have?
Also check the settings for the format of the data types in your tool (DbVisualizer, Caché Monitor, WinSQL, SQuirreL SQL, etc.), in which you make a selection.