1、这是在oracle的sql窗口下执行一个代码块
declare
v_char1 varchar2(100);
v_char2 varchar2(100);
v_c char(1); --中间变量
begin
v_char1 :='&no'; --替换变换
dbms_output.put_line('输入的数据为:'||v_char1);
for i in reverse 1..length(v_char1)
loop
v_c := substr(v_char1,i,1);
v_char2 := v_char2 ||v_c;
end loop;
dbms_output.put_line('反转后的数字为:'||v_char2);
end;
2、表分区的条件
(1)如果一个表的数据达到2,3g及以上的话,就要考虑分区了
(2)一个分区的实际大小以200,300m为佳,2,3万条数据能占的空间大概是3,4m,以此类推来计算,你使用的分区以什么来分区为好
3、表分区的创建,修改,删除,查询语句
(1)创建:
CREATE TABLE CUSTOMER
(
CUSTOMER_ID NUMBER NOT NULL PRIMARY KEY,
FIRST_NAME VARCHAR2(30) NOT NULL,
LAST_NAME VARCHAR2(30) NOT NULL,
PHONEVARCHAR2(15) NOT NULL,
EMAILVARCHAR2(80),
STATUS CHAR(1)
)
PARTITION BY RANGE (CUSTOMER_ID)
(
PARTITION CUS_PART1 VALUES LESS THAN (100000) TABLESPACE CUS_TS01,
PARTITION CUS_PART2 VALUES LESS THAN (200000) TABLESPACE CUS_TS02
)
(2)修改
ALTER TABLE BIZ_CUM_STATIC ADD PARTITION CUM_STATIC_201502 VALUES LESS THAN(TO_DATE('20150301', 'YYYYMMDD')) TABLESPACE QZ_DATA
(3)删除
ALTER TABLE BIZ_CUM_STATIC DROP PARTITION CUM_STATIC_201509;
ALTER TABLE BIZ_CUM_STATIC TRUNCATE PARTITION PART01;
(4)查询
select sum( *) from
(select count(*) cn from t_table_SS PARTITION (P200709_1)
union all
select count(*) cn from t_table_SS PARTITION (P200709_2)
);