Error in rsqlite_send_query(conn@ptr, statement) :

2019-08-04 11:12发布

问题:

The following line of code:

sqldf("UPDATE q1_sql_1 SET MONTH_YEAR = RIGHT(MONTH_YEAR, LEN(MONTH_YEAR) - 4)")

Shows this error:

Error in rsqlite_send_query(conn@ptr, statement) : near "(": syntax error

回答1:

Use length and rightstr. For the functions available in SQLite see:

https://www.sqlite.org/lang_corefunc.html

and for the contributed functions that RSQLite also makes available:

https://github.com/ggrothendieck/sqldf#example-15-use-of-rsqliteextfuns-library-functions