SQLite Forum

The NUMERIC data type?
Login
All "values" in SQLite3 (that is, at the intersection of any row and column) may contain data of any of the following datatypes:

 - INTEGER, a 64-bit signed integer  
 - REAL, a 64-bit IEEE-754 floating point number  
 - TEXT, a bag-o-bytes that conforms to C String semantics containing UTF-8 or UTF-16 encoded data  
 - BLOB, a bag-o-bytes that is nothing more than a bunch of bytes  
 - NULL, a value that equals nothing else, not even itself, and is none of the above

There is an invisible line between your application and the SQLite3 library.  You communicate across this line using the various sqlite3_bind* calls (send an application data item to SQLite3), sqlite3_column* (retrieve a column value from SQLite3 into your application), and for User Defined Functions you use the sqlite3_value* interfaces to retrieve parameter values into your application code, and sqlite3_result* interfaces to send data from you application code back to the SQLite3 library.

For the column and value interfaces there is also the sqlite3_*_type API, which will allow you to query what datatype (from the aforementioned list) SQLite3 is using to store the particular value.

Each of these has a number of subinterface types _int, _int64, _double, _text, _text16, _blob, _blob64, _null depending on YOUR APPLICATION datatype (long, long long, double, char*, wchar*, unsigned char*, unsigned char* or nothing, that YOUR code is sending from or receiving into.

SQLite3 will automatically "convert" YOUR APPLICATION datatype to the internal type required.  You can also use arbitrary datatypes such as FESTERING GIRAFFE POOP which will have its AFFINITY determined by scanning the specified string for clues (see the web page below).

A type of NUMERIC is not a datatype, NUMERIC is an affinity.  It means either INTEGER or REAL as may be appropriate for the circumstances.  SQLite3 also completely ignores anything you put in ornamentation such as brackets following the type name.

So the answer to your question has nothing whatsoever to do with SQLite3, but rather with your application.  If the data is stored/to be stored into a double, then you would use the sqlite3_*_double interfaces.  If the application variable was a 64-bit signed integer, then you would use the sqlite3_*_int64 interfaces.  And so on and so forth.

See <https://sqlite.org/datatype3.html> for information on how data is handled once it crosses the invisible line between your application and SQLite3.