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: HELP!!!! I'm getting compiling errors for this program

Re: HELP!!!! I'm getting compiling errors for this program

From: Kenton Ho <kjho_at_engmail.uwaterloo.ca>
Date: Thu, 15 Apr 1999 11:53:44 -0400
Message-ID: <7f528u$3mt$1@news.interlog.com>


Try:

 create or replace procedure get_data(cl_no IN client_master.client_no%type)  is
   cursor c1(cno varchar2) is

     select name
      from client_master

    where client_no=cno;

    cname client_master.name%type;

begin
 open c1(cl_no);
 loop

    fetch c1 into cname;
    exit when c1%notfound;
 end loop;
 close c1;
 end;

I think it was the get_data%notfound

Did you do a SHOW ERRORS in PL/SQL to check if you had any errors?

An alternative is:

CREATE OR REPLACE PROCEDURE get_data(cl_no IN client_master.client_no%type) IS

   CURSOR c1(cno VARCHAR2) IS

     SELECT name
       FROM client_master
     WHERE client_no=cno;

BEGIN
   FOR cname IN c1(cl_no)
   LOOP       DBMS_OUTPUT.PUT_LINE(cname.name);

   END LOOP;
END; (You don't need to declare the cl_no in this case, and the cursor is automatically opened and closed for you)

Kenton Ho
Perfit Computer Systems Group Inc.

dnanda <dnanda_at_netcom.ca> wrote in message news:VncR2.22914$134.237816_at_tor-nn1.netcom.ca...
> i'm in a fix ....i am trying to run a procedure on sql*plus 8.0 and it is
as
> follows:
>
>
> create or replace procedure get_data(cl_no IN
client_master.client_no%type)
> is
> cname client_master.name%type;
> cursor c1(cno varchar2) is select name from client_master where
> client_no=cno;
> begin
> open c1(cl_no);
> loop
> fetch c1 into cname;
> exit when getdata%notfound;
> end loop;
> close c1;
> end;
>
> this procedure is showing compilation errors and sometimes saying that the
> object already exists..i have also tried changing names.
>
>
Received on Thu Apr 15 1999 - 10:53:44 CDT

Original text of this message

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