{"id":1108,"date":"2015-02-05T11:58:20","date_gmt":"2015-02-05T10:58:20","guid":{"rendered":"http:\/\/www.speich.net\/articles\/?p=1108"},"modified":"2019-11-16T18:06:01","modified_gmt":"2019-11-16T17:06:01","slug":"sql-tip-update-add-instead-of-replace","status":"publish","type":"post","link":"https:\/\/www.speich.net\/articles\/en\/2015\/02\/05\/sql-tip-update-add-instead-of-replace\/","title":{"rendered":"SQL tip: Update add instead of replace"},"content":{"rendered":"\n<p>A simple way to add to a database record instead of replacing it with Oracle:<\/p>\n\n\n\n<pre><code class=\"language-sql\">UPDATE myTable SET textField = :text||textField WHERE ...<\/code><\/pre>\n\n\n\n<p>This comes in handy, when you have a form field, which can be empty, but should not overwrite an existing record when posted (This should also be easily adapted to other SQL dialects).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A simple way to add to a database record instead of replacing it with Oracle: UPDATE myTable SET textField = :text||textField WHERE &#8230; This comes in handy, when you have a form field, which can be empty, but should not overwrite an existing record when posted (This should also be easily adapted to other SQL &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.speich.net\/articles\/en\/2015\/02\/05\/sql-tip-update-add-instead-of-replace\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;SQL tip: Update add instead of replace&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[281],"tags":[69,81],"class_list":["post-1108","post","type-post","status-publish","format-standard","hentry","category-sql","tag-oracle","tag-sql","entry"],"_links":{"self":[{"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/posts\/1108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/comments?post=1108"}],"version-history":[{"count":2,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/posts\/1108\/revisions"}],"predecessor-version":[{"id":1666,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/posts\/1108\/revisions\/1666"}],"wp:attachment":[{"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/media?parent=1108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/categories?post=1108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/tags?post=1108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}