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就不行了. 这里,就用最简单的例子说明存储过程返回 ...
随机推荐
- nodejs在windows下的安装
Windowv 上安装Node.js Windows 安装包(.msi) : 32 位安装包下载地址 : http://nodejs.org/dist/v0.10.26/node-v0.10.26-x ...
- zhw大神线段树姿势
; i<; i++) tree[i][]=tree[i][]=i; ; i>=; i--) tree[i][]=tree[i+i][], tree[i][]=tree[i+i+][]; v ...
- akka设计模式系列-消息模型
通过前面的文章我们总结了几个常见的actor设计模式,但此处不得不提前介绍一下在Akka中消息的设计模式.随着对Akka的使用,我们会发现,使用Akka设计系统其实就是面向消息编程.actor之间消息 ...
- 6.10---mybatis中两张表查询数据dao层
- Android studio & SDK的国内有效站点。
SDK.TOOLS的国内有效镜像节点: mirrors.zzu.edu.cn/android/repository/ 网上的地址只写了mirrors.zzu.edu.cn,有误,需要补齐后面的子目录才 ...
- Android基础TOP4_1:点击物理按钮弹出退出提示框
JAVA: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedIns ...
- 【技术累积】【点】【java】【27】@JSONField
@JSONField 该注解隶属于阿里fastjson,方便fastjson处理对象时的一些操作 源码 @Retention(RetentionPolicy.RUNTIME) @Target({ El ...
- 扩增子图表解读1箱线图:Alpha多样性
箱线图 箱形图(Box-plot)又称为盒须图.盒式图或箱线图,是一种用作显示一组数据分散情况资料的统计图.因形状如箱子而得名.在宏基因组领域,常用于展示样品组中各样品Alpha多样性的分布 第一种情 ...
- php字符串无乱码截取函数封装
/** * * 中英混合字符串长度判断 * @param unknown_type $str * @param unknown_type $charset */ function strLength( ...
- HDU 1907 John(博弈)
题目 参考了博客:http://blog.csdn.net/akof1314/article/details/4447709 //0 1 -2 //1 1 -1 //0 2 -1 //1 2 -1 / ...