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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Help Me With a Simple PL/SQL Request Please !!

Re: Help Me With a Simple PL/SQL Request Please !!

From: nick <nick-love_at_juno.com>
Date: Sun, 01 Apr 2001 20:30:04 -0000
Message-ID: <tcf3ucg8p3cqd8@corp.supernews.com>

Charlotte Hurley wrote:
>
> Hello Everyone,
>
> Has anyone developed a PL/SQL procedure/function used to
> return a search result from a table ?. Consider the following table :
>
> Table : MEMBER_CONTACT
>
> Fields: CONTACT_ID
> ORGANIZATION_ID
> FIRST_NAME
> LAST_NAME
> TITLE
> EMAIL_ADDRESS
> CITY
> STATE
> COUNTRY
>
>
> I would like to make a procedure/function that would take in
> the last_name as an input parameter, and return all the users in this
> table matching the surname. Does anyone know what is the most
> efficient way to do this ? I can only return one record as a result so
> far, but does anyone know how to make the procedure return multiple
> records for possible matches based on the surname ? (in an efficient
> way). Any help would be greatly appreciated, thank you in advance.
>

ind Regards,
> Charlotte Hurley,
> firas3_16_at_yahoo.com

    Create or replace function INFO
    (v_last_name in member_contact.last_name%type)       Return varchar
    Is

        v_last_name member_contact%type;     Begin

          select last_name
          into   v_last_name
          from   member_contact
          where  last_name=v_last_name;
      Return (v_last_name);

   End INFO;

   /* run the program....at the SQL prompt type:

                             variable g_last_name varchar2(30)
                             execute :g_last_name := INFO( -- here type in 
the person last name with in the single quote); */
                 At SQL prompt type PRINT g_last_name;
  To see all the last name including all other information in the table    Select title,email_address,city,state,country,INFO(last_name)

           from member_contact;
 Well i hope this is what u asked for, and hope it work.  

--
Posted via CNET Help.com
http://www.help.com/
Received on Sun Apr 01 2001 - 15:30:04 CDT

Original text of this message

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