github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/func_string_oct.test (about)

     1  #SELECT, 科学计数
     2  -- @bvt:issue#3156
     3  select oct(0b11111111);
     4  -- @bvt:issue
     5  
     6  select oct(12);
     7  SELECT oct(1314);
     8  
     9  select oct(2e5);
    10  
    11  #NULL
    12  SELECT oct(null);
    13  
    14  #嵌套
    15  SELECT concat_ws(",", oct(1000), oct(2000));
    16  
    17  
    18  #EXTREME VALUES
    19  select oct(0);
    20  select oct(-1);
    21  
    22  select oct(10e50);
    23  select oct(-10e50);
    24  select oct(0.00000000000000000000000001);
    25  select oct(-0.00000000000000000000000001);
    26  select oct("你好");
    27  
    28  create table t1(a int);
    29  insert into t1 values();
    30  select oct(a) from t1;
    31  drop table t1;
    32  
    33  
    34  #DATA TYPES
    35  
    36  create table t1(a tinyint, b SMALLINT, c BIGINT, d INT, e BIGINT, f FLOAT, g DOUBLE, h decimal(38,19), i DATE, k datetime, l TIMESTAMP, m char(255), n varchar(255));
    37  insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314, "2012-03-12", "2012-03-12 10:03:12", "2012-03-12 13:03:12", "abc", "dcf");
    38  insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314, "2012-03-12", "2012-03-12 10:03:12", "2012-03-12 13:03:12", "abc", "dcf");
    39  insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314, "2012-03-12", "2012-03-12 10:03:12", "2012-03-12 13:03:12", "abc", "dcf");
    40  insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314, "2012-03-12", "2012-03-12 10:03:12", "2012-03-12 13:03:12", "abc", "dcf");
    41  select oct(a),oct(b),oct(c),oct(d),oct(e),oct(f),oct(g),oct(h),oct(i),oct(k),oct(l),oct(m),oct(n) from t1;
    42  drop table t1;
    43  
    44  
    45  #INSERT,distinct
    46  
    47  CREATE TABLE t1(a char(255), b varchar(255));
    48  INSERT INTO t1 select oct(56), oct(234);
    49  INSERT INTO t1 select oct(100), oct(234);
    50  SELECT distinct oct(a), oct(b) FROM t1 ORDER BY oct(a);
    51  drop table t1;
    52  
    53  
    54  #HAVING, 比较运算
    55  CREATE TABLE t1 (a int);
    56  INSERT INTO t1 VALUES (100), (12);
    57  SELECT a FROM t1
    58  HAVING oct(a) <>0;
    59  DROP TABLE t1;
    60  
    61  #WHERE, 算术运算
    62  drop table if exists t1;
    63  create table t1(a INT,  b int);
    64  insert into t1 values(1, 2),(2, 3),(3, 4),(4, 5);
    65  select oct(a)+oct(b) from t1 where oct(a)+oct(b)<>0;
    66  drop table t1;
    67  
    68  #ON CONDITION
    69  CREATE TABLE t1 (a int);
    70  CREATE TABLE t2 (a int);
    71  INSERT INTO t1 VALUES (100), (200), (300), (10);
    72  INSERT INTO t2 VALUES (100), (50), (20), (10), (300);
    73  SELECT t1.a, t2.a FROM t1 JOIN t2 ON (oct(t1.a) = oct(t2.a));
    74  drop table t1;
    75  drop table t2;
    76  
    77  SELECT OCT(NULL) IS UNKNOWN;
    78