Odd question

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Odd question

Larry Brasfield
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
​> ​
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.​

Larry Brasfield
sqlite-users mailing list
[hidden email]