On 2016/07/16 2:04 PM, Ertan Küçükoğlu wrote:
Hi everyone,

It turns out to be my mistake. I did find out that Values in FIS table do
really has a value of 6.0. Sorry for all the fuss.

Thanks.

No problem. I would also suggest, just as a matter of form and having correct expectations, that you change all the types you specified as "Float" rather to REAL, change Integer and smallint to just INT and any Char(xx) to just TEXT. (and in case you ever add dates, make them NUMERIC).

SQLite doesn't have types - it's an un-typed construct, but uses "column affinity" - which simply means a column will behave as if it has entries with that kind of value in it, unless you specifically put something else in there or read it as a different type.

SQLite will translate these types you have correctly into its internal affinity types as far as I know, but the ones I mentioned above are the precise affinities SQLite will use, and the reason I suggest it is that if you expect a column to behave as TEXT rather than CHAR(20), you will not be disappointed. If you expect it to behave like CHAR(20) - i.e. limit values you add to 20 characters, or error out when you do, or right-pad spaces up to 20 characters - then you will be very disappointed - because it simply won't do any of that. (You can still enforce any or all of these rules using CHECK constraints - feel free to ask if you need more information)

See the SQLite documentation on types here:
https://www.sqlite.org/datatype3.html


Good luck!
Ryan




-----Original Message-----
From: sqlite-users-boun...@mailinglists.sqlite.org
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Ertan
Küçükoğlu
Sent: Saturday, July 16, 2016 12:32 PM
To: 'SQLite mailing list' <sqlite-users@mailinglists.sqlite.org>
Subject: [sqlite] insert into not inserting float values as expected

Hello,

I have below table definitons:

CREATE TABLE IF NOT EXISTS FIS(

   ID                  Integer  NOT NULL PRIMARY KEY AUTOINCREMENT,

   Barkod              Char(20) COLLATE NOCASE NOT NULL,

   BarkodAciklamasi    Char(50) COLLATE NOCASE,

   UrunKodu            Char(20) COLLATE NOCASE,

   UrunAciklamasi      Char(50) COLLATE NOCASE,

   KisaAd              Char(15) COLLATE NOCASE,

   GrupKodu            Char(20) COLLATE NOCASE,

   KdvOran             Integer  not null check(KdvOran >= 0),

   Miktar              Float    not null,

   Birim               Char(10) not null COLLATE NOCASE,

   OrjinalBirimFiyat   Float    not null check(OrjinalBirimFiyat >= 0),

   KartBirimFiyat      Float    not null check(KartBirimFiyat >= 0),

   TeraziBirimFiyat    Float    not null check(TeraziBirimFiyat >= 0),

   IndirimliBirimFiyat Float    not null check(IndirimliBirimFiyat >= 0),

   PromosyonBirimFiyat Float    not null check(PromosyonBirimFiyat >= 0),

   BirimFiyat          Float    not null check(BirimFiyat >= 0),

   Tutar               Float    not null,

   Kasiyer             Char(20) not null COLLATE NOCASE,

   OturumID            SmallInt not null

);



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to