Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 7.3.14) Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Please visit http://www.swi-prolog.org for details. For help, use ?- help(Topic). or ?- apropos(Word). 1 ?- open_db. true. 2 ?- query_db(R). false. % OK nothing in tabe : test_table 3 ?- insert_1(Res). Res = affected(1). % works fine 4 ?- query_db(R). R = row(1, jab, 123456). 5 ?- insert_2(Res). % works fine Res = affected(1). 6 ?- query_db(R). R = row(1, jab, 123456) ; R = row(2, jab2, 6457). 7 ?- insert_3(Res). % the second col value is double_quoted "Patricia" Error may_be 'normal' ERROR: ODBC: State S0022: [MySQL][ODBC 5.3(a) Driver][mysqld-5.7.11-log]Unknown column 'Patricia' in 'field list' 8 ?- insert_4(4,jab,5,Res). % trying to insert a atom as value for second col ERROR: ODBC: State S0022: [MySQL][ODBC 5.3(a) Driver][mysqld-5.7.11-log]Unknown column 'jab' in 'field list' % the expected behaviour is to be able to insert an atom as a value for a VARCHAR % and not to have to quote it to : '"wathever_the_value_is"' (see #10 in this log) 9 ?- insert_4(4,"jab",5,Res). ERROR: ODBC: State S0022: [MySQL][ODBC 5.3(a) Driver][mysqld-5.7.11-log]Unknown column 'jab' in 'field list' 10 ?- insert_4(4,'"jab"',5,Res). Res = affected(1). 11 ?- query_db(R). R = row(1, jab, 123456) ; R = row(2, jab2, 6457) ; R = row(4, jab, 5). 12 ?- insert_4(5,5555,55,Res). Res = affected(1). 13 ?- query_db(R). R = row(1, jab, 123456) ; R = row(2, jab2, 6457) ; R = row(4, jab, 5) ; R = row(5, '5555', 55). 14 ?- insert_4(44,'jabel',444,R). % even trying to insert a string ==> error ERROR: ODBC: State S0022: [MySQL][ODBC 5.3(a) Driver][mysqld-5.7.11-log]Unknown column 'jabel' in 'field list' % using a double conversion before insert is a work around. But a little bit weird 15 ?- insert_5(6,654321,654,Res). Res = affected(1). 16 ?- query_db(R). R = row(1, jab, 123456) ; R = row(2, jab2, 6457) ; R = row(4, jab, 5) ; R = row(5, '5555', 55) ; R = row(6, '654321', 654). 17 ?- insert_5(7,7654321,7654,Res). Res = affected(1). 18 ?- insert_5(8,jab,87654,Res). % Yes it works for an atom Res = affected(1). 19 ?- query_db(R). R = row(1, jab, 123456) ; R = row(2, jab2, 6457) ; R = row(4, jab, 5) ; R = row(5, '5555', 55) ; R = row(6, '654321', 654) ; R = row(7, '7654321', 7654) ; R = row(8, jab, 87654).