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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Trailing Signed Output

Re: Trailing Signed Output

From: Brian <bgoldber_at_mcare.med.umich.edu>
Date: 24 Mar 2004 10:58:51 -0800
Message-ID: <e79c50f9.0403241058.8cb7901@posting.google.com>

/*****************************************************************************

* overpunch.fnc
*

   l_body := SUBSTR(l_signed_value, 2, p_length - 1);

   l_sign_end := SUBSTR(l_signed_value, 1, 1) || 
                 SUBSTR(l_signed_value, p_length + 1, 1);
   SELECT DECODE(l_sign_end, '+0', '{', '+1', 'A', '+2', 'B', '+3', 'C',
                  '+4', 'D', '+5', 'E', '+6', 'F', '+7', 'G', '+8', 'H', 
                  '+9', 'I', '-0', '}', '-1', 'J', '-2', 'K', '-3', 'L', 
                  '-4', 'M', '-5', 'N', '-6', 'O', '-7', 'P', '-8', 'Q', 
                  '-9', 'R') INTO l_last_digit FROM DUAL;
   retval := l_body || l_last_digit;
   RETURN retval;
EXCEPTION
  WHEN l_p_length_out_range THEN
    DBMS_OUTPUT.PUT_LINE('The length of the overpunch function is out of ' ||
                         'bounds');

  WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('overpunch.fnc has an error: ' || SQLERRM); END;
/
EXIT;
pelliott_at_isd.net (Patrick Elliott) wrote in message news:<32d5cd1e.0_at_usamrid.isd.net>...
> I have an interesting problem.  I have to send some data in flat file
> form to an old computer that still uses signed overpunch numbers where
> the high order bit of the last digit contains a 1 if the number is
> negative.  Does anyone have any ideas of how to do this.  The only
> thing I can think of is making a pl/sql procedure to convert the
> number to a string.  It would also save me some time if anyone has
> already written such a procedure.  Thanks for your help!!
Received on Wed Mar 24 2004 - 12:58:51 CST

Original text of this message

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