create procedure "demoadm".r_ti_aggrjourn02( psiWasTun SMALLINT DEFAULT NULL, -- LetDefault 0 psiDebugFlag SMALLINT DEFAULT 0, pcDebugFile CHAR(40) DEFAULT NULL ) RETURNING INTEGER ; DEFINE riAnz INTEGER; DEFINE iDBSqlError, iDBIsamError INTEGER; DEFINE cDBErrMsg CHAR(72); IF psiDebugFlag > 0 THEN IF pcDebugFile = '' OR pcDebugFile IS NULL THEN LET pcDebugFile = '/var/tmp/r_ti_aggrjourn02.trc'; END IF IF MOD(psiDebugFlag,2) = 1 THEN SET DEBUG FILE TO pcDebugFile WITH APPEND ; ELSE SET DEBUG FILE TO pcDebugFile ; END IF TRACE ON; END IF IF psiWasTun IS NULL THEN LET psiWasTun = 0 ; END IF -- CALL "informix".n_v_error( 'r_ti_aggrjourn02: Versinr erforderlich!' ); lock table demo02:"demoadm".journal in share mode; set pdqpriority 20; insert into t_psk ( kto, gkto, jahr, periode, soll, haben, anzbu ) select bu_kto, bu_gkto, 1900 + TRUNC(bu_journr/10000000) jahr, bu_periode, sum(bu_bruttobetr), 0, count(*) -- bu_nettobetrag bu_umstbetrag from demo02:"demoadm".journal where bu_soha <> 104 -- Soll aus Sicht Kto group by 1, 2, 3, 4 ; LET riAnz = DBINFO('sqlca.sqlerrd2'); insert into t_haben ( kto, gkto, jahr, periode, haben, anzbu ) select bu_kto, bu_gkto, 1900 + TRUNC(bu_journr/10000000) jahr, bu_periode, sum(bu_bruttobetr), count(*) from demo02:"demoadm".journal where bu_soha = 104 -- Haben aus Sicht Kto group by 1, 2, 3, 4 ; LET riAnz = riAnz + DBINFO('sqlca.sqlerrd2'); set pdqpriority 0; RETURN riAnz ; end procedure
grant execute on "demoadm".r_ti_aggrjourn02 to "dbadmin" as "demoadm"; grant execute on "demoadm".r_ti_aggrjourn02 to "dvabt" as "demoadm"; grant execute on "demoadm".r_ti_aggrjourn02 to "public" as "demoadm";
HTML-Autor: Rohloff, Datenbank: demodb, Datenstand: 31.05.00 17:07