How to create custom functions in SQLite


Sqlite Problem Overview

Can you create functions in SQLite like you can in MSSQL?

If so, how? What is the syntax?


Sqlite Solutions

Solution 1 - Sqlite

SQLite does not have a stored function/stored procedure language. So CREATE FUNCTION does not work. What you can do though is map functions from a c library to SQL functions (user-defined functions). To do that, use SQLite's C API (see:

If you're not using the C API, your wrapper API may define something that allows you access to this feature, see for example:

Solution 2 - Sqlite

This could be useful to many: in SQLiteStudio it is possible to define new functions and collations easily from interface through a sql built-in plugin for example.

Through the function editor.


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndrew BullockView Question on Stackoverflow
Solution 1 - SqliteRoland BoumanView Answer on Stackoverflow
Solution 2 - SqlitedonnadulcineaView Answer on Stackoverflow