- neitnaco
- 等级: 初级会员
- 性别:
- 文章: 40
- 积分: 30
- 来自: 杭州
|
sql 代码
- create or replace procedure GETREMAIN_JSZX1(
- P_SETID IN NUMBER,
- P_YEAR IN NUMBER,
- P_MONTH IN NUMBER,
- P_UNITID IN VARCHAR2,
- P_EID IN Varchar2,
- P_SID IN Varchar2)
-
- Is
-
- PA_YEAR NUMBER;
-
- Begin
-
- PA_YEAR := P_YEAR+1;
-
- If P_SID='1' Then
-
- INSERT INTO REMAIN (
-
- SELECT SETID,PA_YEAR AS YEAR,UNITID,
- SEQ_REMAIN_ID.NEXTVAL AS ID,
- SID,P_EID AS EID,'' AS BID,
- '' AS IID,BAL00,0 AS ISPLAN,'' AS ENAME,'' AS BNAME,'' AS INAME
- From
- (
- SELECT SETID,YEAR,UNITID,
- PID,SID,NAME AS SNAME,DEBCRE,ISLEAF,NVL(BAL00+(DEBMONEY_TOT-CREMONEY_TOT)*DEBCRE,0) AS BAL00
- FROM(
- SELECT SETID,YEAR,UNITID,SID,NAME
- ,(CASE WHEN DEBCRE='1' THEN 1 ELSE -1 END) AS DEBCRE
- ,ISLEAF,PID
- ,NVL(COUNTLEDGER('1','2','1',P_UNITID,P_SETID,P_YEAR,P_MONTH,TRIM(SID),TRIM(P_EID),TRIM(''),TRIM('')),0) AS DEBMONEY_TOT
- ,NVL(COUNTLEDGER('1','2','2',P_UNITID,P_SETID,P_YEAR,P_MONTH,TRIM(SID),TRIM(P_EID),TRIM(''),TRIM('')),0) AS CREMONEY_TOT
- ,NVL(COUNTREMAIN(P_UNITID,P_SETID,P_YEAR,TRIM(SID),P_EID,TRIM(''),TRIM('')),0) AS BAL00
- FROM
- (
- SELECT SETID,YEAR,UNITID,SID,NAME,DEBCRE,ISLEAF,PID
- FROM ACCOUNTSECTIONS
- WHERE
- SID<>'0.' AND UNITID=P_UNITID AND SETID=P_SETID AND YEAR=P_YEAR
- And SID Like '1%'
- AND ISLEAF=1 AND ENABLED=1
- ORDER BY ID1,ID2,ID3,ID4,ID5,ID6
- )
- )
- ) where BAL00<>0
- );
-
- Elsif P_SID = '1,2' Then
-
- INSERT INTO REMAIN (
-
- SELECT SETID,PA_YEAR AS YEAR,UNITID,
- SEQ_REMAIN_ID.NEXTVAL AS ID,
- SID,P_EID AS EID,'' AS BID,
- '' AS IID,BAL00,0 AS ISPLAN,'' AS ENAME,'' AS BNAME,'' AS INAME
- From
- (
- SELECT SETID,YEAR,UNITID,
- PID,SID,NAME AS SNAME,DEBCRE,ISLEAF,NVL(BAL00+(DEBMONEY_TOT-CREMONEY_TOT)*DEBCRE,0) AS BAL00
- FROM(
- SELECT SETID,YEAR,UNITID,SID,NAME
- ,(CASE WHEN DEBCRE='1' THEN 1 ELSE -1 END) AS DEBCRE
- ,ISLEAF,PID
- ,NVL(COUNTLEDGER('1','2','1',P_UNITID,P_SETID,P_YEAR,P_MONTH,TRIM(SID),TRIM(P_EID),TRIM(''),TRIM('')),0) AS DEBMONEY_TOT
- ,NVL(COUNTLEDGER('1','2','2',P_UNITID,P_SETID,P_YEAR,P_MONTH,TRIM(SID),TRIM(P_EID),TRIM(''),TRIM('')),0) AS CREMONEY_TOT
- ,NVL(COUNTREMAIN(P_UNITID,P_SETID,P_YEAR,TRIM(SID),P_EID,TRIM(''),TRIM('')),0) AS BAL00
- FROM
- (
- SELECT SETID,YEAR,UNITID,SID,NAME,DEBCRE,ISLEAF,PID
- FROM ACCOUNTSECTIONS
- WHERE
- SID<>'0.' AND UNITID=P_UNITID AND SETID=P_SETID AND YEAR=P_YEAR
- And (SID Like '1%' OR SID LIKE '2%')
- AND ISLEAF=1 AND ENABLED=1
- ORDER BY ID1,ID2,ID3,ID4,ID5,ID6
- )
- )
- ) where BAL00<>0
- );
-
- Elsif P_SID = '1,2,3' Then
-
- INSERT INTO REMAIN
-
- (SETID,Year,UNITID,ID,SID,EID,BID,IID,BAL00,ISPLAN,ENAME,BNAME,INAME)
-
- (
-
- SELECT SETID,PA_YEAR AS YEAR,UNITID,
- SEQ_REMAIN_ID.NEXTVAL AS ID,
- SID,P_EID AS EID,'' AS BID,
- '' AS IID,BAL00,0 AS ISPLAN,'' AS ENAME,'' AS BNAME,'' AS INAME
- From
- (
- SELECT SETID,YEAR,UNITID,
- PID,SID,NAME AS SNAME,DEBCRE,ISLEAF,NVL(BAL00+(DEBMONEY_TOT-CREMONEY_TOT)*DEBCRE,0) AS BAL00
- FROM(
- SELECT SETID,YEAR,UNITID,SID,NAME
- ,(CASE WHEN DEBCRE='1' THEN 1 ELSE -1 END) AS DEBCRE
- ,ISLEAF,PID
- ,NVL(COUNTLEDGER('1','2','1',P_UNITID,P_SETID,P_YEAR,P_MONTH,TRIM(SID),TRIM(P_EID),TRIM(''),TRIM('')),0) AS DEBMONEY_TOT
- ,NVL(COUNTLEDGER('1','2','2',P_UNITID,P_SETID,P_YEAR,P_MONTH,TRIM(SID),TRIM(P_EID),TRIM(''),TRIM('')),0) AS CREMONEY_TOT
- ,NVL(COUNTREMAIN(P_UNITID,P_SETID,P_YEAR,TRIM(SID),P_EID,TRIM(''),TRIM('')),0) AS BAL00
- FROM
- (
- SELECT SETID,YEAR,UNITID,SID,NAME,DEBCRE,ISLEAF,PID
- FROM ACCOUNTSECTIONS
- WHERE
- SID<>'0.' AND UNITID=P_UNITID AND SETID=P_SETID AND YEAR=P_YEAR
- And (SID Like '1%' OR SID LIKE '2%' OR SID LIKE '3%')
- AND ISLEAF=1 AND ENABLED=1
- ORDER BY ID1,ID2,ID3,ID4,ID5,ID6
- )
- )
- ) where BAL00<>0
- );
- commit;
-
- End If;
-
- end GETREMAIN_JSZX1;
我在
exec Getremain_Jszx1(2,2007,12,'1004','100.','1,2,3');
报错误..
错误信息为:
sql 代码
- ORA-04091: 表 XZKJ.REMAIN 发生了变化,触发器/函数不能读
- ORA-06512: 在"XZKJ.COUNTREMAIN", line 37
- ORA-06512: 在"XZKJ.GETREMAIN_JSZX1", line 85
- ORA-06512: 在line 1
但是我把存储过程里面的sql语句拿出来将参数替换成值执行了一下.又可以正常运行..
是什么原因呢?
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|