- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Difference between SCALAR and COLUMN function
The DB2 SCALAR functions take a single column value and returns a single result. The COLUMN function takes the column value from multiple rows of a DB2 table and returns a single result. In case of SCALAR function only one row is involved.
SCALAR FUNCTION | DESCRIPTION |
LENGTH | Gives the length of the column value |
REPLACE | Used to replace a string with another string |
CONCAT | Used to combine two or more column values |
INTEGER | Gives the integer equivalent of the column value |
CHAR | Gives the character equivalent of the column value |
For example, if we have an ORDERS DB2 table and we want to return only the integer value of the ORDER_TOTAL for all the orders placed on 15-08-2020. We will use the below query.
Example
SELECT ORDER_ID, INTEGER(ORDER_TOTAL) FROM ORDERS WHERE ORDER_DATE = ‘15-08-2020’
In this case, if any ORDER_ID Z55641 is having the ORDER_TOTAL as 3422.89, then we will get the following result.
ORDER_ID | ORDER_TOTAL |
Z55641 | 3422 |
- Related Articles
- Difference Between Scalar and Vector
- Difference between Function and Procedure
- Difference between Row oriented and column oriented database
- Difference between Method and Function in C#
- Difference between Method and Function in Python
- Difference Between Friend Function and Friend Class
- Difference Between Virtual and Pure Virtual Function
- Difference Between Manifest Function and Latent Functions
- Difference between Function and Predicate in Java 8
- Difference Between Function Overloading and Overriding in C++
- Difference between a virtual function and a pure virtual function in C++
- What is the difference between: var functionName = function() {} and function functionName() {} in Javascript
- What is the difference between MySQL NOW() and CURDATE() function?
- What is the difference between MySQL LENGTH() and CHAR_LENGTH() function?
- Difference between class alv and function alv in SAP ABAP?

Advertisements