Oracle INSERT corresponds to the LOCATE function in db2 usage

Source: Internet
Author: User
Tags db2 functions


In oracle, INSERT corresponds to the LOCATE function usage in db2. The SQL code www.2cto.com eg: SELECT CONCAT (FIRST_NAME, LAST_NAME) FROM T1 eg: SELECT CONCAT (FIRST_NAME, LAST_NAME) FROM T1 INSERT function Syntax: the INSERT (ARG1, POS, SIZE, ARG2) function returns a string, which deletes the SIZE of ARG1 from the POS and inserts ARG2 into the position. SQL code eg: LOCATE function Syntax: LOCATE (ARG1, ARG2, <POS>) the LOCATE function searches for the location where ARG1 first appeared in ARG2. If POS is specified, the first position of ARG1 appears at the POS of ARG2. SQL code eg: www.2cto.com SELECT LOCATE ('A', NAME) FROM T1 eg: SELECT LOCATE ('A', NAME) FROM T1 POSSTR function Syntax: POSSTR (EXP1, EXP2) the POSSTR function returns the position of EXP2 in EXP1. SQL code eg: SELECT LOCATE (NAME, 'A') FROM T1 eg: SELECT LOCATE (NAME, 'A') FROM T1 the REPEAT function Syntax of common DB2 functions: REPEAT (ARG1, NUM_TIMES) the REPEAT function returns the string that ARG1 is repeated for NUM_TIMES. SQL code eg: SELECT REPEAT (NAME, 2) FROM T1 eg: SELECT REPEAT (NAME, 2) FROM T1 REPLACE function Syntax: REPLACE (EXP1, EXP2, EXP3) the REPLACE function uses EXP3 to REPLACE all exp2. SQL code example: SELECT REPLACE ('romannd', 'nnd', 'ccb') FROM T1 eg: SELECT REPLACE ('romannd', 'nnd', 'ccb ') FROM T1 SPACE function Syntax: SPACE (SIZE) SPACE function returns a string containing SIZE spaces. SQL code www.2cto.com eg: SELECT SPACE (10) FROM T1 eg: SELECT SPACE (10) FROM T1 SUBSTR function Syntax of common DB2 functions: SUBSTR (ARG1, POS, <LENGTH>) the SUBSTR function returns the LENGTH starting from the POS position in ARG1. If the LENGTH is not specified, the remaining characters are returned. SQL code eg: SELECT SUBSTR ('cdnjfdjfjd ', 5, 2) FROM T1 eg: SELECT SUBSTR ('cdnjfdjfjd', 5, 2) FROM T1

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.