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: Can I call another function inside the package?

Re: Can I call another function inside the package?

From: Johnson Chao <zjx110_at_my-deja.com>
Date: Wed, 23 Jun 1999 10:48:57 GMT
Message-ID: <7kqe2o$3mf$1@nnrp1.deja.com>


What's Wrong with my package?

Hello, :

	I have been racked by this strange problems for 2 days.
	Any one can tell me what's wrong with my package script file?

The below is the package creating script, in which one procedure will call another function aaa. While I put aaa inside the package, it can not work, while I put aaa outof the package , and made it a seperate function, it work. Anyone can tell me why?

The zt table is quite a easy sample table with two columns c1 number , c2 number in it.

Sample Data in zt:
1 10
8 10
100 444
200 555

when I put the aaa outside the package body, In SQLPlus, "exec try.rrr(10)" will make the table zt to: 1 10
8 10
2 10 -- new record
9 10 -- new created record
100 444
200 555

when I put the aaa function inside thepackage body, I do the same, but no new record is created.

CREATE OR REPLACE PACKAGE try AS

        FUNCTION aaa (x IN NUMBER) RETURN number;

        PROCEDURE rrr (Mm number) ;
END try;
/

CREATE OR REPLACE PACKAGE BODY try AS

	FUNCTION aaa (x IN NUMBER)  RETURN number IS
	BEGIN
		return (x+1);
	END aaa;

	PROCEDURE rrr(mm IN number)  IS
   CURSOR ccur1 IS   SELECT * FROM zt where c2=mm;
	rec1 ccur1%ROWTYPE;

	BEGIN
   	FOR rec1 IN ccur1 LOOP
 		insert into zt values(aaa(rec1.c1),rec1.c2);
	 END LOOP;

		close ccur1;

	   	commit;
	   	return;
	EXCEPTION
	   WHEN OTHERS THEN
   	return;
	END rrr;

END try;
/

In article <377091bb.0_at_145.227.194.253>,   "Mark G" <mgumbs_at_nospam.hotmail.com> wrote:
> Could you post the package in question? It may be easier to find.
>
> M
>
> Johnson Chao wrote in message <7kpvve$usa$1_at_nnrp1.deja.com>...
> >
> >
> >Hello:
> > I am making a package to include some functions and procedures.
Inside
> >one procedure, I call another function inside the same package, but I
> >can not do that. Something seems wrong wiht the program. When I move
> >the called function out of my procedure, it works.
> >(even , I add to package name ahead of the function name did not
work)
> >
> >What's wrong with it?
> >
> >--
> >Johnson Chao
> >ctc Japan
> >
> >
> >Sent via Deja.com http://www.deja.com/
> >Share what you know. Learn what you don't.
>
>

--
Johnson Chao
ctc Japan

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Wed Jun 23 1999 - 05:48:57 CDT

Original text of this message

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