SoFunction
Updated on 2025-04-14

1000 common fool questions for DB2 (Sixth)

The db2 tutorial I am watching is: 1000 common fool questions for DB2 (Sixth). 149.ATAN2()
Returns the arctangent value of the X and Y coordinates of the angle represented by radians.
SELECTATAN2(0.5,0.9)FROMBSEMPMS;

()
Returns a 64-bit integer representation of a number or string in an integer constant.
SELECTBIGINT(EMP_NO)FROMBSEMPMS;

()ORCEIL()
Returns the smallest integer value larger than the parameter or equal to the parameter.
SELECTCEILING(3.56)FROMBSEMPMS;
SELECTCEIL(4.67)FROMBSEMPMS;

()
Returns a string representation of date-time, string, integer, decimal or double-precision floating-point numbers.
SELECTCHAR(SALARY,',')FROMBSEMPMS;

()
Returns a character with the ASCII code specified by the parameter.
SELECTCHAR(167)FROMBSEMPMS;
()
Returns a connection of two strings.
SELECTCONCAT(EMP_NO,EMP_NAM)FROMBSEMPMS;

()
Returns the year part of the value.
SELECTYEAR('2003/01/02')FROMBSEMPMS;

()
Returns a variable-length string representation of a string, date type, and graphic string.
SELECTVARCHAR(EMP_NAM,50)FROMBSEMPMS;

()ORUPPER()
Returns the uppercase of the string.
SELECTUCASE(EMP_NAM)FROMBSEMPMS;
SELECTUPPER(EMP_NO)FROMBSEMPMS;

()ORTRUNC()
Start truncating from the right of the decimal point of the expression and return the value.
SELECTTRUNCATE(345.6789,2)FROMBSEMPMS;

()
Returns the time in a numeric value.
SELECTTIME('2001-03-19.12.30.123456')FROMBSEMPMS;

(EXP1,EXP2)
Returns the substring from EXP1 string starting from EXP2.
SELECTSUBSTR('CDNJFDJFJD',5)FROMBSEMPMS;
SELECTSUBSTR('CDNJFDJFJD',5,2)FROMBSEMPMS;

()
Returns the square root of this parameter.
SELECTSQRT(36)FROMBSEMPMS;

()
Returns a string with a length specified by the parameter, including spaces.
SELECTSPACE(10)FROMBSEMPMS;

()
Returns the second part of a value.
SELECTSECOND('18:34:32')FROMBSEMPMS;

()
Delete the space at the end of the string.
SELECTRTRIM('COMMENT')FROMBSEMPMS;

(EXP1,EXP2)
Returns the rounding value starting at the EXP2 position to the right of the decimal point of EXP1.
SELECTROUND(2345.6789,2)FROMBSEMPMS;

(EXP1,EXP2,EXP3)
Replace all EXP2 in EXP1 with EXP3
SELECTCHAR(REPLACE('ROMANDD','NDD','CCB'),10)FROMBSEMPMS;

(EXP1,EXP2)
Returns the string after EXP1 is repeated EXP2 times.
SELECTCHAR(REPEAT('REPEAT',3),21)FROMBSEMPMS;

()
Returns a single-precision floating point representation of a numeric value.
SELECTREAL(10)FROMBSEMPMS;

()
Returns a random floating point number between 0 and 1.
SELECTRAND()FROMBSEMPMS;

(EXP1,EXP2)
Returns the EXP2 power of EXP1.
SELECTPOWER(2,5)FROMBSEMPMS;

(EXP1,EXP2)
Returns the position of EXP2 in EXP1.
SELECT('ABCDEFGH','D')FROMBSEMPMS;

(EXP1,EXP2)
If EXP1=EXP2, it is NULL, otherwise it is EXP1
()
Returns the partition number of the row.
SELECTNODENUMBER(EMP_NO)FROMBSEMPMS;

()
Returns the month part of a value.
SELECTMONTH('2003/10/20')FROMBSEMPMS;

(EXP1,EXP2)
Returns the remainder of EXP1 divided by EXP2.
SELECTMOD(20,8)FROMBSEMPMS;

()
Returns the minute part of a numeric value.
SELECTMINUTE('18:34:23')FROMBSEMPMS;

()
Delete the spaces in front of the string.
SELECTLTRIM('CDDD')FROMBSEMPMS;

()
Returns the hour part of a numeric value.
SELECTHOUR('18:34:23')FROMBSEMPMS;

()
If the parameter is a numeric expression, it returns the corresponding floating point number. If the parameter is a string expression, it returns the string expression of the number.
SELECTDOUBLE('5678')FROMBSEMPMS;

()
Returns the exponential function of the parameter.
SELECTEXP(2)FROMBSEMPMS;

()
Returns a floating point representation of a number.
SELECTFLOAT(789)FROMBSEMPMS;

()
Returns the maximum integer less than or equal to the parameter.
SELECTFLOOR(88.93)FROMBSEMPMS;

()
Returns a hexadecimal representation of the value represented as a string.
SELECTHEX(16)FROMBSEMPMS;