Questions tagged [nvl]

`nvl` is a SQL function present in its vendor-specific implementation by Oracle. It takes two arguments, and returns the first argument if it's non-null, and otherwise returns the second. It's similar to the function `coalesce` in standard SQL.

Questions having this tag should probably also be tagged with and/or , as well as and the corresponding version tag, as explained here.

Syntax:

nvl(expr1, expr2)

Return value: expr1 if expr1 is not NULL; expr2 otherwise.

Example query:

SELECT patient, nvl(discharge_date, CURRENT_DATE) as last_seen FROM patients

Useful links:

Wikipedia on Null Coalescing Operator

Oracle documentation on nvl

139 questions
-1
votes
3 answers

Is there an Oracle function to return boolean if either one of the two value is not null?

for example: n1 and n2, wonder any oracle built in function could achieve that? Sample condition and expected output: if n1 is null and n2 is null, return null if n1 is null and n2 is not null, return n2 if n1 is not null and n2 is null, return…
akira
  • 51
  • 6
-2
votes
1 answer

NVL Function in SQL

what excatly 1 - NVL(up, 0) down this statement mean , is it giving me the contradiction of up ?
-3
votes
1 answer

Nvl function with multiple row set in oracle

I have a problem with NVL function in oracle. If I send periods variable as null it is working.There is no data in query.I mean NVL function is working properly. If I send periods variable as for example 10 , it gives error like…
erhan
  • 15
  • 5
1 2 3
9
10