(Year (current date) as char (4) | '-01-01') -- obtain the first day of the current year.Date ('2014/1/123 ')Time ('12: 00: 00 ')Time ('12. 00.00 ')
The timestamp (), date (), and time () functions support more formats. The above formats are just examples. I will use them as an exercise so that readers can discover other formats themselves.
Sometimes, you need to know the time difference between two timestamps. Therefore,
')Date ('1970-10-20 ')Date ('2014/1/123 ')Time ('12: 00: 00 ')Time ('12. 00.00 ')
The timestamp (), date (), and time () functions support more formats. The above formats are just examples. I will use them as an exercise so that readers can discover other formats themselves.
Sometimes, you need to know the time difference between two timestamps. Therefore, DB2 provides a built-in function named timesta
Introduction to common DB2 functions 1. VALUE Function Syntax: VALUE (EXPRESSION1, EXPRESSION2) the VALUE function returns a non-empty VALUE. When the first parameter is not empty, the VALUE of this parameter is directly returned, if the first parameter is null, the value of the first parameter is returned.Java code eg: -- indicates that if T1.ID is null, an empty string is returned. If T1.ID is not empty,
The NVL function is a null-value conversion functionNVL(表达式1,表达式2)If expression 1 is a null value, NVL returns the value of expression 2, otherwise returns the value of expression 1.The purpose of this function is to convert a null value (NULL) into an actual value. The value of its expression can be numeric, character, and date. But the data type of expression 1 and expression 2 must be the same type.
For digital type: NVL (a,0);
For character type: NVL (To_char (a), ' Zifeiy ')
The effect of rollup is to count the name of a grouped column after group by.BankID as the first columnSELECT Case -grouping (Branchid) = 0 Then branchid ELSE ' subtotal ' END as Branchid, case When grouping (bankid) = 0 Then bankid ELSE ' Total ' END as BankID, SUM (balance) from ebanksummwhereBranchid as the first columnSELECT Case -grouping (Branchid) = 0 Then branchid ELSE ' subtotal ' END as Branchid, cas
Label:One. Arrays In DB2, creating an array will generate two objects under functions: The SYS type and the user type array /* Create an array */
Create as varchar (+) array[];
/* Delete an array */
drop type arrname; Two. Functions 1. Basic syntax Create functionDB2INST.FUNC1 (param1integer, param2varchar(Ten))/*input Parameters except Boolean and cursor*/
re
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.