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 VARCHAR2 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就不行了. 这里,就用最简单的例子说明存储过程返回 ...
随机推荐
- native2ascii运用
1.native2ascii命令行的格式 native2ascii -[option] [inputfile [outputfile]] 说明: -[option]:表示命令开关,有两个选项可供选择: ...
- [Apple开发者帐户帮助]九、参考(6)支持的功能(watchOS)
watchOS扩展可用的功能取决于您的程序成员身份. 注意:对于watchOS应用程序目标,可用的功能是应用程序组和后台模式,并且不依赖于您的程序成员身份. 能力 ADP 企业 Apple开发者 应用 ...
- Xampp mysql无法启动的解决方案
如果出现mysql 无法启动表明在安装xampp 前已经安装了mysql,造成mysql服务无法启动. 19:06:33 [mysql] MySQL Service detected with wr ...
- [ CQOI 2009 ] 中位数图
\(\\\) \(Description\) 给出\(N\)的一个全排列,统计该排列有多少个长度为奇数的连续子序列,中位数是\(B\). \(N\in [0,10^5]\),\(B\in [0,N]\ ...
- Bootstrap3模态框Modal垂直居中样式
1,Bootstrap 模态框插件Bootbox垂直居中样式: <!DOCTYPE html> <html lang="en"> <head> ...
- Failed to resolve com.android.support:support-annotations 26.0.1
所有当前版本的Google库都存放在 Google的Maven repository (maven.google.com),不在旧的offline-capable support repositori ...
- Android项目实战_手机安全卫士手机防盗界面
#安全卫士手机防盗# ###1.Activity的任务栈 1.类似一个木桶,每层只能放一个木块,我们放入木块和取出木块的时候只能从最上面开始操作 ###2.Android中的坐标系 from t8) select @i --第二种 declare @i int select ...
- 【转载】HTTP 基础与变迁
原文地址:https://segmentfault.com/a/1190000006689489 HTTP HTTP(HyperTextTransferProtocol)是超文本传输协议的缩写,它用于 ...