APPX Software Library

Chapter 4: SQL Language Elements

4.9.2.37 INSERT function (ODBC compatible)

Syntax

INSERT(string_exp1,start,length,string_exp2)

Description

The scalar function INSERT returns a character string where length characters have been deleted from string_exp1 beginning at start and string_exp2 has been inserted into string_exp1, beginning at start.

Example

SELECT INSERT(name,2,4,'xx')
FROM customer
WHERE name = 'Goldman';
INSERT(NAME,2,4,XX)

Gxxan
1 record selected

Example

  • The string_exp can be of the type fixed length or variable length CHARACTER.
  • The start and length can be of the type INTEGER, SMALLINT, TINYINT or BIGINT.
  • The result string is of the type string_exp1.
  • If any of the argument expression evaluates to a null, the result would be a null.
  • If start is negative or zero ,the result string evaluates to a null.
  • If length is negative, the result evaluates to a null.