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 -> Formating output in functions in PL/SQL

Formating output in functions in PL/SQL

From: Jingyan <jingyan.xu_at_tst2000.com>
Date: Fri, 17 Mar 2000 18:53:06 -0800
Message-ID: <PcXA4.83$jZ3.1813@nuq-read.news.verio.net>


Hi,
 I need to create two functions, each called PRINT_IT to print a date, or a number value depending on how the function was invoked.

  1. To print the date value, use “DD_MON_YY” as the input format, and ‘FmMonth/dd/yyyy” as the output format. Make sure you handle invalid input.
  2. To print the number, use “999,999.00” as the output format. But I don't know how to format them. Please help me! I have tried several ways, no one works. Thank you a lot. Best Regards, Jingyan /***************** Create or replace package OVER_LOAD AS FUNCTION PRINT_IT( f_date in date
    ) RETURN DATE;
    FUNCTION PRINT_IT( f_num in number
    ) RETURN NUMBER;
    end OVER_LOAD; / Create or replace package body OVER_LOAD AS

 FUNCTION PRINT_IT(
  f_date in date
) RETURN DATE AS

 BEGIN
  null;
 END PRINT_IT;  FUNCTION PRINT_IT(
  f_num in number
) RETURN NUMBER AS

  v_num number(999,999.00);
  --column f format 999,999.00;
 BEGIN   v_num:=f_num;
  --select v_num into f from dual;
  DBMS_OUTPUT.PUT_LINE(v_num);
 END PRINT_IT; end OVER_LOAD;
/ Received on Fri Mar 17 2000 - 20:53:06 CST

Original text of this message

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