INSERT Function

Description

The INSERT function inserts a partial character string as long as the length from the specific location of the input character string. The return value is a VARCHAR type.

The maximum length of the character string is 33,554,432 and if this length is exceeded, NULL will be returned.

Syntax

INSERT( str, pos, len, string )

Example

SELECT INSERT('cubrid',2,2,'dbsql');

  insert('cubrid', 2, 2, 'dbsql')

======================

  'cdbsqlrid'

 

SELECT INSERT('cubrid',0,3,'db');

  insert('cubrid', 0, 3, 'db')

======================

  'cubrid'

 

SELECT INSERT('cubrid',-3,3,'db');

  insert('cubrid', -3, 3, 'db')

======================

  'cubrid'

 

SELECT INSERT('cubrid',3,100,'db');

  insert('cubrid', 3, 100, 'db')

======================

  'cudb'

 

SELECT INSERT('cubrid',7,100,'db');

  insert('cubrid', 7, 100, 'db')

======================

  'cubriddb'

 

SELECT INSERT('cubrid',3,-1,'db');

  insert('cubrid', 3, -1, 'db')

======================

  'cudb'