Get the App
SLTechnology News&Howtos  ›  Database  › 

Data is inserted with special characters & and followed by characters that are mistaken for variable names (inser

Shulou Source: shulou.com Published: 2022-06-01 21:52:38 11月14日 Update

Please check your SQL when the following error occurs. It must be the special character & in the value. If it is not used to delete it directly, if it is useful, then you need to deal with it (default insertion value with & symbol, and followed by a string, it will be mistaken for variable name).

Processing method (meaning to enclose & in single quotation marks and then process this column in a concatenation way)

will & replaced with '||'&'||'

The following prompt appears on plsql developer

In sqlplus is the following prompt

SQL> insert into va values ('T & K/Tyne Con'); Enter k for value: just a symbol I don't want to assign... original value 1: insert into va values ('T & K/Tyencon') New values 1: insert into va values ('T 'is just a symbol I don't want to assign.../ Tyncon ') has created 1 line. SQL> select * from va; FS_FAILOVER_OBSERVER_HOST--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- taienkang

Separate & from characters mistaken for variable names using single quotes and concatenation.

SQL> insert into va values('T'||'&'||'K/Tyne Con'); 1 line created. SQL> select * from va; FS_FAILOVER_OBSERVER_HOST--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

In fact, followed by a space will not have an impact, you can insert directly.

SQL> insert into va values ('a7 &> d'); 1 line created. SQL> select * from va;FS_FAILOVER_OBSERVER_HOST--------------------------------------------------------------------------------a7 & >d

Tags: Tyne symbol processing character just variable quotation mark method useful prompt special original value string that is meaning way space median influence check Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Shulou Technology Microsoft MySQL Xiaomi