MySQL Forums
Forum List  »  Connector/Node.js

JSON member type
Posted by: nikos dostipy
Date: February 23, 2016 04:55AM

Hi all,
please could you anyone help me with storing JSON members to a database:
I created a record in table as follows:

INSERT INTO _TEST (TYPEJSON) VALUES (
cast(
'{"NTYPEINT": null, "NTYPEBIT": null, "NTYPEVARCHAR": null,
"VTYPEINT": 99, "VTYPEBIT": true, "VTYPEVARCHAR": "XYZ",
"VTYPEBIT2": 1}'
as JSON)
);

I have in this table field named TYPEBIT type BIT.
I try update this field (current value NULL) as follows:

UPDATE _TEST SET TYPEBIT = JSON_EXTRACT(TYPEJSON, '$.VTYPEBIT') WHERE ID = 1;

but I get this Error: Error Code: 1406. Data too long for column 'TYPEBIT' at row 1

JSON_TYPE(JSON_EXTRACT(TYPEJSON, '$.VTYPEBIT')) returns BOOLEAN

How to perform this update - where is the problem?

Thanks a lot, nikos

Options: ReplyQuote


Subject
Written By
Posted
JSON member type
February 23, 2016 04:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.