File tree Expand file tree Collapse file tree 6 files changed +107
-2
lines changed
Expand file tree Collapse file tree 6 files changed +107
-2
lines changed Original file line number Diff line number Diff line change 6161*** xref:master/7.18.adoc[18、Force View]
6262*** xref:master/7.19.adoc[19、嵌套子函数]
6363*** xref:master/7.20.adoc[20、sys_guid 函数]
64+ *** xref:master/7.21.adoc[21、空字符串转null]
6465** IvorySQL贡献指南
6566*** xref:master/8.1.adoc[社区贡献指南]
6667*** xref:master/8.2.adoc[asciidoc语法快速参考]
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ IvorySQL的sys_guid() 是一个强大的随机数产生函数,它产生并返
1212== 使用示例
1313
1414```
15- highgo =# select sys_guid() from dual;
15+ ivorysql =# select sys_guid() from dual;
1616 sys_guid
1717------------------------------------
1818 \x3ed9426c8a093442a38bea09a74f44a1
Original file line number Diff line number Diff line change 1+ :sectnums:
2+ :sectnumlevels: 5
3+
4+ :imagesdir: ./_images
5+
6+ = 兼容Oracle 空字符串转NULL
7+
8+ == 目的
9+
10+ - 在 IvorySQL 的 Oracle 兼容模式下,支持将空字符串转换成NULL进行存储,提供与Oracle数据库一致的行为。
11+
12+ == 功能说明
13+
14+ - Oracle兼容模式下支持将空字符串转换成NULL进行存储。
15+ - 通过参数 `ivorysql.enable_emptystring_to_null` 控制该特性,默认值为 `on`。
16+ - 当该参数开启时,插入空字符串会自动转换为NULL值存储。
17+ - 可以通过 `IS NULL` 条件查询到转换后的NULL值。
18+
19+ == 测试用例
20+
21+ [source,sql]
22+ ----
23+ -- 创建测试表
24+ ivorysql=# create table abc (id int);
25+ CREATE TABLE
26+
27+ -- 查看空字符串转NULL参数状态
28+ ivorysql=# show ivorysql.enable_emptystring_to_null;
29+ ivorysql.enable_emptystring_to_NULL
30+ -------------------------------------
31+ on
32+ (1 row)
33+
34+ -- 插入空字符串
35+ ivorysql=# insert into abc values('');
36+ INSERT 0 1
37+
38+ -- 查询表数据,显示为NULL
39+ ivorysql=# select * from abc;
40+ id
41+ ----
42+
43+ (1 row)
44+
45+ -- 使用IS NULL条件查询
46+ ivorysql=# select * from abc where id is null;
47+ id
48+ ----
49+
50+ (1 row)
51+ ----
Original file line number Diff line number Diff line change 6060** xref:master/7.18.adoc[18、Force View]
6161** xref:master/7.19.adoc[19、Nested Subfunctions]
6262** xref:master/7.20.adoc[20、sys_guid Function]
63+ ** xref:master/7.21.adoc[21、Empty String to NULL]
6364* xref:master/8.adoc[Community contribution]
6465* xref:master/9.adoc[Tool Reference]
6566* xref:master/10.adoc[FAQ]
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ IvorySQL's sys_guid() is a powerful random number generation function that gener
1212== Usage example
1313
1414```
15- highgo =# select sys_guid() from dual;
15+ ivorysql =# select sys_guid() from dual;
1616 sys_guid
1717------------------------------------
1818 \x3ed9426c8a093442a38bea09a74f44a1
Original file line number Diff line number Diff line change 1+ :sectnums:
2+ :sectnumlevels: 5
3+
4+ :imagesdir: ./_images
5+
6+ = Oracle Compatible Empty String to NULL
7+
8+ == Purpose
9+
10+ - In IvorySQL's Oracle compatibility mode, support converting empty strings to NULL for storage, providing behavior consistent with Oracle Database.
11+
12+ == Feature Description
13+
14+ - Oracle compatibility mode supports converting empty strings to NULL for storage.
15+ - The feature is controlled by parameter `ivorysql.enable_emptystring_to_null`, with default value `on`.
16+ - When this parameter is enabled, inserting an empty string will automatically convert it to NULL value for storage.
17+ - NULL values after conversion can be queried using the `IS NULL` condition.
18+
19+ == Test Cases
20+
21+ [source,sql]
22+ ----
23+ -- Create test table
24+ ivorysql=# create table abc (id int);
25+ CREATE TABLE
26+
27+ -- Check empty string to NULL parameter status
28+ ivorysql=# show ivorysql.enable_emptystring_to_null;
29+ ivorysql.enable_emptystring_to_NULL
30+ -------------------------------------
31+ on
32+ (1 row)
33+
34+ -- Insert empty string
35+ ivorysql=# insert into abc values('');
36+ INSERT 0 1
37+
38+ -- Query table data, displays as NULL
39+ ivorysql=# select * from abc;
40+ id
41+ ----
42+
43+ (1 row)
44+
45+ -- Query using IS NULL condition
46+ ivorysql=# select * from abc where id is null;
47+ id
48+ ----
49+
50+ (1 row)
51+ ----
52+
You can’t perform that action at this time.
0 commit comments