Nelson, Erik - 2
​, on​
Sat, 16 Dec 2017 11:54:06
​, 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?

​No. Data and schema modification operations return no data from the DB.
(Data modification operations​ return a count of affected rows, but even
that is not available as part of a query.)

​What you probably want is to use a transaction.  That's a guess because
you have not explained your real problem -- only how you imagine you might
solve it.  You'll get better help, and viable alternatives, if you explain
what you are trying to do.​

​Cheers,
--
Larry Brasfield
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to