웹이야기

[MySQL] INSERT() 본문

D/MySQL

[MySQL] INSERT()

yeon.Biju 2020. 4. 13. 11:34

MySQL 문자열 함수와 연산자

 

INSERT()

   -

 

INSERT(str, pos, len, newstr)

의 형태

 

Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr. Returns the original string if pos is not within the length of the string Replaces the rest of the string from position pos if len is not within the length of the rest of the string. Returns NULL if any argument is NULL.

 

This function is multibyte safe.

 

mysql> SELECT INSERT('Quadratic', 3, 4, 'What') ;
+-----------------------------------+
| INSERT('Quadratic', 3, 4, 'What') |
+-----------------------------------+
| QuWhattic                         |
+-----------------------------------+
1 row in set (0.00 sec)

 

mysql> SELECT INSERT('Quadratic', -1, 4, 'What') ;
+------------------------------------+
| INSERT('Quadratic', -1, 4, 'What') |
+------------------------------------+
| Quadratic                          |
+------------------------------------+
1 row in set (0.00 sec)

 


mysql> SELECT INSERT('Quadratic', 3, 100, 'What') ;
+-------------------------------------+
| INSERT('Quadratic', 3, 100, 'What') |
+-------------------------------------+
| QuWhat                              |
+-------------------------------------+
1 row in set (0.00 sec)

 

'D > MySQL' 카테고리의 다른 글

[MySQL] LCASE()  (0) 2020.04.13
[MySQL] INSTR()  (0) 2020.04.13
[MySQL] HEX()  (0) 2020.04.13
MySQL FROM_BASE64()  (0) 2020.04.13
[MySQL] FORMAT()  (0) 2020.04.13
Comments