- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of the VALUE function in a DB2? Explain with the help of an example
The purpose of VALUE function in DB2 is to check for NULL values and it can be used in place of NULL indicator or COALESCE function. The VALUE function replaces the column value with the given argument if it contains a NULL value.
For example, if we have an ORDER table and we have to extract ORDER_ID and ORDER_DESCRIPTION from this table. The ORDER_DECRIPTION column can have NULL values.
If this is the case, we have to replace ORDER_DESCRIPTION with SPACES, then we can use the below query:
Example
EXEC SQL SELECT ORDER_ID, VALUE(ORDER_DESCRIPTION, ‘ ‘) INTO :ORDER-ID, :ORDER-DESCRIPTION FROM ORDERS END-EXEC
In this case, the VALUE function will take two arguments. The first one is the name of the column and second one is the expected value if the column contains NULL values.
- Related Articles
- What are COLUMN functions in DB2? Explain with the help of an example
- Explain the concept of DYNAMIC SQL in DB2 with the help of an example
- What is CLUSTERED INDEX in DB2? Explain with the help of practical example.
- What is the difference between DB2 JOIN and UNION? Explain with the help of an example
- What is the purpose of COALESCE function? Explain with the help of an example.
- What is NON CLUSTERED INDEX in DB2? Explain with the help of practical example
- What is symbiotic relationship? Explain with the help of an example
- What is a use of SQLWARN3 in a SQLCA? Explain with the help of a practical example?
- (a) What is meant by a contact force? Explain with the help of an example.(b) What is meant by a non-contact force? Explain with the help of an example.
- (a) What is the significance of the symbol of an element? Explain with the help of an example.(b) Explain the significance of the symbol H.
- Explain the concept of LOCK PROMOTION with the help of an example
- Explain join operations with the help of an example in DBMS
- What is Fixed-list SELECT? Give the syntax and explain with help of an example
- What is the use of StringBuffer class can anyone explain with an example?
- With the help of an example, explain how diffusion of gases in water is essential?

Advertisements