⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stringtypes.out

📁 derby database source code.good for you.
💻 OUT
📖 第 1 页 / 共 5 页
字号:
ij> ---- this test shows the current supported char, varchar, and long varchar-- functionality---- create a table with null and non-null char columns of different lengthscreate table ct (c1 char, c2 char(5) not null, c3 char(30) default null);0 rows inserted/updated/deletedij> -- insert some rows-- first, try values that fill each column with non-blanksinsert into ct values ('1', '11111', '111111111111111111111111111111');1 row inserted/updated/deletedij> -- now try some values that are shorter than the columnsinsert into ct values ('', '22', '222');1 row inserted/updated/deletedij> -- now try some values that are longer than the columns, where the excess-- characters are blanksinsert into ct values ('3         ', '33333      ', '333333333333333333333333333333          ');1 row inserted/updated/deletedij> -- now try some values that are longer than the columns, where the excess-- characters are non-blanks.  These should get errorsinsert into ct values ('44', '4', '4');ERROR 22001: A truncation error was encountered trying to shrink CHAR '44' to length 1.ij> insert into ct values ('5', '555555', '5');ERROR 22001: A truncation error was encountered trying to shrink CHAR '555555' to length 5.ij> insert into ct values ('6', '66666', '6666666666666666666666666666666');ERROR 22001: A truncation error was encountered trying to shrink CHAR '6666666666666666666666666666666' to length 30.ij> -- now try inserting some nulls, first in columns that accept theminsert into ct values (null, '77777', null);1 row inserted/updated/deletedij> -- now try inserting nulls into columns that don't accept theminsert into ct values ('8', null, '8');ERROR 23502: Column 'C2'  cannot accept a NULL value.ij> -- now check the rows that made it into the table successfullyselect * from ct;C1  |C2   |C3                            -----------------------------------------1   |11111|111111111111111111111111111111    |22   |222                           3   |33333|333333333333333333333333333333NULL|77777|NULL                          ij> -- now try the char_length function on the columnsselect {fn length(c1)}, {fn length(c2)}, {fn length(c3)} from ct;1          |2          |3          -----------------------------------1          |5          |30         0          |2          |3          1          |5          |30         NULL       |5          |NULL       ij> -- now create a table with varchar columnscreate table vt (c1 varchar(1), c2 varchar(5) not null, c3 varchar(30) default null);0 rows inserted/updated/deletedij> -- insert some rows-- first, try values that fill each column with non-blanksinsert into vt values ('1', '11111', '111111111111111111111111111111');1 row inserted/updated/deletedij> -- now try some values that are shorter than the columnsinsert into vt values ('', '22', '222');1 row inserted/updated/deletedij> -- now try some values that are longer than the columns, where the excess-- characters are blanksinsert into vt values ('3         ', '33333      ', '333333333333333333333333333333          ');1 row inserted/updated/deletedij> -- now try some values that are longer than the columns, where the excess-- characters are non-blanks.  These should get errorsinsert into vt values ('44', '4', '4');ERROR 22001: A truncation error was encountered trying to shrink VARCHAR '44' to length 1.ij> insert into vt values ('5', '555555', '5');ERROR 22001: A truncation error was encountered trying to shrink VARCHAR '555555' to length 5.ij> insert into vt values ('6', '66666', '6666666666666666666666666666666');ERROR 22001: A truncation error was encountered trying to shrink VARCHAR '6666666666666666666666666666666' to length 30.ij> -- now try inserting some nulls, first in columns that accept theminsert into vt values (null, '77777', null);1 row inserted/updated/deletedij> -- now try inserting nulls into columns that don't accept theminsert into vt values ('8', null, '8');ERROR 23502: Column 'C2'  cannot accept a NULL value.ij> -- now check the rows that made it into the table successfullyselect * from vt;C1  |C2   |C3                            -----------------------------------------1   |11111|111111111111111111111111111111    |22   |222                           3   |33333|333333333333333333333333333333NULL|77777|NULL                          

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -