📄 ejbql.out
字号:
-100000000 NULL 1000000000000000000000000000000 -1000000000000000000000000000000ij> select -a from myDecimal;1 --------------------------------NULL 0 0 -1 1 -100000000 100000000 NULL -10000000000000000000000000000001000000000000000000000000000000 ij> select b from myDecimal;B ----------------------------------0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.1000000000000000000000000000000 -0.1000000000000000000000000000000NULL 0.0000000000000000000000000000010 -0.0000000000000000000000000000010ij> select -b from myDecimal;1 ----------------------------------0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 -0.10000000000000000000000000000000.1000000000000000000000000000000 NULL -0.00000000000000000000000000000100.0000000000000000000000000000010 ij> select abs(a) from myDecimal;1 --------------------------------NULL 0 0 1 1 100000000 100000000 NULL 1000000000000000000000000000000 1000000000000000000000000000000 ij> select abs(-a) from myDecimal;1 --------------------------------NULL 0 0 1 1 100000000 100000000 NULL 1000000000000000000000000000000 1000000000000000000000000000000 ij> select -abs(a) from myDecimal;1 --------------------------------NULL 0 0 -1 -1 -100000000 -100000000 NULL -1000000000000000000000000000000-1000000000000000000000000000000ij> select abs(abs(-abs(-abs(a)))) from myDecimal;1 --------------------------------NULL 0 0 1 1 100000000 100000000 NULL 1000000000000000000000000000000 1000000000000000000000000000000 ij> SELECT ABSVAL(ABSVAL(-ABSVAL(-ABSVAL(A)))) FROM MYDECIMAL;1 --------------------------------NULL 0 0 1 1 100000000 100000000 NULL 1000000000000000000000000000000 1000000000000000000000000000000 ij> select distinct abs(a) from myDecimal;1 --------------------------------0 1 100000000 1000000000000000000000000000000 NULL ij> select abs(b) from myDecimal;1 ----------------------------------0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.1000000000000000000000000000000 0.1000000000000000000000000000000 NULL 0.0000000000000000000000000000010 0.0000000000000000000000000000010 ij> select abs(-b) from myDecimal;1 ----------------------------------0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.1000000000000000000000000000000 0.1000000000000000000000000000000 NULL 0.0000000000000000000000000000010 0.0000000000000000000000000000010 ij> select -abs(b) from myDecimal;1 ----------------------------------0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 -0.1000000000000000000000000000000-0.1000000000000000000000000000000NULL -0.0000000000000000000000000000010-0.0000000000000000000000000000010ij> select abs(abs(-abs(-abs(b)))) from myDecimal;1 ----------------------------------0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.1000000000000000000000000000000 0.1000000000000000000000000000000 NULL 0.0000000000000000000000000000010 0.0000000000000000000000000000010 ij> SELECT ABSVAL(ABSVAL(-ABSVAL(-ABSVAL(B)))) FROM MYDECIMAL;1 ----------------------------------0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.0000000000000000000000000000000 0.1000000000000000000000000000000 0.1000000000000000000000000000000 NULL 0.0000000000000000000000000000010 0.0000000000000000000000000000010 ij> select distinct abs(b) from myDecimal;1 ----------------------------------0.0000000000000000000000000000000 0.0000000000000000000000000000010 0.1000000000000000000000000000000 NULL ij> -- There is nothing wrong with returning 1.0. The decimal overflows and this is just the way it behaves. Needs to make this compatible with jdk1.1.8(which had a bug).select abs(-abs(a)) + 1 from myDecimal;1 --------------------------------NULL 1 1 2 2 100000001 100000001 NULL 1000000000000000000000000000001 1000000000000000000000000000001 ij> drop table myDecimal;0 rows inserted/updated/deletedij> -- End of Decimal test-- Numeric java.math.BigDecimal-- Basiccreate table myNumeric( a decimal(31,0), b decimal(31,31 ));0 rows inserted/updated/deletedij> select abs(a) from myNumeric;1 --------------------------------ij> insert into myNumeric values (null), (+0), (-0), (+1), (-1),(100000000), (-100000000), (null),(1.0e31, ,1.0e-31),(-1.0e31, -1.0e-31 ), select a from myNumeric;ERROR 42X80: VALUES clause must contain at least one element. Empty elements are not allowed. ij> select -a from myNumeric;1 --------------------------------ij> select b from myNumeric;B ----------------------------------ij> select -b from myNumeric;1 ----------------------------------ij> select abs(a), abs(b)from myNumeric;1 |2 -------------------------------------------------------------------ij> select abs(-a), abs(-b) from myNumeric;1 |2 -------------------------------------------------------------------ij> select -abs(a), -abs(b) from myNumeric;1 |2 -------------------------------------------------------------------ij> select abs(abs(-abs(-abs(a)))) from myNumeric;1 --------------------------------ij> SELECT ABSVAL(ABSVAL(-ABSVAL(-ABSVAL(A)))) FROM MYNUMERIC;1 --------------------------------ij> select distinct abs(a) from myNumeric;1 --------------------------------ij> -- There is nothing wrong with returning 1.0. The numeric overflows and this is just the way it behaves. Needs to make this compatible with jdk1.1.8(which had a bug).select abs(-abs(a)) + 1 from myNumeric;1 --------------------------------ij> drop table myNumeric;0 rows inserted/updated/deletedij> -- End of Numeric test-- Test some different statements, just in casecreate table foo( a int );0 rows inserted/updated/deletedij> insert into foo values ( abs( 1) );1 row inserted/updated/deletedij> insert into foo values ( abs(-2) );1 row inserted/updated/deletedij> insert into foo values (-abs(-3) );1 row inserted/updated/deletedij> insert into foo values (-abs( 4) );1 row inserted/updated/deletedij> insert into foo values ( -5 );1 row inserted/updated/deletedij> insert into foo values ( -6 );1 row inserted/updated/deletedij> insert into foo values ( -7 );1 row inserted/updated/deletedij> autocommit off;ij> prepare p1 as 'select a from foo';ij> prepare p2 as 'select abs(a) from foo';ij> prepare p3 as 'insert into foo select a*(-1) from foo';ij> execute p1;A -----------1 2 -3 -4 -5 -6 -7 ij> execute p2;1 -----------1 2 3 4 5 6 7 ij> execute p3;7 rows inserted/updated/deletedij> execute p1;A -----------1 2 -3 -4 -5 -6 -7 -1 -2 3 4 5 6 7 ij> insert into foo values( abs( 8 ) );1 row inserted/updated/deletedij> insert into foo values( abs(-9 ) );1 row inserted/updated/deletedij> insert into foo values(-abs(-10) );1 row inserted/updated/deletedij> insert into foo values( abs( 11) );1 row inserted/updated/deletedij> insert into foo values( -12 );1 row inserted/updated/deletedij> execute p1;A -----------1 2 -3 -4 -5 -6 -7 -1 -2 3 4 5 6 7 8 9 -10 11 -12 ij> execute p2;1 -----------1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 9 10 11 12 ij> execute p3;19 rows inserted/updated/deletedij> execute p1;A -----------1 2 -3 -4 -5 -6 -7 -1 -2 3 4 5 6 7 8 9 -10 11 -12 -1 -2 3 4 5 6 7 1 2 -3 -4 -5 -6 -7 -8 -9 10 -11 12 ij> rollback;ij> commit;ij> autocommit on;ij> insert into foo values( abs( 13) );1 row inserted/updated/deletedij> insert into foo values( abs(-14) );1 row inserted/updated/deletedij> insert into foo values(-abs(-15) );1 row inserted/updated/deletedij> insert into foo values(-abs( 16) );1 row inserted/updated/deletedij> insert into foo values( -17 );1 row inserted/updated/deletedij> execute p1;A -----------1 2 -3 -4 -5 -6 -7 13 14
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -