在oracle数据库中插入含有&符号的字符串
来源:互联网 发布:返利网是淘宝客吗 编辑:程序博客网 时间:2024/05/16 10:39
两种情况:
1、如果&后面没有字符串,那么&就是简单的字符,按照字符进行处理;
2、如果&后面有字符串,那么按照oracle的说法,就应该将&后面的作为变量来进行操作,进行处理;
下面是针对上面两种情况的尝试:
T5240.com%
T5240.com% sqlplus '/ as sysdba'
SQL*Plus: Release 10.2.0.5.0 - Production on 星期二 3月 5 12:21:58 2013
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
会话已更改。
SQL>
SQL> create table zzw_temp (name varchar2(20));
表已创建。
SQL> insert into zzw_temp(name) values('zzw');
已创建 1 行。
SQL> commit;
提交完成。
SQL> select * from zzw_temp;
NAME
--------------------
zzw
SQL> insert into zzw_temp(name) values('&');
已创建 1 行。
SQL> commit;
提交完成。
SQL> select * from zzw_temp;
NAME
--------------------
zzw
&
SQL>
SQL>
SQL>
SQL>
SQL> insert into zzw_temp(name) values('https://192.168.0.1/index.html&http');
输入 http 的值: 123
原值 1: insert into zzw_temp(name) values('https://192.168.0.1/index.html&http')
新值 1: insert into zzw_temp(name) values('https://192.168.0.1/index.html123')
insert into zzw_temp(name) values('https://192.168.0.1/index.html123')
*
第 1 行出现错误:
ORA-12899: 列 "SYS"."ZZW_TEMP"."NAME" 的值太大 (实际值: 35, 最大值: 20)
SQL> alter table zzw_temp modify name varchar2(200);
表已更改。
SQL> insert into zzw_temp(name) values('https://192.168.0.1/index.html&http');
输入 http 的值: 123
原值 1: insert into zzw_temp(name) values('https://192.168.0.1/index.html&http')
新值 1: insert into zzw_temp(name) values('https://192.168.0.1/index.html123')
已创建 1 行。
SQL> select * from zzw_temp;
NAME
----------------------------------------------------------------------------------------------------------------------------------
zzw
&
https://192.168.0.1/index.html123
SQL> insert into zzw_temp(name) values('https://192.168.0.1/index.html'||'&'||'http');
已创建 1 行。
SQL> commit;
提交完成。
SQL> select * from zzw_temp;
NAME
----------------------------------------------------------------------------------------------------------------------------------
zzw
&
https://192.168.0.1/index.html123
https://192.168.0.1/index.html&http
SQL>
SQL>
1、如果&后面没有字符串,那么&就是简单的字符,按照字符进行处理;
2、如果&后面有字符串,那么按照oracle的说法,就应该将&后面的作为变量来进行操作,进行处理;
下面是针对上面两种情况的尝试:
T5240.com%
T5240.com% sqlplus '/ as sysdba'
SQL*Plus: Release 10.2.0.5.0 - Production on 星期二 3月 5 12:21:58 2013
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
会话已更改。
SQL>
SQL> create table zzw_temp (name varchar2(20));
表已创建。
SQL> insert into zzw_temp(name) values('zzw');
已创建 1 行。
SQL> commit;
提交完成。
SQL> select * from zzw_temp;
NAME
--------------------
zzw
SQL> insert into zzw_temp(name) values('&');
已创建 1 行。
SQL> commit;
提交完成。
SQL> select * from zzw_temp;
NAME
--------------------
zzw
&
SQL>
SQL>
SQL>
SQL>
SQL> insert into zzw_temp(name) values('https://192.168.0.1/index.html&http');
输入 http 的值: 123
原值 1: insert into zzw_temp(name) values('https://192.168.0.1/index.html&http')
新值 1: insert into zzw_temp(name) values('https://192.168.0.1/index.html123')
insert into zzw_temp(name) values('https://192.168.0.1/index.html123')
*
第 1 行出现错误:
ORA-12899: 列 "SYS"."ZZW_TEMP"."NAME" 的值太大 (实际值: 35, 最大值: 20)
SQL> alter table zzw_temp modify name varchar2(200);
表已更改。
SQL> insert into zzw_temp(name) values('https://192.168.0.1/index.html&http');
输入 http 的值: 123
原值 1: insert into zzw_temp(name) values('https://192.168.0.1/index.html&http')
新值 1: insert into zzw_temp(name) values('https://192.168.0.1/index.html123')
已创建 1 行。
SQL> select * from zzw_temp;
NAME
----------------------------------------------------------------------------------------------------------------------------------
zzw
&
https://192.168.0.1/index.html123
SQL> insert into zzw_temp(name) values('https://192.168.0.1/index.html'||'&'||'http');
已创建 1 行。
SQL> commit;
提交完成。
SQL> select * from zzw_temp;
NAME
----------------------------------------------------------------------------------------------------------------------------------
zzw
&
https://192.168.0.1/index.html123
https://192.168.0.1/index.html&http
SQL>
SQL>
- 在oracle数据库中插入含有&符号的字符串
- 在oracle数据库中插入含有&符号的字符串
- 向数据库中插入含有单引号的字符串
- [Tip]如何在SQL*PLUS中插入含有'&'的字符串?
- [Tip]如何在SQL*PLUS中插入含有'&'的字符串?
- 在SQL*PLUS中插入含有&的字符串
- 插入和更新数据库时字符串中含有转义字符的处理方法
- [Tip]如何在SQL*PLUS中插入含有&的字符串?
- oracle 单引号中含有字符串
- 在Oracle数据库的表中插入图片的方法
- 在Oracle数据库的表中插入图片的方法
- 搜索当前数据库中含有指定字符串的表列
- oracle数据库中查找含有某列名的所有表
- 在有序但含有空的数组中查找字符串
- 在有序但含有空的数组中查找字符串
- 在有序但含有空的数组中查找字符串
- 在有序但含有空的数组中查找字符串
- Oracle无法插入含有日期的数据
- windows下的文本文件在linux下查看,中文显示乱码
- linux登录密码忘记,教你怎样破解
- QT编程No such slot的解决方…
- Copy_from&to_user详解 转载
- copy_to_user,copy_from_use…
- 在oracle数据库中插入含有&符号的字符串
- IAR for ARM 6.20 完美破解
- minicom的使用方法
- vivi linux2.6移植笔记
- Arm-linux下USB摄像头的视频…
- EditPlus3注册码
- 程序员修身养性的十大原则
- 献给我的爱机——google nexus s
- 【C语言】动态分配内存、voi…