LightDB char类型字符长度兼容

功能简介

兼容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;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值