Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Package variable corruption?

Package variable corruption?

From: <spam_at_thunkbox.com>
Date: 26 Jan 2007 03:09:04 -0800
Message-ID: <1169809743.937627.56560@s48g2000cws.googlegroups.com>


I have a couple of PL/SQL stored procedures on Oracle 9.2.0.2.0, one of which keeps track of a checksum, shown below (extraneous procedures removed):

CREATE OR REPLACE PACKAGE BODY flow_utils AS   TYPE byte_arr_t IS VARRAY(4) OF RAW(1);   g_bytes byte_arr_t := byte_arr_t('00', '00', '00', '00');   PROCEDURE calc_line_chksum(p_line IN STRING) IS     i PLS_INTEGER := 1;
  BEGIN
    FOR j IN 1 .. length(p_line) LOOP
      g_bytes(i) := utl_raw.bit_xor(g_bytes(i), utl_raw.cast_to_raw(substr(p_line, j, 1)));

      i := i + 1;
      IF (i = 5) THEN
        i := 1;
      END IF;

    END LOOP;
  END calc_line_chksum;
  PROCEDURE init_chksum_bytes IS
  BEGIN
    g_bytes := byte_arr_t('00', '00', '00', '00');   END init_chksum_bytes;
END flow_utils;

The other procedure writes files using UTL_FILE. When I open each file, I call init_chksum_bytes and for each line in the file I write I also call calc_line_checksum. Before I close the file, I write the checksum. This procedure is called from a DMBS_JOB.

The daily job creates about 150 files, so far during Jan, around 3000 files have been created with good checksums. However 4 or the 3000 so far have bad checksums. Recreating the file using the same routines creates a good checksum.
This sounds like some sort of corruption I can't find anything about this on Metalink.

Any ideas anyone? Received on Fri Jan 26 2007 - 05:09:04 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US