Add a test case

2024-12-02 03:48:26  Updated

This topic describes how to add a test case.

Procedure

Perform the following steps to add a version-related test case to test_suite/version:

Note

To test the create table like feature, make sure that the test case name reflects the test point. For example, the name create_table_like_syntax.test indicates a syntax-level test case.

  1. Go to the test directory:

    cd oceanbase/test
    
  2. Enter the content of the test case file:

    vi mysql_test/test_suite/version/t/sample.test
    
  3. Generate the result file:

    ./obd.sh mysqltest -n <deploy name> --test-set version.sample --record
    
  4. Verify the result file. This step can be completed by comparing the execution results of an OceanBase database and those of a MySQL database.

    mv mysql_test/test_suite/version/r/mysql/sample.record mysql_test/test_suite/version/r/mysql/sample.result
    
  5. Run the following command to ensure that the case file version.sample can run properly:

    ./obd.sh mysqltest -n <deploy name> --test-set version.sample
    
  6. Submit both the test file and result file when you run the git add command.

Example

Take the test case sequence_sql_demo_mysql.test as an example. This test case aims to test basic sequence features. The content beginning with a number sign (#) is a comment.

Test file

purge recyclebin;
let $char_charset = 'utf8';
--disable_warnings
drop database IF EXISTS oblrp;
--enable_warnings
create database oblrp;
use oblrp;
set timestamp = 1600000000;
set ob_trx_timeout = 10000000000;
set ob_query_timeout = 10000000000;
--result_format 4


--echo Query a sequence.
--error 0,1051
drop table t1;
create table tt1(id int);
insert into tt1 values(1);

--error 0,1051
drop table a;
create table a (id int, name varchar(30), pk_id int);
insert into a values(1,'name01',1);
insert into a values(2,'name02',1);
insert into a values(3,'name03',2);
insert into a values(4,'name04',3);
insert into a values(5,'name05',3);
insert into a values(6,'name06',3);
--error 0,1051
drop table b;
create table b (id int, name varchar(30));
insert into b values(1,'name01');
insert into b values(2,'name02');
insert into b values(3,'name03');

--echo Set the sequence attributes.
--error 0,4298
drop sequence seq_test1;
create sequence seq_test1;
--error 0,4298
drop sequence seq_test2;
create sequence seq_test2 INCREMENT BY 1 start with 1 minvalue 1 maxvalue 5 cycle noorder cache 3;
--error 0,4298
drop sequence seq_test3;
create sequence seq_test3 INCREMENT BY 1 start with 1 minvalue 1 maxvalue 5 nocycle noorder nocache;

--echo Access the sequence.
select seq_test1.currval from a where id =0;
select seq_test1.nextval from a where id =0;
--error 4201
select seq_test1.currval from a;
select seq_test1.nextval , id ,name from a ;
select seq_test1.currval c ,seq_test1.nextval b from a;
select seq_test2.currval c ,seq_test2.nextval b from a;
--error 4332
select seq_test3.currval c ,seq_test3.nextval b from a;
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id =1;
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id >1;
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id <1;
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id <3;
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id <=2;
select seq_test1.currval c ,seq_test1.nextval b,id ,name from a where pk_id>=2;
select seq_test2.currval c ,seq_test2.nextval b,id ,name from a where pk_id>=1;
select seq_test1.currval c ,seq_test1.nextval b ,a.* from a a where id <>1;
--error 4332
select seq_test3.currval c ,seq_test3.nextval b,id ,name from a where pk_id=3;
select seq_test1.currval c ,seq_test1.nextval b,id ,name from a where pk_id>=2 and id=3;
select seq_test2.currval c ,seq_test2.nextval b,id ,name from a where pk_id>=2 or id=3;
select seq_test1.currval c ,seq_test2.nextval b ,a.* from a a where id between  2 and 3;
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where name like '%name%';
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where name not like '%name%';
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where exists (select * from b);
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where id >any (select id from b);
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where id >all (select id from b);
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where id in (select id from b where name ='name02');
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a left join b b on a.pk_id =b.id;
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a full join b b on a.pk_id =b.id;
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a right join b b on a.pk_id =b.id;
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a inner join b b on a.pk_id =b.id;

--echo Access the sequence in subqueries.

select  (case id when 1 then seq_test1.nextval
when 2 then seq_test2.nextval
else seq_test1.currval end )  e from a;

select  (case id when seq_test1.nextval then 1
when  seq_test1.currval then 2
else 3 end )  e from a;
--error 1054
select * from a group by id,seq_test1.nexval;
--error 4315
select * from a order by id,seq_test1.nextval;
--error 4315
select * from a where seq_test1.nextval>2;
--error 4315
select * from a where seq_test1.currval>2;

select seq_test1.currval+1 from a;
select seq_test1.nextval+1 from a;
select seq_test1.currval+seq_test1.nextval from a;
select seq_test1.nextval+abs(-1) from a;
select seq_test1.currval+abs(-1) from a;
select seq_test1.nextval*2 from a;
select seq_test1.currval*2 from a;
select seq_test1.nextval-2 from a;
select seq_test1.currval-2 from a;
select seq_test1.nextval/3 from a;
select seq_test1.currval/3 from a;
select seq_test1.currval mod seq_test1.nextval from a;
select seq_test1.nextval div seq_test1.currval from a;
select -seq_test1.currval from a;
select -seq_test1.nextval from a;
select +seq_test1.nextval from a;
select +seq_test1.currval from a;

create table  c as select seq_test1.currval,seq_test1.nextval from a;
--disable_result_log
explain select seq_test1.currval,seq_test1.nextval from a;
--enable_result_log

--echo Process the sequence in functions.
select concat( seq_test1.currval,seq_test1.nextval) from a;
select ascii(seq_test1.nextval) from a;
select length(seq_test1.currval) from a;
select acos(seq_test1.currval) from a;
select pow(seq_test1.nextval,seq_test1.currval) from a;
select cast(seq_test1.currval as time) from a;
select isnull(seq_test1.nextval) from a;
--error 1064
select CURRENT_TIME(seq_test1.nextval) from a;

--error 0,4298
drop sequence seq_test1;
--echo  ########Purge the recycle bin and delete the test database and tables. ##########
--disable_warnings
drop database  IF EXISTS  oblrp;
--enable_warnings
purge recyclebin;

Expected result file

Content of sequence_sql_demo_mysql.result is as follows:

purge recyclebin;
drop database IF EXISTS oblrp;
create database oblrp;
use oblrp;
set timestamp = 1600000000;
set ob_trx_timeout = 10000000000;
set ob_query_timeout = 10000000000;
result_format: 4
Query a sequence.
drop table t1;
create table tt1(id int);
insert into tt1 values(1);
drop table a;
create table a (id int, name varchar(30), pk_id int);
insert into a values(1,'name01',1);
insert into a values(2,'name02',1);
insert into a values(3,'name03',2);
insert into a values(4,'name04',3);
insert into a values(5,'name05',3);
insert into a values(6,'name06',3);
drop table b;
create table b (id int, name varchar(30));
insert into b values(1,'name01');
insert into b values(2,'name02');
insert into b values(3,'name03');
Set the sequence attributes.
drop sequence seq_test1;
create sequence seq_test1;
drop sequence seq_test2;
create sequence seq_test2 INCREMENT BY 1 start with 1 minvalue 1 maxvalue 5 cycle noorder cache 3;
drop sequence seq_test3;
create sequence seq_test3 INCREMENT BY 1 start with 1 minvalue 1 maxvalue 5 nocycle noorder nocache;
Access the sequence.
select seq_test1.currval from a where id =0;
+---------+
| currval |
+---------+
+---------+
select seq_test1.nextval from a where id =0;
+---------+
| nextval |
+---------+
+---------+
select seq_test1.currval from a;
ERROR HY000: sequence is not yet defined in this session
select seq_test1.nextval , id ,name from a ;
+---------+------+--------+
| nextval | id   | name   |
+---------+------+--------+
|       1 |    1 | name01 |
|       2 |    2 | name02 |
|       3 |    3 | name03 |
|       4 |    4 | name04 |
|       5 |    5 | name05 |
|       6 |    6 | name06 |
+---------+------+--------+
select seq_test1.currval c ,seq_test1.nextval b from a;
+----+----+
| c  | b  |
+----+----+
|  7 |  7 |
|  8 |  8 |
|  9 |  9 |
| 10 | 10 |
| 11 | 11 |
| 12 | 12 |
+----+----+
select seq_test2.currval c ,seq_test2.nextval b from a;
+---+---+
| c | b |
+---+---+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 1 | 1 |
+---+---+
select seq_test3.currval c ,seq_test3.nextval b from a;
ERROR HY000: sequence exceeds MAXVALUE and cannot be instantiated
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id =1;
+----+----+
| c  | b  |
+----+----+
| 13 | 13 |
| 14 | 14 |
+----+----+
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id >1;
+----+----+
| c  | b  |
+----+----+
| 15 | 15 |
| 16 | 16 |
| 17 | 17 |
| 18 | 18 |
+----+----+
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id <1;
+---+---+
| c | b |
+---+---+
+---+---+
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id <3;
+----+----+
| c  | b  |
+----+----+
| 19 | 19 |
| 20 | 20 |
| 21 | 21 |
+----+----+
select seq_test1.currval c ,seq_test1.nextval b from a where pk_id <=2;
+----+----+
| c  | b  |
+----+----+
| 22 | 22 |
| 23 | 23 |
| 24 | 24 |
+----+----+
select seq_test1.currval c ,seq_test1.nextval b,id ,name from a where pk_id>=2;
+----+----+------+--------+
| c  | b  | id   | name   |
+----+----+------+--------+
| 25 | 25 |    3 | name03 |
| 26 | 26 |    4 | name04 |
| 27 | 27 |    5 | name05 |
| 28 | 28 |    6 | name06 |
+----+----+------+--------+
select seq_test2.currval c ,seq_test2.nextval b,id ,name from a where pk_id>=1;
+---+---+------+--------+
| c | b | id   | name   |
+---+---+------+--------+
| 2 | 2 |    1 | name01 |
| 3 | 3 |    2 | name02 |
| 4 | 4 |    3 | name03 |
| 5 | 5 |    4 | name04 |
| 1 | 1 |    5 | name05 |
| 2 | 2 |    6 | name06 |
+---+---+------+--------+
select seq_test1.currval c ,seq_test1.nextval b ,a.* from a a where id <>1;
+----+----+------+--------+-------+
| c  | b  | id   | name   | pk_id |
+----+----+------+--------+-------+
| 29 | 29 |    2 | name02 |     1 |
| 30 | 30 |    3 | name03 |     2 |
| 31 | 31 |    4 | name04 |     3 |
| 32 | 32 |    5 | name05 |     3 |
| 33 | 33 |    6 | name06 |     3 |
+----+----+------+--------+-------+
select seq_test3.currval c ,seq_test3.nextval b,id ,name from a where pk_id=3;
ERROR HY000: sequence exceeds MAXVALUE and cannot be instantiated
select seq_test1.currval c ,seq_test1.nextval b,id ,name from a where pk_id>=2 and id=3;
+----+----+------+--------+
| c  | b  | id   | name   |
+----+----+------+--------+
| 34 | 34 |    3 | name03 |
+----+----+------+--------+
select seq_test2.currval c ,seq_test2.nextval b,id ,name from a where pk_id>=2 or id=3;
+---+---+------+--------+
| c | b | id   | name   |
+---+---+------+--------+
| 3 | 3 |    3 | name03 |
| 4 | 4 |    4 | name04 |
| 5 | 5 |    5 | name05 |
| 1 | 1 |    6 | name06 |
+---+---+------+--------+
select seq_test1.currval c ,seq_test2.nextval b ,a.* from a a where id between  2 and 3;
+----+---+------+--------+-------+
| c  | b | id   | name   | pk_id |
+----+---+------+--------+-------+
| 34 | 2 |    2 | name02 |     1 |
| 34 | 3 |    3 | name03 |     2 |
+----+---+------+--------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where name like '%name%';
+----+---+---------+------+--------+-------+
| c  | b | currval | id   | name   | pk_id |
+----+---+---------+------+--------+-------+
| 34 | 4 |       4 |    1 | name01 |     1 |
| 34 | 5 |       5 |    2 | name02 |     1 |
| 34 | 1 |       1 |    3 | name03 |     2 |
| 34 | 2 |       2 |    4 | name04 |     3 |
| 34 | 3 |       3 |    5 | name05 |     3 |
| 34 | 4 |       4 |    6 | name06 |     3 |
+----+---+---------+------+--------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where name not like '%name%';
+---+---+---------+------+------+-------+
| c | b | currval | id   | name | pk_id |
+---+---+---------+------+------+-------+
+---+---+---------+------+------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where exists (select * from b);
+----+---+---------+------+--------+-------+
| c  | b | currval | id   | name   | pk_id |
+----+---+---------+------+--------+-------+
| 34 | 5 |       5 |    1 | name01 |     1 |
| 34 | 1 |       1 |    2 | name02 |     1 |
| 34 | 2 |       2 |    3 | name03 |     2 |
| 34 | 3 |       3 |    4 | name04 |     3 |
| 34 | 4 |       4 |    5 | name05 |     3 |
| 34 | 5 |       5 |    6 | name06 |     3 |
+----+---+---------+------+--------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where id >any (select id from b);
+----+---+---------+------+--------+-------+
| c  | b | currval | id   | name   | pk_id |
+----+---+---------+------+--------+-------+
| 34 | 1 |       1 |    2 | name02 |     1 |
| 34 | 2 |       2 |    3 | name03 |     2 |
| 34 | 3 |       3 |    4 | name04 |     3 |
| 34 | 4 |       4 |    5 | name05 |     3 |
| 34 | 5 |       5 |    6 | name06 |     3 |
+----+---+---------+------+--------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where id >all (select id from b);
+----+---+---------+------+--------+-------+
| c  | b | currval | id   | name   | pk_id |
+----+---+---------+------+--------+-------+
| 34 | 1 |       1 |    4 | name04 |     3 |
| 34 | 2 |       2 |    5 | name05 |     3 |
| 34 | 3 |       3 |    6 | name06 |     3 |
+----+---+---------+------+--------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a where id in (select id from b where name ='name02');
+----+---+---------+------+--------+-------+
| c  | b | currval | id   | name   | pk_id |
+----+---+---------+------+--------+-------+
| 34 | 4 |       4 |    2 | name02 |     1 |
+----+---+---------+------+--------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a left join b b on a.pk_id =b.id;
+----+---+---------+------+--------+-------+
| c  | b | currval | id   | name   | pk_id |
+----+---+---------+------+--------+-------+
| 34 | 5 |       5 |    1 | name01 |     1 |
| 34 | 1 |       1 |    2 | name02 |     1 |
| 34 | 2 |       2 |    3 | name03 |     2 |
| 34 | 3 |       3 |    4 | name04 |     3 |
| 34 | 4 |       4 |    5 | name05 |     3 |
| 34 | 5 |       5 |    6 | name06 |     3 |
+----+---+---------+------+--------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a full join b b on a.pk_id =b.id;
+----+---+---------+------+--------+-------+
| c  | b | currval | id   | name   | pk_id |
+----+---+---------+------+--------+-------+
| 34 | 1 |       1 |    1 | name01 |     1 |
| 34 | 2 |       2 |    2 | name02 |     1 |
| 34 | 3 |       3 |    3 | name03 |     2 |
| 34 | 4 |       4 |    4 | name04 |     3 |
| 34 | 5 |       5 |    5 | name05 |     3 |
| 34 | 1 |       1 |    6 | name06 |     3 |
+----+---+---------+------+--------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a right join b b on a.pk_id =b.id;
+----+---+---------+------+--------+-------+
| c  | b | currval | id   | name   | pk_id |
+----+---+---------+------+--------+-------+
| 34 | 2 |       2 |    1 | name01 |     1 |
| 34 | 3 |       3 |    2 | name02 |     1 |
| 34 | 4 |       4 |    3 | name03 |     2 |
| 34 | 5 |       5 |    4 | name04 |     3 |
| 34 | 1 |       1 |    5 | name05 |     3 |
| 34 | 2 |       2 |    6 | name06 |     3 |
+----+---+---------+------+--------+-------+
select seq_test1.currval c ,seq_test2.nextval b, seq_test2.currval ,a.* from a inner join b b on a.pk_id =b.id;
+----+---+---------+------+--------+-------+
| c  | b | currval | id   | name   | pk_id |
+----+---+---------+------+--------+-------+
| 34 | 3 |       3 |    1 | name01 |     1 |
| 34 | 4 |       4 |    2 | name02 |     1 |
| 34 | 5 |       5 |    3 | name03 |     2 |
| 34 | 1 |       1 |    4 | name04 |     3 |
| 34 | 2 |       2 |    5 | name05 |     3 |
| 34 | 3 |       3 |    6 | name06 |     3 |
+----+---+---------+------+--------+-------+
Access the sequence in subqueries.
select  (case id when 1 then seq_test1.nextval
when 2 then seq_test2.nextval
else seq_test1.currval end )  e from a;
+----+
| e  |
+----+
| 35 |
|  5 |
| 37 |
| 38 |
| 39 |
| 40 |
+----+
select  (case id when seq_test1.nextval then 1
when  seq_test1.currval then 2
else 3 end )  e from a;
+---+
| e |
+---+
| 3 |
| 3 |
| 3 |
| 3 |
| 3 |
| 3 |
+---+
select * from a group by id,seq_test1.nexval;
ERROR 42S22: Unknown column 'seq_test1.nexval' in 'group statement'
select * from a order by id,seq_test1.nextval;
ERROR HY000: sequence number not allowed here
select * from a where seq_test1.nextval>2;
ERROR HY000: sequence number not allowed here
select * from a where seq_test1.currval>2;
ERROR HY000: sequence number not allowed here
select seq_test1.currval+1 from a;
+---------------------+
| seq_test1.currval+1 |
+---------------------+
|                  47 |
|                  47 |
|                  47 |
|                  47 |
|                  47 |
|                  47 |
+---------------------+
select seq_test1.nextval+1 from a;
+---------------------+
| seq_test1.nextval+1 |
+---------------------+
|                  48 |
|                  49 |
|                  50 |
|                  51 |
|                  52 |
|                  53 |
+---------------------+
select seq_test1.currval+seq_test1.nextval from a;
+-------------------------------------+
| seq_test1.currval+seq_test1.nextval |
+-------------------------------------+
|                                 106 |
|                                 108 |
|                                 110 |
|                                 112 |
|                                 114 |
|                                 116 |
+-------------------------------------+
select seq_test1.nextval+abs(-1) from a;
+---------------------------+
| seq_test1.nextval+abs(-1) |
+---------------------------+
|                        60 |
|                        61 |
|                        62 |
|                        63 |
|                        64 |
|                        65 |
+---------------------------+
select seq_test1.currval+abs(-1) from a;
+---------------------------+
| seq_test1.currval+abs(-1) |
+---------------------------+
|                        65 |
|                        65 |
|                        65 |
|                        65 |
|                        65 |
|                        65 |
+---------------------------+
select seq_test1.nextval*2 from a;
+---------------------+
| seq_test1.nextval*2 |
+---------------------+
|                 130 |
|                 132 |
|                 134 |
|                 136 |
|                 138 |
|                 140 |
+---------------------+
select seq_test1.currval*2 from a;
+---------------------+
| seq_test1.currval*2 |
+---------------------+
|                 140 |
|                 140 |
|                 140 |
|                 140 |
|                 140 |
|                 140 |
+---------------------+
select seq_test1.nextval-2 from a;
+---------------------+
| seq_test1.nextval-2 |
+---------------------+
|                  69 |
|                  70 |
|                  71 |
|                  72 |
|                  73 |
|                  74 |
+---------------------+
select seq_test1.currval-2 from a;
+---------------------+
| seq_test1.currval-2 |
+---------------------+
|                  74 |
|                  74 |
|                  74 |
|                  74 |
|                  74 |
|                  74 |
+---------------------+
select seq_test1.nextval/3 from a;
+---------------------+
| seq_test1.nextval/3 |
+---------------------+
|             25.6667 |
|             26.0000 |
|             26.3333 |
|             26.6667 |
|             27.0000 |
|             27.3333 |
+---------------------+
select seq_test1.currval/3 from a;
+---------------------+
| seq_test1.currval/3 |
+---------------------+
|             27.3333 |
|             27.3333 |
|             27.3333 |
|             27.3333 |
|             27.3333 |
|             27.3333 |
+---------------------+
select seq_test1.currval mod seq_test1.nextval from a;
+-----------------------------------------+
| seq_test1.currval mod seq_test1.nextval |
+-----------------------------------------+
|                                       0 |
|                                       0 |
|                                       0 |
|                                       0 |
|                                       0 |
|                                       0 |
+-----------------------------------------+
select seq_test1.nextval div seq_test1.currval from a;
+-----------------------------------------+
| seq_test1.nextval div seq_test1.currval |
+-----------------------------------------+
|                                       1 |
|                                       1 |
|                                       1 |
|                                       1 |
|                                       1 |
|                                       1 |
+-----------------------------------------+
select -seq_test1.currval from a;
+--------------------+
| -seq_test1.currval |
+--------------------+
|                -94 |
|                -94 |
|                -94 |
|                -94 |
|                -94 |
|                -94 |
+--------------------+
select -seq_test1.nextval from a;
+--------------------+
| -seq_test1.nextval |
+--------------------+
|                -95 |
|                -96 |
|                -97 |
|                -98 |
|                -99 |
|               -100 |
+--------------------+
select +seq_test1.nextval from a;
+---------+
| nextval |
+---------+
|     101 |
|     102 |
|     103 |
|     104 |
|     105 |
|     106 |
+---------+
select +seq_test1.currval from a;
+---------+
| currval |
+---------+
|     106 |
|     106 |
|     106 |
|     106 |
|     106 |
|     106 |
+---------+
create table  c as select seq_test1.currval,seq_test1.nextval from a;
explain select seq_test1.currval,seq_test1.nextval from a;
Process the sequence in functions.
select concat( seq_test1.currval,seq_test1.nextval) from a;
+----------------------------------------------+
| concat( seq_test1.currval,seq_test1.nextval) |
+----------------------------------------------+
| 113113                                       |
| 114114                                       |
| 115115                                       |
| 116116                                       |
| 117117                                       |
| 118118                                       |
+----------------------------------------------+
select ascii(seq_test1.nextval) from a;
+--------------------------+
| ascii(seq_test1.nextval) |
+--------------------------+
|                       49 |
|                       49 |
|                       49 |
|                       49 |
|                       49 |
|                       49 |
+--------------------------+
select length(seq_test1.currval) from a;
+---------------------------+
| length(seq_test1.currval) |
+---------------------------+
|                         3 |
|                         3 |
|                         3 |
|                         3 |
|                         3 |
|                         3 |
+---------------------------+
select acos(seq_test1.currval) from a;
+-------------------------+
| acos(seq_test1.currval) |
+-------------------------+
|                    NULL |
|                    NULL |
|                    NULL |
|                    NULL |
|                    NULL |
|                    NULL |
+-------------------------+
select pow(seq_test1.nextval,seq_test1.currval) from a;
+------------------------------------------+
| pow(seq_test1.nextval,seq_test1.currval) |
+------------------------------------------+
|                   1.2994262207056124e262 |
|                    4.432907660220782e264 |
|                   1.5243074119957227e267 |
|                    5.282945311356653e269 |
|                    1.845323993438539e272 |
|                    6.495847189879201e274 |
+------------------------------------------+
select cast(seq_test1.currval as time) from a;
+---------------------------------+
| cast(seq_test1.currval as time) |
+---------------------------------+
| 00:01:30                        |
| 00:01:30                        |
| 00:01:30                        |
| 00:01:30                        |
| 00:01:30                        |
| 00:01:30                        |
+---------------------------------+
select isnull(seq_test1.nextval) from a;
+---------------------------+
| isnull(seq_test1.nextval) |
+---------------------------+
|                         0 |
|                         0 |
|                         0 |
|                         0 |
|                         0 |
|                         0 |
+---------------------------+
select CURRENT_TIME(seq_test1.nextval) from a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'seq_test1.nextval) from a' at line 1
drop sequence seq_test1;
########Purge the recycle bin and delete the test database and tables. ##########
drop database  IF EXISTS  oblrp;
purge recyclebin;

Contact Us