On 2017/12/16 9:53 PM, Nelson, Erik - 2 wrote:
For unfortunate reasons, I need a query that does an insert and also returns at 
least one row... for example, something along the lines of

Select 1 as value from (insert into table1 values(a, b, c))

Or

Select coalesce((insert into table1 values(a, b, c)), 1) as value

I've tried a number of options but haven't been able to get anything to work.  
Is it possible?

That is not possible, and certainly not part of the spirit or letter of the SQL Standard, and not done by any of the standard SQL Engines. (However, I think in MySQL there exists a way to to do it - but I'm not 100% sure).

May I ask what are the "unfortunate reasons"?  Perhaps someone here had/have a similar scenario and can assist - but the way you are trying to solve your problem will almost certainly not work (unless perhaps through forking and fudging the SQLite code itself, but that is a different can of worms and must be a very last resort...)

Cheers,
Ryan

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

Reply via email to