Kannan Sundararaj
Kannan Sundararaj

Reputation: 94

create package create package body record data type

i have an existing package named "fusion". The package definition goes like

create or replace package "fusion' as
create procedure first_procedure(abc in number)
create procedure second_procedure(efg in number)
end fusion;

The package body definition is like

create or replace package body fusion as
procedure first_procedure(abc in number) is
begin
....
end first_procedure;
procedure second_procedure(efg in number) is
begin
....
end second_procedure;
end fusion;

In this existing package i need to include a third procedure which has a custom record type as output. So where should i declare the custom record type? i have written like

create or replace package "fusion' as
type finalrecord is record(column1 varchar2,column2 number);
type mytable is table of finalrecord;
create procedure first_procedure(abc in number)
create procedure second_procedure(efg in number)
create procedure third_procedure(mt out mytable)
end fusion;

and package body as

create or replace package body fusion as
procedure first_procedure(abc in number) is
begin
....
end first_procedure;
procedure second_procedure(efg in number) is
begin
....
end second_procedure;
procedure third_procedure(mt out mytable) is
myissueid number(2);
begin
--do something
end third_procedure;
end fusion;

This is compiling in SQLDeveloper but showing these errors

  1. subprogram or cursor 'third_procedure' is declared in a package specification and must be defined in the package body.

  2. mytable should be declared

Upvotes: 0

Views: 326

Answers (1)

Ravi.
Ravi.

Reputation: 674

Try compiling the Procedure Specification with this update code

create or replace package fusion as
type finalrecord is record(column1 varchar2(20),column2 number);
type mytable is table of finalrecord;
procedure first_procedure(abc in number);
procedure second_procedure(efg in number);
procedure third_procedure(mt out mytable);
end fusion;
/

Upvotes: 0

Related Questions