Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 



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 )

  • str : Input character string
  • pos : str location. Starts from 1. If pos is smaller than 1 or greater than the length of string + 1, the string will not be inserted and the str will be returned instead.
  • len : Length of string to insert pos of str. If len exceeds the length of the partial character string, insert as many values as string in the pos of the str. If len is a negative number, str will be the end of the character string.
  • string : Partial character string to insert to str
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'