Null (SQL): Difference between revisions

Content deleted Content added
Monkbot (talk | contribs)
m Task 18 (cosmetic): eval 34 templates: hyphenate params (6×);
m Enum 1 author/editor WL; WP:GenFixes on
Line 691:
 
=== NVL ===
{{redirectRedirect|NVL|the gene|NVL (gene)}}
The Oracle <code>NVL</code> function accepts two parameters. It returns the first non-NULL parameter or NULL if all parameters are NULL.
 
Line 711:
== Data typing of Null and Unknown ==
{{See also|Option type|Nullable type}}
The <code>NULL</code> [[Literal (computer programming)|literal]] is untyped in SQL, meaning that it is not designated as an integer, character, or any other specific [[data type]].<ref name="Understanding1999">{{cite book|author1=[[Jim Melton]]|author-link=Jim Melton|author2=Alan R. Simon|title=SQL:1999: Understanding Relational Language Components|year=2002|publisher=Morgan Kaufmann|isbn=978-1-55860-456-8|page=[https://archive.org/details/sql1999understan0000melt/page/53 53]|url=https://archive.org/details/sql1999understan0000melt/page/53}}</ref> Because of this, it is sometimes mandatory (or desirable) to explicitly convert Nulls to a specific data type. For instance, if [[Function overloading|overloaded]] functions are supported by the RDBMS, SQL might not be able to automatically resolve to the correct function without knowing the data types of all parameters, including those for which Null is passed.
 
Conversion from the <code>NULL</code> literal to a Null of a specific type is possible using the <code>CAST</code> introduced in [[SQL-92]]. For example: