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 -> Re: PL/SQL Function Example?

Re: PL/SQL Function Example?

From: Daniel A. Morgan <dmorgan_at_exesolutions.com>
Date: Tue, 24 Apr 2001 23:09:37 -0700
Message-ID: <3AE66A21.15E97296@exesolutions.com>

I'm not going to write it for you but the syntax is as follows:

CREATE OR REPLACE FUNCTION functionname (parameter1 NUMBER) RETURN VARCHAR2 IS

<define variables here>

BEGIN
   <your SQL here>
   RETURN <some value as a varchar2>

EXCEPTION
   WHEN <potential error condition here>

      <do something>
   WHEN <another potential error condition here>

      <do something>
   WHEN OTHERS THEN
      <do something>

END functionname;

Daniel A. Morgan

Charles Davis wrote:

> Hi, all.
>
> Can someone assist me in writing a function that can tell you if a
> customer number is one of the top ten customers, returning a "YES" or
> "NO" string? I presume a select on the customer table/sales tables are
> needed.
>
> Any help at all would be greatly appreciated. Many thanks.
>
> Charles
Received on Wed Apr 25 2001 - 01:09:37 CDT

Original text of this message

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