{"Entry":{"collection":"func","key":"nullif","name":"NULLIF","aliases":[],"metadata":{"changed_in":[],"changes":[{"descriptions_changed":true,"doc_overhaul":false,"from":"7.2","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"7.3"},{"descriptions_changed":true,"doc_overhaul":false,"from":"8.0","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"8.1"},{"descriptions_changed":true,"doc_overhaul":false,"from":"8.3","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"8.4"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"b6882c5ecaa46990803c82dcbfeaf1abf1d46298ebeb323d831d6b7bb92780e0","derived_content_hash":"5be8a5f70b57fc1e25930745e66bc4c24b761e08625974034991205f6ad800fb","first_version":"7.1","group":"conditional","group_label":"Conditional Expressions","groups":["conditional"],"imported_at":"2026-09-27T17:57:28.861254+08:00","last_version":"20","name":"NULLIF","name_key":"nullif","position":18003,"present_in":["7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"b7bd9cda","receipt_sha256":"0d15971b853e83c0825a649c649e9015a80ba7435ffa552e5cc7fd8447cd9e7d","repair":"wiki-repair-20261023"},"signature":"NULLIF(value1, value2)","signature_count":1,"slug":"nullif","source_rev":"wiki-repair-20261023:daf860680354c62c9cb40463130eb135b0d8edadefa706973559d4afcf598405","summary":"The NULLIF function returns a null value if value1 equals value2; otherwise it returns value1.","summary_zh":""}},"Definition":{"Collection":"func","Key":"nullif","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"nullif","SourceRevision":"wiki-repair-20261023:daf860680354c62c9cb40463130eb135b0d8edadefa706973559d4afcf598405","Facts":{"description":"The NULLIF function returns a null value if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE example given above:","description_html":"The \u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e function returns a null value if \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e equals \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e; otherwise it returns \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e. This can be used to perform the inverse operation of the \u003ccode class=\"function\"\u003eCOALESCE\u003c/code\u003e example given above:","description_zh":"当 value1 和 value2 相等时，NULLIF 返回 null。否则它返回 value1。这可以用于执行前文给出的 COALESCE 示例的逆操作：","description_zh_html":"当 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e 相等时，\u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e 返回 null。否则它返回 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e。这可以用于执行前文给出的 \u003ccode class=\"function\"\u003eCOALESCE\u003c/code\u003e 示例的逆操作：","doc":{"anchor":"FUNCTIONS-NULLIF","file":"functions-conditional.html","slug":"18"},"group":"conditional","group_label":"Conditional Expressions","lang":"en","layout":"table-new","pages":["functions-conditional.html"],"prose_only":false,"signatures":[{"description":"The NULLIF function returns a null value if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE example given above:","description_html":"The \u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e function returns a null value if \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e equals \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e; otherwise it returns \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e. This can be used to perform the inverse operation of the \u003ccode class=\"function\"\u003eCOALESCE\u003c/code\u003e example given above:","description_zh":"当 value1 和 value2 相等时，NULLIF 返回 null。否则它返回 value1。这可以用于执行前文给出的 COALESCE 示例的逆操作：","description_zh_html":"当 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e 相等时，\u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e 返回 null。否则它返回 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e。这可以用于执行前文给出的 \u003ccode class=\"function\"\u003eCOALESCE\u003c/code\u003e 示例的逆操作：","examples":[],"html":"\u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e)","returns":"","text":"NULLIF(value1, value2)","zh_from":"same-version-pgdoc"}],"translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/functions-conditional.html","sha256":"d64886927461000afd7c15ad2f1983cd4a12f85a8207144d9f72a6668d65132f"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-NULLIF","file":"functions-conditional.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"nullif","SourceDatabase":"center","Version":"18","Locale":"en","Title":"NULLIF","Summary":"The NULLIF function returns a null value if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE example given above:","BodyHTML":"The \u003ccode\u003eNULLIF\u003c/code\u003e function returns a null value if \u003cem\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e equals \u003cem\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e; otherwise it returns \u003cem\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e. This can be used to perform the inverse operation of the \u003ccode\u003eCOALESCE\u003c/code\u003e example given above:","SourceRevision":"wiki-repair-20261023:daf860680354c62c9cb40463130eb135b0d8edadefa706973559d4afcf598405","ContentHash":"973a32f18f7188d847b8384f11b2e1566fef6a4a202d47c523b963d7987b0dbd","Payload":{"description":"The NULLIF function returns a null value if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE example given above:","description_html":"The \u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e function returns a null value if \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e equals \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e; otherwise it returns \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e. This can be used to perform the inverse operation of the \u003ccode class=\"function\"\u003eCOALESCE\u003c/code\u003e example given above:","signatures":[{"description":"The NULLIF function returns a null value if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE example given above:","description_html":"The \u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e function returns a null value if \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e equals \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e; otherwise it returns \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e. This can be used to perform the inverse operation of the \u003ccode class=\"function\"\u003eCOALESCE\u003c/code\u003e example given above:","description_zh":"当 value1 和 value2 相等时，NULLIF 返回 null。否则它返回 value1。这可以用于执行前文给出的 COALESCE 示例的逆操作：","description_zh_html":"当 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e 相等时，\u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e 返回 null。否则它返回 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e。这可以用于执行前文给出的 \u003ccode class=\"function\"\u003eCOALESCE\u003c/code\u003e 示例的逆操作：","examples":[],"html":"\u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e)","returns":"","text":"NULLIF(value1, value2)","zh_from":"same-version-pgdoc"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"6b46d6ffb555c28b01883b360be263d3afb5ff45572d8ba1813f6189904decdc","Text":"NULLIF(value1, value2)","Returns":"","Payload":{"description":"The NULLIF function returns a null value if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE example given above:","description_html":"The \u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e function returns a null value if \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e equals \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e; otherwise it returns \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e. This can be used to perform the inverse operation of the \u003ccode class=\"function\"\u003eCOALESCE\u003c/code\u003e example given above:","description_zh":"当 value1 和 value2 相等时，NULLIF 返回 null。否则它返回 value1。这可以用于执行前文给出的 COALESCE 示例的逆操作：","description_zh_html":"当 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e 相等时，\u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e 返回 null。否则它返回 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e。这可以用于执行前文给出的 \u003ccode class=\"function\"\u003eCOALESCE\u003c/code\u003e 示例的逆操作：","examples":[],"html":"\u003ccode class=\"function\"\u003eNULLIF\u003c/code\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue1\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue2\u003c/code\u003e\u003c/em\u003e)","returns":"","text":"NULLIF(value1, value2)","zh_from":"same-version-pgdoc"}}],"Spellings":null,"SQLState":null,"Evidence":null}
