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就不行了. 这里,就用最简单的例子说明存储过程返回 ...
随机推荐
- JavaScript(JS)的简单使用
一.什么是JS(Javascript)? Javascript是一种脚本语言,被广泛用于Web应用开发,常用来为网页添加各式各样的功能,为用户提供更加流畅的浏览效果. Javascript严格区分大小 ...
- linux top 的用法
本篇博文主要讲解有关top命令,top命令的主要功能是查看进程活动状态以及一些系统状况. TOP是一个动态显示过程,即可以通过用户按键来不断刷新当前状态.如果在前台执行该命令,它将独占前台,直到用户终 ...
- 手势识别官方教程(7)识别缩放手势用ScaleGestureDetector和SimpleOnScaleGestureListener
1.Use Touch to Perform Scaling As discussed in Detecting Common Gestures, GestureDetector helps you ...
- action="post" 、 servletconfig 、 servletcontext 、getPrintWiter() 、context-param、 init-param(第一个完整的servlet)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <hea ...
- 传值:web.xml传递参数 即在Servlet中获取web.xml里的值
传值:web.xml传递参数 在web.xml中的Servlet里配置多个init-param <servlet> ... <init-param> <param-nam ...
- centos安装composer以及使用国内镜像
下载composer.phar文件 curl -sS https://getcomposer.org/installer | php 将composer.phar移动到环境变量中并且更名为compos ...
- C#用Microsoft.Office.Interop.Word进行Word转PDF的问题
之前用Aspose.Word进行Word转PDF发现'\'这个字符会被转换成'¥'这样的错误,没办法只能换个方法了.下面是Microsoft.Office.Interop.Word转PDF的方法: p ...
- Java 中 父类变量访问子类方法 需要使用 类型转换 (instenceof)关键字 /类型判断/
通过数组元素访问方法的时候只能访问在 Animal中定义的方法,对 于 Tiger类和 Fish中定义的方法时却不能调用,例如语句 animal[2].swim();就是不正确的.当 需要访问这些 ...
- 开源业务规则引擎JBoss Drools
Drools 是什么? 规则引擎由推理引擎发展而来,是一种嵌入在应用程序中的组件,实现了将业务决策从应用程序代码中分离出来,并使用预定义的语义模块编写业务决策.接受数据输入,解释业务规则,并根据业务规 ...
- svg文件使用highmap显示
svg文件使用highmap显示 highmap,ammap都是比较好的第三方插件用来显示svg图片: ammap导航可能更美观点(这个highmap后面可能也会赶上), highma ...