SQLite没有left函数,而且left貌似是SQLite的保留字,因为我用sqlite3_create_function创建一个名为left的自定义函数,调试发现sqlite3_create_function函数返回0,即创建成功了。但我无论如何都调用不了: select left(Name,3) from exam_tbl where id=1; 一调执行上述SQL语句便返回near "(":syntax error错误。而如果我换一个名字,例如lefta便可以。 顺便提一下,SQLite有一个substr函数,可以用来代替left: select substr(Name,1,3) from exam_tbl where id=1
select left(Name,3) from exam_tbl where id=1;
一调执行上述SQL语句便返回near "(":syntax error错误。而如果我换一个名字,例如lefta便可以。
顺便提一下,SQLite有一个substr函数,可以用来代替left:
select substr(Name,1,3) from exam_tbl where id=1