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: FUNCTION in PL/SQL

Re: FUNCTION in PL/SQL

From: Scott Johnson <sjohnson_at_ibm.net>
Date: 1997/06/18
Message-ID: <01bc7bdb$0a63d3e0$ef230480@7l603>#1/1

I hope you didn't just do someone's homework for them.

Ken Denny <kdenny_at_interpath.com> wrote in article <33A59208.1AE9_at_interpath.com>...
> Acáacio Nuno Loureiro de Jesus wrote:
> >
> > Hi!
> > If you have a function in PL/SQL that converts a number into it's
> > designation like
> > for example : 1 returns 'one'
> > 10 returns 'ten'
> > 234 returns 'two hundred and thirty four'
> > Please send me.
> > Thanks!
> >
> > Acáacio.
>
> Hi
>
> I had been wanting to write one of these and your post prompted me to do
> it. Here it is:
>
> create or replace
> FUNCTION wordnum(inparam integer) RETURN VARCHAR2
> IS
> TYPE ones IS TABLE OF VARCHAR2(9) INDEX BY BINARY_INTEGER;
> TYPE tens IS TABLE OF VARCHAR2(7) INDEX BY BINARY_INTEGER;
> one_to_19 ones;
> tensdigs tens;
> nextdig integer;
> resultstring VARCHAR2(120);
> charnum VARCHAR2(10);
> BEGIN
> IF inparam >= 100000000 THEN
> RETURN 'Number input must be less than one billion';
> END IF;
> IF inparam = 0 THEN
> RETURN 'ZERO';
> END IF;
> one_to_19(1) := 'ONE';
> one_to_19(2) := 'TWO';
Received on Wed Jun 18 1997 - 00:00:00 CDT

Original text of this message

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