Special characters & amp; processing in SQL

Source: Internet
Author: User

Special characters in SQL & processing update userinfo set pageurl = 'myjsp? Page = 1 & pagesize = 10 'where id = 'test' www.2cto.com? Two methods: 1) update userinfo set pageurl = 'myjsp? Page = 1' | '&' | 'pagesize = 10' where id = 'test' 2) update userinfo set pageurl = 'myjsp? Page = 1' | chr (38) | 'pagesize = 10' where id = 'test' | it is a hyphen, chr (38) it is consistent with ASCII character transcoding. If it is in SQL * PLUS, note the command line: You can also set define off to close special characters, you can also use show define to view some special characters. Example: www.2cto.com (method 1) insert into t (col) values (chr (ascii ('&'); SQL> SHOW DEFINE define "&" (hex 26 )? <--- The default value of DEFINE is '&' SQL> set define off SQL> show define define off SQL> INSERT INTO <table_name> VALUES ('at & T '); /1 row created (method 2) SQL> show escape escape OFF <--- the default value of ESCAPE is off SQL> set escape on SQL> SHOW ESCAPE escape "\" (hex 5c) SQL> INSERT INTO temp_table VALUES ('select * from emp where ename =\& 1'); 1 row created. how to escape the underline _ select... from... where... like '/_ %' escape '/'; escape character % processing method such as & escape character 'single quotes in PL/SQL two single quotes equals one single quotes double quotes = chr (34)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.