35 lines
669 B
MySQL
35 lines
669 B
MySQL
|
|
/*
|
|
* 使用虚拟列
|
|
*/
|
|
prompt
|
|
prompt 'create table t'
|
|
declare
|
|
row_count number(5);
|
|
begin
|
|
select count(1) into row_count from user_tables where table_name = upper('t');
|
|
if row_count = 1 then
|
|
execute immediate 'drop table eoda.t';
|
|
end if;
|
|
execute immediate '
|
|
create table eoda.t (x varchar2(3276))
|
|
';
|
|
end;
|
|
/
|
|
|
|
prompt
|
|
prompt 'insert data to eoda.t'
|
|
begin
|
|
insert into eoda.t
|
|
select to_char(level) || rpad('abc',1000,'xyz')
|
|
from dual connect by level < 1001
|
|
union
|
|
select to_char(level)
|
|
from dual connect by level < 1001;
|
|
execute immediate 'alter table eoda.t add (xv as (substr(x,1,10)))';
|
|
execute immediate '
|
|
create index te on eoda.t(xv)
|
|
';
|
|
end;
|
|
/
|