Search code examples
sqliteandroid-sqlitespatialite

CastToDouble Spatialite doesn't cast negative numbers


I am using a spatialite database. I need to cast to double a negative number (this number is a text).

When I do SELECT CastToDouble("-5.84"), I get a NULL..

How can i Cast a negative number , in text format, to a Double?

Thanks!


Solution

  • Just use SQLite's built-in cast expression:

    SELECT CAST('-5.84' AS REAL)