Home » SQL & PL/SQL » SQL & PL/SQL » Problem in creating body of package! (merged by CM) (Oracle 10g Express Edition)
icon4.gif  Problem in creating body of package! (merged by CM) [message #446594] Tue, 09 March 2010 08:38 Go to next message
HAADI
Messages: 1
Registered: March 2010
Location: Lahore, Pakistan
Junior Member
Hey all, I am trying to make a package in Oracle 10g, Express Edition.

It creates the package, but gives the warning while making its body.

The Warning content is :

""Warning : Package Body created with compilation errors.""

I understand that it is some kind of logical error but I am unable to figure it out.

My code looks like :
CREATE TABLE ERROR_EXCEPTIONS (Error_No number,
Error_Name varchar2(30), 
Error_Message varchar2(1024), 
CONSTRAINT EE_PK PRIMARY KEY (Error_No),
CONSTRAINT EE_UK UNIQUE (Error_Name));

CREATE OR REPLACE TRIGGER AUDIT_ERROR_EXCEPTIONS 
BEFORE INSERT OR UPDATE OF Error_Name ON ERROR_EXCEPTIONS
FOR EACH ROW
BEGIN
	:NEW.Error_Name := UPPER(:NEW.Error_Name);
END AUDIT_ERROR_EXCEPTIONS;
/

CREATE OR REPLACE PACKAGE ERROR_EXCEPTION IS
	my_exception EXCEPTION;
	other_exception EXCEPTION;

PRAGMA EXCEPTION_INIT (my_exception, -20001);
PRAGMA EXCEPTION_INIT (other_exception, -20002);

FUNCTION Error_Message
	(First_Error_Name IN varchar2)
RETURN ERROR_EXCEPTIONS.Error_Message%TYPE;

FUNCTION Error_No
	(First_Error_Name IN varchar2)
RETURN ERROR_EXCEPTIONS.Error_No%TYPE;

END ERROR_EXCEPTION;
/


>>>>>>The code works till this point, but shows the above mentioned warning when the following block is executed.<<<<<<<

CREATE OR REPLACE PACKAGE BODY ERROR_EXCEPTION IS
	FUNCTION Error_Message
		(First_Error_Name IN varchar2)
	RETURN ERROR_EXCEPTIONS.Error_Message%TYPE IS
		1_Error_Message ERROR_EXCEPTIONS.Error_Message%TYPE;
	BEGIN
		SELECT Error_Message
		INTO 1_Error_Message
		FROM ERROR_EXCEPTIONS
		WHERE Error_Name = UPPER(First_Error_Name);

	RETURN 1_Error_Message;

	EXCEPTION
		WHEN NO_DATA_FOUND THEN
			RETURN NULL;
	END Error_Message;


	FUNCTION Error_No
		(First_Error_Name IN varchar2)
	RETURN ERROR_EXCEPTIONS.Error_No%TYPE IS
		1_Error_No ERROR_EXCEPTIONS.Error_No%TYPE;
	BEGIN
		SELECT Error_No
		INTO 1_Error_No
		FROM ERROR_EXCEPTIONS
		WHERE Error_Name = UPPER(First_ErrorName);
	RETURN 1_Error_No;

	EXCEPTION
	WHEN NO_DATA_FOUND THEN
		RETURN NULL;
	END Error_No;
END ERROR_EXCEPTION;
/


I would appreciate any help... Smile

Muhammad Haadi




CM: added [code] tags, please do so yourslef next time, see the orafaq forum guide if you're not sure how.

[Updated on: Tue, 09 March 2010 08:43] by Moderator

Report message to a moderator

Re: Problem in creating body of package! (merged by CM) [message #446599 is a reply to message #446594] Tue, 09 March 2010 08:44 Go to previous message
cookiemonster
Messages: 12321
Registered: September 2008
Location: Rainy Manchester
Senior Member
type show errors in sqlplus to see what the errors are.
Previous Topic: Help!!!!!!!! to track exception in one single block for three different select statement......
Next Topic: Overloading problem
Goto Forum:
  


Current Time: Sat Oct 01 12:39:27 CDT 2016

Total time taken to generate the page: 0.08990 seconds