SELECT or INSERT a row in one command

前端 未结 4 1920
囚心锁ツ
囚心锁ツ 2020-12-07 20:28

I\'m using PostgreSQL 9.0 and I have a table with just an artificial key (auto-incrementing sequence) and another unique key. (Yes, there is a reason for this table. :)) I w

4条回答
  •  既然无缘
    2020-12-07 21:15

    No, there is no special SQL syntax that allows you to do select or insert. You can do what Ilia mentions and create a sproc, which means it will not do a round trip fromt he client to server, but it will still result in two queries (three actually, if you count the sproc itself).

提交回复
热议问题