1.显示1~12个月月份信息
select lpad(level,2,0) from dual connect by level<13;
2.获取某个时间段之间的月份列表(示例返回2009-03到2010-03之间的月份列表)
SELECT TO_CHAR(ADD_MONTHS(TO_DATE('2009-03','YYYY-MM'),ROWNUM-1
),'YYYY-MM') DAY_ID
FROM DUAL
CONNECT BY ROWNUM<=months_between
(to_date('2010-03', 'yyyy-mm'),to_date('2009-03', 'yyyy-mm'))+1;
3.获取某个时间段的日期列表(示例返回2009-04-01到2009-05-23之间的日期列表)
SELECT TO_CHAR(TO_DATE('2009-04-1','YYYY-MM-DD')+ROWNUM-1
,'YYYY-MM-DD') DAY_ID
FROM DUAL
CONNECT BY ROWNUM<=trunc(to_date('2009-05-23', 'yyyy-mm-dd')-to_date('2009-04-1', 'yyyy-mm-dd'))+1;
4.创建序列
CREATE SEQUENCE "XPLATFORMOJT_GROUP4"."ID_SEQUENCE" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 21 NOCACHE NOORDER NOCYCLE ;
5.创建类型
create or replace type prodetail as object
(
"PROID" VARCHAR2(30),
"PROName" VARCHAR2(200),
"AMOUNT" NUMBER(10,0)
)