Search code examples
functiontemp-tablessqlitestudio

create temp table in sqlite function


I have function in sqlite and I want to use temp table for declaring variables in this function. when I use this query out of function, it works, but use it inside function, returns null value.

problem is cause of using temp table in function. what shold I do?

this is the code:

create temp table if not exists tmp(output varchar);

delete from tmp;
insert into tmp(output) values(@arg);

select output from tmp;

Solution

  • The SQLiteStudio documentation says:

    Custom SQL functions created in SQLiteStudio exist only in context of SQLiteStudio. [...] If you want to use some function in your own application, you have to register that function in SQLite from your application.