insert into varchar2(8000)
在看12c的文档的时候发现varcahr2最大长度是4000 byte
VARCHAR2 Data Type
The VARCHAR2
data type specifies a variable-length character string. When you create a VARCHAR2
column, you supply the maximum number of bytes or characters of data that it can hold. Oracle subsequently stores each value in the column exactly as you specify it, provided the value does not exceed the maximum length of the column. If you try to insert a value that exceeds the specified length, then Oracle returns an error.
You must specify a maximum length for a VARCHAR2
column. This maximum must be at least 1 byte, although the actual string stored is permitted to be a zero-length string (''
). You can use the CHAR
qualifier, for example VARCHAR2
(10
CHAR
), to give the maximum length in characters instead of bytes. A character is technically a code point of the database character set. You can use the BYTE
qualifier, for example VARCHAR2
(10 BYTE
), to explicitly give the maximum length in bytes. If no explicit qualifier is included in a column or attribute definition when a database object with this column or attribute is created, then the length semantics are determined by the value of the NLS_LENGTH_SEMANTICS
parameter of the session creating the object. Independently of the maximum length in characters, the length of VARCHAR2
data cannot exceed 4000 bytes. Oracle compares VARCHAR2
values using nonpadded comparison semantics.
To ensure proper data conversion between databases with different character sets, you must ensure that VARCHAR2
data consists of well-formed strings. SeeOracle Database Globalization Support Guide for more information on character set support.
但是下面的SQL可以把8000长度的字符串insert到varchar2中。 为什么呢?
declare
v1 varchar2(8000);
begin
v1 := 'a';
for i in 1..7900 loop
v1 := v1||'a';
end loop;
--dbms_output.put_line(v1);
insert into t values(v1);
end;
这是因为oracle 12c中通过设置MAX_STRING_SIZE
to EXTENDED,
可以增加 VARCHAR2
, NVARCHAR2
, and RAW
data types 的最大大小。 这个参数设置为STANDAND的时候,这些类型的大小是 4000 bytes for VARCHAR
2 andNVARCHAR2
, and 2000 bytes for RAW。 而设置成EXTENED之后这些类型的最大大小变成了 32767 byte。
另一个要注意的地方是这个是12c的新特性,而且在设置的时候并不是说简单的 ALER SYSTEM SET MAX_STRING_SIZE就可以了。根据不同的情况要有不同的操作步骤。
insert into varchar2(8000)的更多相关文章
- 取得表中数据的insert语句
Build Insert Statements for the Existing Data in Tables 下面这个脚本实现了取得一个非空表中的所有insert语句 This script bui ...
- 我的一个PLSQL函数 先查询再插入数据库的函数 动态SQL拼接查询条件、通用游标、记录定义(封装部分查询字段并赋值给游标)、insert select 序列、常量【我】
先查询再插入数据库的函数 CREATE OR REPLACE FUNCTION F_REVENUE_SI(l_p_cd in Varchar2, l_c_cd in Varchar2, l_prod_ ...
- 浅谈利用PLSQL的多线程处理机制,加快处理大数据表的效率
我们在处理大数据表的时候经常会感觉的处理速度不够快,效率不够高,那么今天下面我就来简单实现下PLSQL的多线程编程处理数据: 我模拟一个简单的场景,把某一张表中的数据(当然这张表的数据非常大)同步到目 ...
- LOB类型的学习、总结
LOB相关的概念 LOB类型: 将信息文件(十进制.二进制).图像甚至音频信息采用数据库作为保存载体时,就需要使用lob类型数据. 有两种Lob,Internal Lob和External Lob.I ...
- Oracle 动态sql小例子
错误写法: create or replace procedure testproce20130228issqlstr varchar2(8000);date1 varchar2(10);begins ...
- 先查询再插入,改为存储过程,java部分入参出参、mybatisxml【我】
先查询再插入,改为存储过程 create or replace procedure PRO_REVENUE_SI(l_p_cd in Varchar2, l_c_cd in Varchar2, l_p ...
- ORACLE大对象存储
--创建有大对象字段的一张表 create table test001 ( fname varchar2(50), content blob ) select * from ...
- ORACLE实现自定义序列号生成
实际工作中,难免会遇到序列号生成问题,下面就是一个简单的序列号生成函数 (1)创建自定义序列号配置表如下: --自定义序列 create table S_AUTOCODE ( pk1 ) primar ...
- Oracle在存储过程中如何返回结果集
Oracle和Sqlserver不一样的地方有很多. 个人最深的体会是存储过程返回结果集,在Sqlserver中直接select查询就行,Oracle就不行了. 这里,就用最简单的例子说明存储过程返回 ...
随机推荐
- strupr函数
2019-06-03 15:13:39 strupr()函数! strupr,函数的一种,将字符串s转换为大写形式. 说明:只转换s中出现的小写字母,不改变其它字符.返回指向s的指针. 兼容性说明:s ...
- day02_12/12/2016_bean的实例化之静态工厂方式
- 使用yum命令更新时锁住了怎么办?
出现的状况如下: [root@iZwz951sp834mvbed8gdzzZ ~]# yum update kernelLoaded plugins: fastestmirrorExisting lo ...
- sql 循环分割字符
DECLARE @Items VARCHAR(1000)='148' --待处理拼接字符串 --开始处理SET @Items=@Items+',' --必须追加“,”否则最后一个无法输出DECLARE ...
- MVC系列学习(七)-模板页
1.新建一个MVC项目,选择基本 2.查看文件 看到VS为我们生成了一些东西 布局页面,Layout 指定了模板页 3.开始实例 首先控制器中的代码如下: 视图中代码如下: 1.在/Views/_Vi ...
- 软件架构自学笔记----分享“去哪儿 Hadoop 集群 Federation 数据拷贝优化”
去哪儿 Hadoop 集群 Federation 数据拷贝优化 背景 去哪儿 Hadoop 集群随着去哪儿网的发展一直在优化改进,基本保证了业务数据存储量和计算量爆发式增长下的存储服务质量.然而,随着 ...
- Android项目实战_手机安全卫士系统加速
## 1.本地数据库自动更新的工作机制1. 开启一个服务,定时访问服务器2. 进行版本对比,如果最新版本比较高,获取需要更新的内容3. 将新内容插入到本地数据库中 ## 2.如何处理横竖屏切换1. 指 ...
- 【sqli-labs】 less44 POST -Error based -String -Stacked Blind(POST型基于盲注的堆叠字符型注入)
盲注漏洞,登陆失败和注入失败显示的同一个页面 可以用sleep函数通过延时判断是否闭合引号成功 这个方法有一点不好的地方在于,并不能去控制延时,延时的时间取决于users表中的数据数量和sleep函数 ...
- logback日志配置文件
application.properties application.properties logback-spring.xml <?xml version="1.0" en ...
- 通过javascript在iframe中加载html
在spring mvc中,虽然有时候,在控制器中设置返回值是json对象,但在拦截器出现错误的时候,仍然可能返回html(根据设置的不同),如果要展示这些html,最好把他们放入iframe中,以防这 ...