Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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 |
Advertisements
