home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / programming / oracle7 7.2 / DB / UTIL72 / UTLRAW.SQL < prev    next >
Encoding:
Text File  |  1995-05-18  |  23.9 KB  |  591 lines

  1. rem 
  2. rem $Header: utlraw.sql 7020200.1 95/02/15 18:17:01 cli Generic<base> $ 
  3. rem 
  4. Rem  Copyright (c) 1993 by Oracle Corporation
  5. Rem    NAME
  6. Rem      utlraw.sql - PL/SQL Package of utility routines for raw datatypes
  7. Rem                   Package spec of UTL_RAW
  8. Rem
  9. Rem    DESCRIPTION
  10. Rem      Routines to manipulate raws.
  11. Rem
  12. Rem    RETURNS
  13. Rem
  14. Rem    NOTES
  15. Rem      The procedural option is needed to use this facility.
  16. Rem
  17. Rem    MODIFIED   (MM/DD/YY)
  18. Rem     rhari      10/27/94 -  merges from 7.1
  19. Rem     rhari      09/28/94 -  Creation
  20. Rem     cddavis    09/22/94 -  clarified all utl_raw function doc
  21. Rem                            added defaults and error results.
  22. Rem     cddavis    07/11/94 -  reversed CONVERT parameters
  23. Rem     cddavis    06/27/94 -  split functions out into utl_pg package:
  24. Rem                               RAW_TO_NUMBER
  25. Rem                               NUMBER_TO_RAW
  26. Rem                               RAW_TO_NUMBER_FORMAT
  27. Rem                               NUMBER_TO_RAW_FORMAT
  28. Rem                               MAKE_RAW_TO_NUMBER_FORMAT
  29. Rem                               MAKE_NUMBER_TO_RAW_FORMAT
  30. Rem                               WMSG
  31. Rem                               WMSGCNT
  32. Rem     cddavis    05/11/94 -  refined documentation of warning functions
  33. Rem                         -  changed spool out to 'off'
  34. Rem     png        04/15/94 -  added warning parms to n2r/r2n functions
  35. Rem                         -  added wmsg and wmsgcnt functions
  36. Rem     cddavis    01/26/94 -  corrected transliterate description
  37. Rem     cddavis    01/06/94 -  combined spec & body into single package
  38. Rem     cddavis    09/21/93 -  added nlslang to formatted r/n functions
  39. Rem     cddavis    08/26/93 -  raw conversion formats
  40. Rem     mmoore     08/12/93 -  Branch_for_the_patch
  41. Rem   rkooi/mmoore 07/25/93 -  Creation
  42.  
  43. REM ********************************************************************
  44. REM THE FUNCTIONS SUPPLIED BY THIS PACKAGE AND ITS EXTERNAL INTERFACE
  45. REM ARE RESERVED BY ORACLE AND ARE SUBJECT TO CHANGE IN FUTURE RELEASES.
  46. REM ********************************************************************
  47.  
  48. REM ********************************************************************
  49. REM THIS PACKAGE MUST NOT BE MODIFIED BY THE CUSTOMER.  DOING SO
  50. REM COULD CAUSE INTERNAL ERRORS AND SECURITY VIOLATIONS IN THE
  51. REM RDBMS.  SPECIFICALLY, THE PSD* ROUTINES MUST NOT BE CALLED
  52. REM DIRECTLY BY ANY CLIENT AND MUST REMAIN PRIVATE TO THE PACKAGE BODY.
  53. REM ********************************************************************
  54.  
  55. set echo on
  56.  
  57. CREATE OR REPLACE PACKAGE utl_raw IS
  58.  
  59.   ------------
  60.   --  OVERVIEW
  61.   --
  62.   --     This package provides SQL functions for raws that concat,
  63.   --     substr, etc. to/from raws.  This package is necessary
  64.   --     because normal SQL functions do not operate on raws and
  65.   --     PL/SQL does not allow overloading between a raw and a char
  66.   --     datatype.  Also included are routines which convert various
  67.   --     COBOL number formats to/from raws.
  68.  
  69.   --     UTL_RAW is not specific to the database environment and may
  70.   --     actually be used in other environments as it exists here.
  71.   --     For this reason, the prefix UTL has been given to the package
  72.   --     instead of DBMS.
  73.  
  74.   -------
  75.   -- USES
  76.   --
  77.   --     The are many possible uses for the raw functions.  The
  78.   --     functionality allows a raw "record" to be composed
  79.   --     of many elements.  By using the raw datatype, character
  80.   --     set conversion will not be performed keeping the raw in
  81.   --     its original format when being transferred via rpc.
  82.   --     The raw functions also give the ability to manipulate
  83.   --     binary data which was previously limited to the hextoraw
  84.   --     and rawtohex functions.
  85.  
  86.   ---------------------------
  87.   -- PROCEDURES AND FUNCTIONS
  88.  
  89.   /*----------------------------------------------------------------*/
  90.   /*  CONCAT                                                        */
  91.   /*----------------------------------------------------------------*/
  92.   FUNCTION concat(r1  IN RAW DEFAULT NULL,
  93.                   r2  IN RAW DEFAULT NULL,
  94.                   r3  IN RAW DEFAULT NULL,
  95.                   r4  IN RAW DEFAULT NULL,
  96.                   r5  IN RAW DEFAULT NULL,
  97.                   r6  IN RAW DEFAULT NULL,
  98.                   r7  IN RAW DEFAULT NULL,
  99.                   r8  IN RAW DEFAULT NULL,
  100.                   r9  IN RAW DEFAULT NULL,
  101.                   r10 IN RAW DEFAULT NULL,
  102.                   r11 IN RAW DEFAULT NULL,
  103.                   r12 IN RAW DEFAULT NULL) RETURN RAW;
  104.  
  105.   --  Concatenate a set of 12 raws into a single raw.  If the
  106.   --    concatenated size exceeds 32K, an error is returned.
  107.  
  108.   --  Input parameters:
  109.   --    r1....r12 are the raw items to concatenate.
  110.  
  111.   --  Defaults and optional parameters: None
  112.  
  113.   --  Return value:
  114.   --    raw - containing the items concatenated.
  115.  
  116.   --  Errors:
  117.   --    VALUE_ERROR exception raised (to be revised in a future release)
  118.   --        If the sum of the lengths of the inputs exceeds the maximum
  119.   --        allowable length for a RAW.
  120.  
  121.   /*----------------------------------------------------------------*/
  122.   /*  CAST_TO_RAW                                                   */
  123.   /*----------------------------------------------------------------*/
  124.   FUNCTION cast_to_raw(c IN VARCHAR2) RETURN RAW;
  125.  
  126.   --  Cast a varchar2 to a raw
  127.   --    This function converts a varchar2 represented using N data bytes
  128.   --    into a raw with N data bytes.
  129.   --    The data is not modified in any way, only its datatype is recast
  130.   --    to a RAW datatype.
  131.  
  132.   --  Input parameters:
  133.   --    c - varchar2 to be changed to a raw
  134.  
  135.   --  Defaults and optional parameters: None
  136.  
  137.   --  Return value:
  138.   --    raw - containing the same data as the input varchar2 and
  139.   --          equal byte length as the input varchar2 and without a
  140.   --          leading length field.
  141.   --    null - if c input parameter was null
  142.  
  143.   --  Errors:
  144.   --     None
  145.  
  146.   /*----------------------------------------------------------------*/
  147.   /*  CAST_TO_VARCHAR2                                              */
  148.   /*----------------------------------------------------------------*/
  149.   FUNCTION cast_to_varchar2(r IN RAW) RETURN VARCHAR2;
  150.  
  151.   --  Cast a raw to a varchar2
  152.   --    This function converts a raw represented using N data bytes
  153.   --    into varchar2 with N data bytes.
  154.   --    NOTE: When casting to a varchar2, the current NLS character set
  155.   --          is used for the characters within that varchar2.
  156.  
  157.   --  Input parameters:
  158.   --    r - raw (without leading length field) to be changed to a
  159.   --             varchar2)
  160.  
  161.   --  Defaults and optional parameters: None
  162.  
  163.   --  Return value:
  164.   --    varchar2 - containing having the same data as the input raw
  165.   --    null     - if r input parameter was null
  166.  
  167.   --  Errors:
  168.   --     None
  169.  
  170.   /*----------------------------------------------------------------*/
  171.   /*  LENGTH                                                        */
  172.   /*----------------------------------------------------------------*/
  173.   FUNCTION length(r IN RAW) RETURN NUMBER;
  174.  
  175.   --  Return the length in bytes of a raw r.
  176.  
  177.   --  Input parameters:
  178.   --    r - the raw byte stream to be measured
  179.  
  180.   --  Defaults and optional parameters: None
  181.  
  182.   --  Return value:
  183.   --    number - equal to the current length of the raw.
  184.  
  185.   --  Errors:
  186.   --     None
  187.  
  188.   /*----------------------------------------------------------------*/
  189.   /*  SUBSTR                                                        */
  190.   /*----------------------------------------------------------------*/
  191.   FUNCTION substr(r   IN RAW,
  192.                   pos IN BINARY_INTEGER,
  193.                   len IN BINARY_INTEGER DEFAULT NULL) RETURN RAW;
  194.  
  195.   --  Return a substring portion of raw r beginning at pos for len bytes.
  196.   --    If pos is positive, substr counts from the beginning of r to find
  197.   --    the first byte.  If pos is negative, substr counts backwards from the
  198.   --    end of the r.  The value pos cannot be 0.  If len is omitted,
  199.   --    substr returns all bytes to the end of r.  The value len cannot be
  200.   --    less than 1.
  201.  
  202.   --  Input parameters:
  203.   --    r    - the raw byte-string from which a portion is extracted.
  204.   --    pos  - the byte pisition in r at which to begin extraction.
  205.   --    len  - the number of bytes from pos to extract from r (optional).
  206.  
  207.   --  Defaults and optional parameters:
  208.   --    len - position pos thru to the end of r
  209.  
  210.   --  Return value:
  211.   --    Portion of r beginning at pos for len bytes long
  212.   --    null - if r input parameter was null
  213.  
  214.   --  Errors:
  215.   --    VALUE_ERROR exception raised (to be revised in a future release)
  216.   --       when pos = 0
  217.   --       when len < 0
  218.  
  219.   /*----------------------------------------------------------------*/
  220.   /*  TRANSLATE                                                     */
  221.   /*----------------------------------------------------------------*/
  222.   FUNCTION translate(r        IN RAW,
  223.                      from_set IN RAW,
  224.                      to_set   IN RAW) RETURN RAW;
  225.  
  226.   --  Translate the bytes in the input r raw according to the bytes
  227.   --    in the translation raws, from_set and to_set.  If a byte
  228.   --    in r has a matching byte in from_set, then it is replaced by the
  229.   --    byte in the corresponding position in to_set, or deleted.
  230.   --    Bytes in r but undefined in from_set are copied to the result.
  231.   --    Only the first (leftmost) occurrence of a byte in from_set is
  232.   --    used, subsequent duplicates are not scanned and are ignored.
  233.   --    If to_set is shorter than from_set, the extra from_set bytes
  234.   --    have no translation correspondence and any bytes in r matching
  235.   --    such uncorresponded bytes are deleted from the result raw.
  236.  
  237.   --    Noted difference from TRANSLITERATE:
  238.   --       translation raws have no defaults.
  239.   --       r bytes undefined in the to_set translation raw are deleted.
  240.   --       result raw may be shorter than input r raw.
  241.  
  242.   --  Input parameters:
  243.   --    r        - raw source byte-string to be translated
  244.   --    from_set - raw byte-codes to be translated, if present in r
  245.   --    to_set   - raw byte-codes to which corresponding from_str bytes
  246.   --               are translated
  247.  
  248.   --  Defaults and optional parameters: None
  249.  
  250.   --  Return value:
  251.   --    raw  - translated byte-string
  252.  
  253.   --  Errors:
  254.   --    VALUE_ERROR exception raised (to be revised in a future release)
  255.   --       when r        is null and/or has 0 length
  256.   --       when from_set is null and/or has 0 length
  257.   --       when to_set   is null and/or has 0 length
  258.  
  259.   /*----------------------------------------------------------------*/
  260.   /*  TRANSLITERATE                                                 */
  261.   /*----------------------------------------------------------------*/
  262.   FUNCTION transliterate(r        IN RAW,
  263.                          to_set   IN RAW DEFAULT NULL,
  264.                          from_set IN RAW DEFAULT NULL,
  265.                          pad      IN RAW DEFAULT NULL) RETURN RAW;
  266.  
  267.   --  Transliterate the bytes in the input r raw according to the bytes
  268.   --    in the transliteration raws, from_set and to_set.
  269.   --    Successive bytes in r are looked-up in the from_set and, if not
  270.   --    found, copied unaltered to the result raw, or if found, replaced
  271.   --    in the result raw by either corresponding bytes in the to_set or
  272.   --    the pad byte when no correspondence exists.
  273.   --    Bytes in r but undefined in from_set are copied to the result.
  274.   --    Only the first (leftmost) occurrence of a byte in from_set is
  275.   --    used, subsequent duplicates are not scanned and are ignored.
  276.   --    The result raw is always the same length as r.
  277.   --    from_set and to_set may be of any length.
  278.   --    If the to_set is shorter than the from_set, then the pad byte is
  279.   --    placed in the result raw when a selected from_set byte has no
  280.   --    corresponding to_set byte (as if the to_set were extended to the
  281.   --    same length as the from_set with pad bytes).
  282.  
  283.   --    Noted difference from TRANSLATE:
  284.   --       r bytes undefined in to_set are padded.
  285.   --       result raw is always same length as input r raw.
  286.  
  287.   --  Input parameters:
  288.   --    r        - raw input byte-string to be transliterated
  289.   --    from_set - raw byte-codes to be translated ,if present in r
  290.   --    to_set   - raw byte-codes to which corresponding from_set bytes
  291.   --               are translated
  292.   --    pad      - 1 byte used when to-set is shorter than the from_set
  293.  
  294.   --  Defaults and optional parameters:
  295.   --    from_set - x'00 through x'ff.
  296.   --    to_set   - to the null string and effectively extended
  297.   --               with pad to the length of from_set as necessary.
  298.   --    pad      - x'00'.
  299.  
  300.   --  Return value:
  301.   --    raw  - transliterated byte-string
  302.  
  303.   --  Errors:
  304.   --    VALUE_ERROR exception raised (to be revised in a future release)
  305.   --       when r is null and/or has 0 length
  306.  
  307.   /*----------------------------------------------------------------*/
  308.   /*  OVERLAY                                                       */
  309.   /*----------------------------------------------------------------*/
  310.   FUNCTION overlay(overlay IN RAW,
  311.                    target  IN RAW,
  312.                    pos     IN BINARY_INTEGER DEFAULT 1,
  313.                    len     IN BINARY_INTEGER DEFAULT NULL,
  314.                    pad     IN RAW            DEFAULT NULL) RETURN RAW;
  315.  
  316.   --  Overlay the specified portion of target raw with overlay raw,
  317.   --    starting from byte position pos of target and proceding for len
  318.   --    bytes.
  319.   --    If overlay has less than len bytes, it is extended to len bytes
  320.   --    using the pad byte.  If overlay exceeds len bytes, the extra
  321.   --    bytes in overlay are ignored.
  322.   --    If len bytes beginning at position pos of target exceeds the
  323.   --    length of target, target will be extended to contain the entire
  324.   --    length of overlay.
  325.   --    len, if specified, must be => 0.
  326.   --    pos, if specified, must be => 1.
  327.   --    If pos exceeeds the length of target, target will be padded with
  328.   --    pad bytes to position pos, and then target is further extended
  329.   --    with overlay bytes.
  330.  
  331.   --  Input parameters:
  332.   --    overlay - byte-string used to overlay target
  333.   --    target  - byte-string which is to be overlayed
  334.   --    pos     - position in target (numbered from 1) to start overlay
  335.   --    len     - the number of target bytes to overlay
  336.   --    pad     - pad byte used when overlay len exceeds overlay length
  337.   --              or pos exceeds target length.
  338.  
  339.   --  Defaults and optional parameters:
  340.   --    pos     - 1.
  341.   --    len     - to the length of overlay.
  342.   --    pad     - x'00'.
  343.  
  344.   --  Return value:
  345.   --    raw  - The target byte_string overlayed as specified
  346.  
  347.   --  Errors:
  348.   --    VALUE_ERROR exception raised (to be revised in a future release)
  349.   --       when overlay is null and/or has 0 length
  350.   --       when target  is missing or undefined
  351.   --       when length of target exceeds maximum length of a raw
  352.   --       when len < 0
  353.   --       when pos < 1
  354.  
  355.   /*----------------------------------------------------------------*/
  356.   /*  COPIES                                                        */
  357.   /*----------------------------------------------------------------*/
  358.   FUNCTION copies(r IN RAW,
  359.                   n IN NUMBER) RETURN RAW;
  360.  
  361.   --  Return n copies of r concatenated together.
  362.  
  363.   --  Input parameters:
  364.   --    r - raw to be copied
  365.   --    n - number of times to copy the raw (must be positive)
  366.  
  367.   --  Defaults and optional parameters: None
  368.  
  369.   --  Return value:
  370.   --    The raw copied n times.
  371.  
  372.   --  Errors:
  373.   --    VALUE_ERROR exception raised (to be revised in a future release)
  374.   --       r is missing, null and/or 0 length
  375.   --       n < 1
  376.   --       when length of result exceeds maximum length of a raw
  377.  
  378.   /*----------------------------------------------------------------*/
  379.   /*  XRANGE                                                        */
  380.   /*----------------------------------------------------------------*/
  381.   FUNCTION xrange(start_byte IN RAW DEFAULT NULL,
  382.                   end_byte   IN RAW DEFAULT NULL) RETURN RAW;
  383.  
  384.   --  Returns a raw containing all valid 1-byte encodings in succession
  385.   --    beginning with the value start_byte and ending with the value
  386.   --    end_byte.
  387.   --    If start_byte is greater than end_byte, the succession of
  388.   --    result bytes begin with start_byte, wrap thru 'FF'x to '00'x,
  389.   --    and end at end_byte.
  390.   --    If specified, start_byte and end_byte must be single byte raws.
  391.  
  392.   --  Input parameters:
  393.   --    start_byte - beginning byte-code value of resulting sequence
  394.   --    end_byte   - ending    byte-code value of resulting sequence
  395.  
  396.   --  Defaults and optional parameters:
  397.   --    start_byte - x'00'
  398.   --    end_byte   - x'FF'
  399.  
  400.   --  Return value:
  401.   --    raw - containing succession of 1-byte hexadecimal encodings
  402.  
  403.   --  Errors:
  404.   --     None
  405.  
  406.   /*----------------------------------------------------------------*/
  407.   /*  REVERSE                                                       */
  408.   /*----------------------------------------------------------------*/
  409.   FUNCTION reverse(r IN RAW) RETURN RAW;
  410.  
  411.   --  Reverse a byte sequence in raw r from end to end.
  412.   --    For example, x'0102F3' would be reversed into x'F30201' and
  413.   --    'xyz' would be reversed into 'zyx'.
  414.   --    The result length is the same as the input raw length.
  415.  
  416.   --  Input parameters:
  417.   --    r - raw to reverse
  418.  
  419.   --  Defaults and optional parameters: None
  420.  
  421.   --  Return value:
  422.   --    raw - containing the "reverse" of r
  423.  
  424.   --  Errors:
  425.   --    VALUE_ERROR exception raised (to be revised in a future release)
  426.   --       when r is null and/or has 0 length
  427.  
  428.   /*----------------------------------------------------------------*/
  429.   /*  COMPARE                                                       */
  430.   /*----------------------------------------------------------------*/
  431.   FUNCTION compare(r1  IN RAW,
  432.                    r2  IN RAW,
  433.                    pad IN RAW DEFAULT NULL)  RETURN NUMBER;
  434.  
  435.   --  Compares raw r1 against raw r2.  Returns 0 if r1 and r2 are
  436.   --    identical, otherwise, returns the position of the first byte
  437.   --    from r1 that does not match r2.
  438.   --    If r1 and r2 differ in length, the shorter raw is extended on
  439.   --    the right with pad if necessary.
  440.   --    right with pad if necessary.  The default pad byte is x'00'.
  441.  
  442.   --  Input parameters:
  443.   --    r1  - 1st raw to be compared, may be null and/or 0 length
  444.   --    r2  - 2nd raw to be compared, may be null and/or 0 length
  445.   --    pad - byte to extend whichever of r1 or r2 is shorter
  446.  
  447.   --  Defaults and optional parameters:
  448.   --    pad - x'00'
  449.  
  450.   --  Return value:
  451.   --    number = 0 if raw byte strings are both null or identical; or,
  452.   --           = position (numbered from 1) of first mismatched byte
  453.  
  454.   --  Errors:
  455.   --     None
  456.  
  457.   /*----------------------------------------------------------------*/
  458.   /*  CONVERT                                                       */
  459.   /*----------------------------------------------------------------*/
  460.   FUNCTION convert(r            IN RAW,
  461.                    to_charset   IN VARCHAR2,
  462.                    from_charset IN VARCHAR2) RETURN RAW;
  463.  
  464.   --  Convert raw r from character set from_charset to character set
  465.   --    to_charset and return the resulting raw.
  466.   --    Both from_charset and to_charset must be supported character sets
  467.   --    defined to the Oracle server.
  468.  
  469.   --  Input parameters:
  470.   --    r            - raw byte-string to be converted.
  471.   --    to_charset   - name of NLS character set to which r is converted.
  472.   --    from_charset - name of NLS character set in which r is supplied.
  473.  
  474.   --  Defaults and optional parameters: None
  475.  
  476.   --  Return value:
  477.   --    raw - bytestring r converted according to the specified
  478.   --          character sets.
  479.  
  480.   --  Errors:
  481.   --    VALUE_ERROR exception raised (to be revised in a future release)
  482.   --      r missing, null and/or 0 length
  483.   --      from_charset or to_charset missing, null and/or 0 length
  484.   --      from_charset or to_charset names invalid or unsupported
  485.  
  486.   /*----------------------------------------------------------------*/
  487.   /*  BIT_AND                                                       */
  488.   /*----------------------------------------------------------------*/
  489.   FUNCTION bit_and(r1 IN RAW,
  490.                    r2 IN RAW) RETURN RAW;
  491.  
  492.   --  Perform bitwise logical "and" of the values in raw r1 with raw r2
  493.   --    and return the "anded" result raw.
  494.   --    If r1 and r2 differ in length, the "and" operation is terminated
  495.   --    after the last byte of the shorter of the two raws, and the
  496.   --    unprocessed portion of the longer raw is appended to the partial
  497.   --    result.
  498.   --    The result length equals the longer of the two input raws.
  499.  
  500.   --  Input parameters:
  501.   --    r1 - raw to "and" with r2
  502.   --    r2 - raw to "and" with r1
  503.  
  504.   --  Defaults and optional parameters: None
  505.  
  506.   --  Return value:
  507.   --    raw  - containing the "and" of r1 and r2
  508.   --    null - if either r1 or r2 input parameter was null
  509.  
  510.   --  Errors:
  511.   --    None
  512.  
  513.   /*----------------------------------------------------------------*/
  514.   /*  BIT_OR                                                        */
  515.   /*----------------------------------------------------------------*/
  516.   FUNCTION bit_or(r1 IN RAW,
  517.                   r2 IN RAW) RETURN RAW;
  518.  
  519.   --  Perform bitwise logical "or" of the values in raw r1 with raw r2
  520.   --    and return the "or'd" result raw.
  521.   --    If r1 and r2 differ in length, the "or" operation is terminated
  522.   --    after the last byte of the shorter of the two raws, and the
  523.   --    unprocessed portion of the longer raw is appended to the partial
  524.   --    result.
  525.   --    The result length equals the longer of the two input raws.
  526.  
  527.   --  Input parameters:
  528.   --    r1 - raw to "or" with r2
  529.   --    r2 - raw to "or" with r1
  530.  
  531.   --  Defaults and optional parameters: None
  532.  
  533.   --  Return value:
  534.   --    raw  - containing the "or" of r1 and r2
  535.   --    null - if either r1 or r2 input parameter was null
  536.  
  537.   --  Errors:
  538.   --    None
  539.  
  540.   /*----------------------------------------------------------------*/
  541.   /*  BIT_XOR                                                       */
  542.   /*----------------------------------------------------------------*/
  543.   FUNCTION bit_xor(r1 IN RAW,
  544.                    r2 IN RAW) RETURN RAW;
  545.  
  546.   --  Perform bitwise logical "exclusive or" of the values in raw r1
  547.   --    with raw r2 and return the "xor'd" result raw.
  548.   --    If r1 and r2 differ in length, the "xor" operation is terminated
  549.   --    after the last byte of the shorter of the two raws, and the
  550.   --    unprocessed portion of the longer raw is appended to the partial
  551.   --    result.
  552.   --    The result length equals the longer of the two input raws.
  553.  
  554.   --  Input parameters:
  555.   --    r1 - raw to "xor" with r2
  556.   --    r2 - raw to "xor" with r1
  557.  
  558.   --  Defaults and optional parameters: None
  559.  
  560.   --  Return value:
  561.   --    raw  - containing the "xor" of r1 and r2
  562.   --    null - if either r1 or r2 input parameter was null
  563.  
  564.   --  Errors:
  565.   --    None
  566.  
  567.   /*----------------------------------------------------------------*/
  568.   /*  BIT_COMPLEMENT                                                */
  569.   /*----------------------------------------------------------------*/
  570.   FUNCTION bit_complement(r IN RAW) RETURN RAW;
  571.  
  572.   --  Perform bitwise logical "complement" of the values in raw r
  573.   --    and return the "complement'ed" result raw.
  574.   --    The result length equals the input raw r length.
  575.  
  576.   --  Input parameters:
  577.   --    r - raw to perform "complement" operation.
  578.  
  579.   --  Defaults and optional parameters: None
  580.  
  581.   --  Return value:
  582.   --    raw - which is the "complement" of r1
  583.   --    null - if r input parameter was null
  584.  
  585.   --  Errors:
  586.   --    None
  587.  
  588. END UTL_RAW;
  589. /
  590. show errors
  591.