Problems with MYSQL-type ORACLE sequence implementation MYSQL implements the nextval method of ORACLE to create a function, as follows: -- -------------------------------------------------------------------------- Routine DDL -- Note: comments before and after the routine body will not be stored by the server -- Role DELIMITER $ create definer = 'root' @ 'localhost' FUNCTION 'nextval' (seq_name varchar (100) RETURNS bigint (20) begin declare cur_val bigint (20); SELECT cur_value INTO cur_val FROM sequence WHERE name = seq_name; IF cur_val is not null then update sequence SET cur_value = cur_value + increment WHERE name = seq_name; end if; RETURN cur_val; end create a TABLE sequence create table 'sequence '('name' varchar (100) not null, 'credentials' int (11) unsigned not null default '1 ', 'cur _ value' bigint (20) un Signed DEFAULT '1', primary key ('name') ENGINE = InnoDB default charset = utf8; the application uses SSI to obtain the Sequence Value Through select nextval ('seq. Problem: When select nextval ('A') and then use select nextval ('B') in another function, the system prompts no column nextval ('A '), throw an SQL exception. I didn't understand it at first. Baidu and Google are all released. Later I thought about it. It would be 2nd times that nextval ('A') was treated as an alias. Therefore, in the ibatis SQL configuration, slightly modify select nextval ('A') as x and then OK.