日期:2014-05-17 浏览次数:20984 次
SELECT ID,STT,grouping(ID),grouping(STT)
FROM TABLE (CORP('sys1','code1'))
group by grouping sets((ID),(STT));
ORA-00932: 数据类型不一致: 应为 NUMBER, 但却获得 AAA.TYPESTT
CREATE OR REPLACE TYPE "AAA"."TYPESTT"
AS OBJECT( ID VARCHAR2 (30),
STT VARCHAR (10))
CREATE OR REPLACE TYPE "AAA"."CORPSTT" AS TABLE OF TYPESTT
CREATE
OR
REPLACE
FUNCTION "AAA"."CORP"(SYS1 VARCHAR ,
CODE1 VARCHAR)
RETURN CORPSTT PIPELINED AS V1 TYPESTT ;
VCODE VARCHAR(30);
VSYS VARCHAR(10);
V_DATE VARCHAR(10);
BEGIN
VCODE := CODE1 ;
VSYS := SYS1 ;
V_DATE := TO_CHAR(SYSDATE,'YYYY-MM-DD') ;
FOR MYROW IN
(
SELECT
ID ,
STT
FROM
RLCP
UNION ALL
SELECT
CORPID ,
CORPROLE
FROM
RRCP )
LOOP
V1 := TYPESTT(MYROW.ID, MYROW.STT);
PIPE ROW (V1);
END LOOP;
RETURN ;
END ;
with t as (
select 1 id, '服装' ptype, '男装' stype, 78 amount, '2009-06-25' saledate from dual union all
select 2 id, '服装' ptype, '男装' stype, 33 amount, '2009-03-21' saledate from dual u