Home » SQL & PL/SQL » SQL & PL/SQL » Stored Procedure - PLS-00307: too many declaration
Stored Procedure - PLS-00307: too many declaration [message #3639] Wed, 09 October 2002 11:52 Go to next message
Alexander
Messages: 109
Registered: May 2000
Senior Member
Hi... I was able to run this package on Oracle 9i but I now need for it to work on Oracle 8.1.7.... When I try to compile the package body I get the error:

PLS-00307: too many declaration of 'TO_CHAR' match this call

********************** here is the complete code ****

set serveroutput on
drop sequence student_sequence;
create sequence student_sequence
start with 1
increment by 1;

drop table students;

create table students (
StudentSequenceNumber int NOT NULL,
student_id int null,
department varchar2(50) null,
courses varchar2(50) null,
description varchar2(4000) null,
PRIMARY KEY (StudentSequenceNumber));


drop package StudentClassPackage;
create or replace package StudentClassPackage as

/* ********************************************************************** */
/* ********************************************************************** */
Procedure AddStudent (p_StudentId in students.student_id%type,
p_Department in students.department%type,
p_course in students.courses%type,
p_description in students.description%type,
p_FinalId OUT varchar2,
p_Message OUT varchar2);

/* ********************************************************************** */
/* ********************************************************************** */

Procedure RemoveStudent (p_StudentId in students.student_id%type,
p_FinalId OUT varchar2,
p_Message OUT varchar2);

eND StudentClassPackage;
/

create or replace package body StudentClassPackage as
Procedure AddStudent (p_StudentId in students.student_id%type,
p_Department in students.department%type,
p_course in students.courses%type,
p_description in students.description%type,
p_FinalId OUT varchar2,
p_Message OUT varchar2) IS

BEGIN

Insert into students
(StudentSequenceNumber, student_id, department, courses, description)
values
(student_sequence.NEXTVAL, p_Studentid, p_department, p_course, p_description)
returning StudentSequenceNumber into p_FinalId;

p_Message := 'Inserted value: ' || to_char(p_FinalId);

COMMIT;

EXCEPTION
WHEN OTHERS THEN
p_Message := 'Could not insert value: ' || to_char(p_FinalId);
/* Rollback our changes */
ROLLBACK;

END AddStudent;

/* ********************************************************************** */
/* ********************************************************************** */
Procedure RemoveStudent (p_StudentId in students.student_id%type,
p_FinalId OUT varchar2,
p_Message OUT varchar2) IS

BEGIN
delete from students where student_id = p_StudentId;

COMMIT;

EXCEPTION
WHEN OTHERS THEN
p_FinalId := to_char(p_StudentId);
p_Message := 'Could not insert value: ' || to_char(p_StudentId);
/* Rollback our changes */
ROLLBACK;

END RemoveStudent;

END StudentClassPackage;
/
Re: Stored Procedure - PLS-00307: too many declaration [message #3640 is a reply to message #3639] Wed, 09 October 2002 12:03 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Just lose the TO_CHAR conversions - you don't need them, the variable is already a VARCHAR2.

p_Message := 'Inserted value: ' || p_FinalId;
Re: Stored Procedure - PLS-00307: too many declaration [message #3646 is a reply to message #3639] Thu, 10 October 2002 05:21 Go to previous message
Alexander
Messages: 109
Registered: May 2000
Senior Member
Great... Worked fine... Thanks for the support.
Previous Topic: Re: Insert a long raw Image in table
Next Topic: Very Urgent need a Query
Goto Forum:
  


Current Time: Wed Jun 11 04:22:47 CDT 2025