Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle nvl

-- force output for NOT NULL values
NVL(your_variable, Value_if_null)

-- OR (force outputs for both NOT NULL and NULL values)
NVL2(your_variable, value_if_not_null, value_if_null)
Comment

nvl in oracle

SELECT NVL(NULL, 'N/A') FROM dual;
Comment

oracle nvl2

NVL2( string_to_test, value_if_NOT_null, value_if_null )
Comment

difference between nvl and nvl2 in oracle

/*
NVL checks if first argument is null and returns second argument.

NVL2 has different logic. If first argument is not null 
then NVL2 returns second argument, but in other case it will 
return third argument.
*/

select nvl(null, 'arg2') from dual
-- Result: arg2;
select nvl2('arg1', 'arg2', 'arg3') from dual 
-- Result: arg2
select nvl2(null, 'arg2', 'arg3') from dual
-- Result: arg3
Comment

PREVIOUS NEXT
Code Example
Sql :: all tables and views oracle 
Sql :: sqlite show columns 
Sql :: oracle session statistics 
Sql :: 2nd max salary query in sql 
Sql :: How to backup databases using psql 
Sql :: how to run sql server on mac 
Sql :: psql generate id in existing database 
Sql :: sql run multiple updates in one query 
Sql :: oracle previous year 
Sql :: postgresql function round 
Sql :: how to declare a variable in sql 
Sql :: SQL Updating a View 
Sql :: Write an SQL query to print details of the Workers whose SALARY lies between 100000 and 500000. 
Sql :: sql to array of objects 
Sql :: oracle enable chain 
Sql :: mysql if else 
Sql :: insert query in sql 
Sql :: convert html to plain text in sql server 
Sql :: postgresql backup and restore globals and data 
Sql :: mysql in 
Sql :: Access PostgreSQL PSQl with sudo 
Sql :: postgres find missing indexes 
Sql :: create table with float datatype in sql server 
Sql :: how to find 2nd highest salary in a table 
Sql :: sql sum of same record 
Sql :: how to filter repeated same result using sql query 
Sql :: mysql is odd 
Sql :: sql insert exemplo 
Sql :: sql server python connection 
Sql :: sql if else 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =