Quellcode Prozedur r_perskto

Das DB-Objekt selbst

CREATE PROCEDURE "demoadm".r_perskto(
  pv_mandant char(2),
  pv_pkto char(15),
  pv_jahr decimal(4,0),
  pv_periode decimal(2,0),
  pv_soll decimal(13,2),
  pv_haben decimal(13,2)
)
  DEFINE err_sql int;
  DEFINE err_isam int;
  DEFINE err_txt varchar(160,0);

  BEGIN
    ON EXCEPTION
    SET err_sql, err_isam, err_txt
    INSERT INTO DWE_perskto
    VALUES (0,err_sql,err_isam,err_txt,0,'sr_sh_pkto',
      'U',
      pv_mandant,
      pv_pkto,
      pv_jahr,
      pv_periode,
      pv_soll,
      pv_haben
    );
    SET LOCK MODE TO NOT WAIT;
    END EXCEPTION
    SET LOCK MODE TO WAIT 10;

    IF (pv_soll = 0.0) AND (pv_haben = 0.0) AND (pv_periode <> 0) THEN
    DELETE FROM sr_sh_pkto
    WHERE (pkto_nr = pv_pkto)
      AND (mandant = pv_mandant)
      AND (jahr    = pv_jahr)
      AND (periode = pv_periode)
    ;
    ELSE
    UPDATE sr_sh_pkto SET
      soll = pv_soll,
      haben = pv_haben
    WHERE (pkto_nr = pv_pkto)
      AND (mandant = pv_mandant)
      AND (jahr = pv_jahr)
      AND (periode = pv_periode)
    ;
    IF DBINFO('sqlca.sqlerrd2') < 1 THEN -- No rows updated
      INSERT INTO sr_sh_pkto (
      mandant,
      pkto_nr,
      jahr,
      periode,
      soll,
    haben
      )
      VALUES (
      pv_mandant,
      pv_pkto,
      pv_jahr,
      pv_periode,
      pv_soll,
      pv_haben
      );
    END IF
    END IF

    SET LOCK MODE TO NOT WAIT;
  END
END PROCEDURE

Abhängige Objekte, Rechte

grant  execute on "demoadm".r_perskto to "public" as "demoadm";

HTML-Autor: Rohloff, Datenbank: demodb, Datenstand: 31.05.00 17:07