Try OpenEdge Now
skip to main content
SQL Reference
SQL Reference : OpenEdge SQL Functions : INSERT
 

INSERT

Returns a character string where length number of characters have been deleted from string_exp1 beginning at start_pos, and string_exp2 has been inserted into string_exp1, beginning at start_pos.

Syntax

INSERT( string_exp1 , start_pos , length , string_exp2 )

Notes

*The string_exp can be type fixed‑length or variable-length CHARACTER.
*The start_pos and length can be of data type INTEGER, SMALLINT, or TINYINT.
*The result string is of the type string_exp1.
*If any of the argument expressions evaluate to NULL, the result is NULL.
*If start_pos is negative or zero, the result string evaluates to NULL.
*If length is negative, the result evaluates to NULL.
*string_exp1 and string_exp2 and the result can contain multi-byte characters. This is determined by the character set of the SQL server. The length argument specifies a number of characters.

Example

This example illustrates the INSERT function:
SELECT INSERT(last_name,2,4,'xx')
FROM customer
WHERE last_name = 'Goldman';
INSERT LAST_NAME,2,4,XX)
------------------------
Gxxan
1 record selected
The two letters ‘o' and ‘l' are deleted from the name ‘Goldman' in the last_name column, and the letters ‘xx' are inserted into the last_name column, beginning at the fourth character, overlaying the letters ‘d' and ‘m'.

Compatibility

ODBC compatible