Hello Everybody..
I have a oracle package that runs perfectly on oracle 9i but gives some errors on an Oracle 7.3.2 Enterprise Edition on a Sco Unix
machine. This is concerning the pragma that has been declared. It
basically says that the function voilates it's pragma..
Some sites mention that previous to Oracle 8i usage of DBMS_PIPE is very
dicy... and that the usage of RAISE_APPLICATION_ERROR is problematic . I
tried commenting out that part but the error still persisted..
The package is as follows :
------------------------------------------------------------------------------
CREATE OR REPLACE PACKAGE Tools AS
FUNCTION Convert(data VARCHAR2,command VARCHAR2,timeout NUMBER DEFAULT
10)
RETURN VARCHAR;
PRAGMA RESTRICT_REFERENCES(Tools,WNDS,RNDS);
PROCEDURE Stop(timeout NUMBER DEFAULT 10);
END Tools;
/
CREATE OR REPLACE PACKAGE BODY Tools AS
FUNCTION Convert(data VARCHAR2,command VARCHAR2,timeout NUMBER DEFAULT 10)
RETURN VARCHAR IS
status NUMBER;
result VARCHAR2(2048);
resultStr VARCHAR2(4128);
pipe_name VARCHAR2(32);
lengthdata NUMBER;
lengthcommand NUMBER;
BEGIN
pipe_name := DBMS_PIPE.UNIQUE_SESSION_NAME;
IF data is NULL THEN
RAISE_APPLICATION_ERROR(-20010,'Input data should not be NULL.');
END IF;
IF command is NULL THEN
RAISE_APPLICATION_ERROR(-20011,'Conversion option (ENG2ISCII or
ISCII2ENG) should not be NULL.');
END IF;
IF UPPER(command) <>'ENG2ISCII' and UPPER(command) <>'ISCII2ENG' THEN
RAISE_APPLICATION_ERROR(-20012,'Conversion option should be ENG2ISCII or
ISCII2ENG.');
END IF;
DBMS_PIPE.PACK_MESSAGE('TRANSLITRATE');
DBMS_PIPE.PACK_MESSAGE(pipe_name);
DBMS_PIPE.PACK_MESSAGE(data);
DBMS_PIPE.PACK_MESSAGE(command);
status := DBMS_PIPE.SEND_MESSAGE('GistOra7ToolsNTR', timeout);
IF status <> 0 THEN
RAISE_APPLICATION_ERROR(-20050,'Gist_PLSNTranslate: Error while
sending. Status = ' ||status);
END IF;
status := DBMS_PIPE.RECEIVE_MESSAGE(pipe_name, timeout);
DBMS_PIPE.UNPACK_MESSAGE(result);
IF result <> 'done' THEN
RAISE_APPLICATION_ERROR(-20051,'Gist_PLSNTranslate: Error while
receiving. Status = ' ||status);
ELSE
DBMS_PIPE.UNPACK_MESSAGE(resultStr);
END IF;
RETURN resultStr;
END Convert;
PROCEDURE Stop(timeout NUMBER DEFAULT 10) IS
status NUMBER;
uname VARCHAR2(32);
BEGIN
IF uname <> 'sys' THEN
RAISE_APPLICATION_ERROR(-20052,'Insufficient Rights.');
ELSE
DBMS_PIPE.PACK_MESSAGE('STOP');
status := DBMS_PIPE.SEND_MESSAGE('GistOra7ToolsNTR', timeout);
IF status <> 0 THEN
RAISE_APPLICATION_ERROR(-20040,
'Stop: Error while sending. Status = ' || status);
END IF;
END IF;
END Stop;
END Tools;
/
COMMIT
/
grant all on Tools to public;
/
-------------------------------------------------------------------------------
Any help would be useful
[ June 29, 2005: Message edited by: gov kur ]
[ June 29, 2005: Message edited by: gov kur ]