I want to update the Interest field in my database. My SQL query is like as per below
Update Table_Name set Interest = Principal * Power(( 1 + (rate /
100),year)
This query works fine in MySQL but don’t work with SQLite.
The error says that No Power funcation found
Does anyone know how to resolve this problem as I have to do this using query to update more than 3000 records at a time.
SQLite doesn’t have a lot of functions available. But the good news is that is easy enough to add your own.
Here’s how to do it using the C API (which also works from Objective-C code).
First write a power function:
Then you need to register the function:
The
2is the number of arguments for the function.dbRefis of course thesqlite3 *database reference.