On 2018/07/27 10:38 AM, Bart Smissaert wrote:
Have a  table like this:

create table sql_replace(string_old text, string_new text)

The idea is to do automatic string replacements in SQL.
Say we have this SQL:

select * from table1 where a in(xxx)

then after the string replacement it should be this:

select * from table1 where a in('A', 'B', 'C')

Having some  trouble inserting the 2 strings, xxx and 'A', 'B', 'C'
in the table. Tried various constructions, but getting errors. I can see
this will
be a lot easier to do in code with place holders and bound values, but in
this
case I need to do it with direct SQL in an Android phone app.

Any advice how to do this in direct SQL?

This question is not clear.

what does xxx mean? is it an identifier? a constant? a string?
Whatever it is, once resolved, is it a set of strings, or a single string?

There is no way to change "...WHERE identifier IN (identifier)" into "...WHERE identifier IN (identifier, identifier, ...)" via string replacement or any other method.

If 'A,B,C' is meant to be a single string, then the "instr()" function would get better results than "IN ()".

It's possible that I'm simply completely wrong about what you mean though, could you perhaps give 2 examples of the exact syntax you intend before and after the replacement (i.e. what exactly will "xxx" be in your example)?


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to