功能简介
兼容oracle char表示法, 支持指定byte或char, 默认char 。
从LightDB 23.2版本开始,LightDB char类型支持指定byte或char, 默认char。
仅是语法糖功能,兼容Oracle语法,没有实现对应的功能。
用法
create table t1(id int, name char(10));
insert into t1 values(1, '你好呀,你在干什么呢');
insert into t1 values(1, '你好呀,你在干什么呢?');
insert into t1 values(2, 'abcdefghij');
insert into t1 values(2, 'abcdefghijk');
drop table t1;
create table t2(id int, name char(10 byte));
insert into t2 values(1, '你好呀,你在干什么呢');
insert into t2 values(1, '你好呀,你在干什么呢?');
insert into t2 values(2, 'abcdefghij');
insert into t2 values(2, 'abcdefghijk');
drop table t2;
create table t3(id int, name char(10 char));
insert into t3 values(1, '你好呀,你在干什么呢');
insert into t3 values(1, '你好呀,你在干什么呢?');
insert into t3 values(2, 'abcdefghij');
insert into t3 values(2, 'abcdefghijk');
drop table t3;
create table t4(id int, name char(10 BYTE));
insert into t4 values(1, '你好呀,你在干什么呢');
insert into t4 values(1, '你好呀,你在干什么呢?');
insert into t4 values(2, 'abcdefghij');
insert into t4 values(2, 'abcdefghijk');
drop table t4;
create table t5(id int, name char(10 CHAR));
insert into t5 values(1, '你好呀,你在干什么呢');
insert into t5 values(1, '你好呀,你在干什么呢?');
insert into t5 values(2, 'abcdefghij');
insert into t5 values(2, 'abcdefghijk');
drop table t5;
create table t6(id int, name char(10 bYte));
insert into t6 values(1, '你好呀,你在干什么呢');
insert into t6 values(1, '你好呀,你在干什么呢?');
insert into t6 values(2, 'abcdefghij');
insert into t6 values(2, 'abcdefghijk');
drop table t6;
create table t7(id int, name char(10 ChAr));
insert into t7 values(1, '你好呀,你在干什么呢');
insert into t7 values(1, '你好呀,你在干什么呢?');
insert into t7 values(2, 'abcdefghij');
insert into t7 values(2, 'abcdefghijk');
drop table t7;
create table t8(id int, name char(10 haha));
create table t8(id int, name char(0));
create table t8(id int, name char(0 byte));
create table t8(id int, name char(0 char));
create table t8(id int, name char(-1));
create table t8(id int, name char(-1 byte));
create table t8(id int, name char(-1 char));
create table t8(id int, name char(10 byte));
CREATE OR REPLACE PROCEDURE insert_into_t8(p_id in integer, p_name in char(10 byte))
AS $$
BEGIN
insert into t8 values(p_id, p_name);
END; $$
LANGUAGE plpgsql;
call insert_into_t8(1, '你好呀,你在干什么呢');
select * from t8;
call insert_into_t8(1, '你好呀,你在干什么呢?');
drop PROCEDURE insert_into_t8(p_id in integer, p_name in char(10 byte));
drop table t8;
create table t1(name character(10 byte));
create table t2(name char(10 char));
create table t3(name varchar(10 char));
create table t4(name character varying(10 byte));
drop table t1;
drop table t2;
drop table t3;
drop table t4;