|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
cant find the error
I know it prob something so stupid but i cant seem to find it. i got the create tables done and working and i got my inserts done and working.
Code:
set serveroutput on;
create or replace package get_book
is
procedure get_books_order
(years in out number,
months out date);
end;
/
create or replace package body get_book is
procedure get_books_order
(years in out number,
months out char)
is
begin
select months, years into years
from book
where years =02;
end get_books_order;
end;
/
show errors;
/
errors: Code:
LINE/COL ERROR
-------- -----------------------------------------------------------------
3/15 PLS-00323: subprogram or cursor 'GET_BOOKS_ORDER' is declared in
a package specification and must be defined in the package body
7/11 PL/SQL: SQL Statement ignored
8/11 PL/SQL: ORA-00947: not enough values
|
|
#2
|
|||
|
|||
|
The procedure you are going to implement in the package body using the different data types, it should be identical if not then package will handle it as a different procedure whose specification is not defined in the package. In a procedure you are making another mistake your are trying to store two values having differnt data types into one variable that is not possible. now look at your code agian, modification is highlighted by red color.
[Code] set serveroutput on; create or replace package get_book is procedure get_books_order (years in out number, months out date); end; / create or replace package body get_book is procedure get_books_order (years in out number, months out date) is begin select years into years --remove month from the query from book where years =02; end get_books_order; end; / show errors; / |
|
#3
|
|||
|
|||
|
ok I got a new error, and this one i really cant figure out. the 1st one ^^ i should have known but some times you need another person view.
Code:
set serveroutput on; create or replace package get_book is procedure get_books_order (years in out number, months out char); end; / create or replace package body get_book is procedure get_books_order (years in out number, months out char) is begin select years into months from book where years =02; end get_books_order; end; / show errors; / declare months1 book.months%type; years1 book.years%type; begin years1 := 02; get_books_order(months1, years1); dbms_output.put_line(months1||' '||years1); end; error: Code:
get_books_order(months1, years1); * ERROR at line 6: ORA-06550: line 6, column 1: PLS-00201: identifier 'GET_BOOKS_ORDER' must be declared ORA-06550: line 6, column 1: PL/SQL: Statement ignored |
|
#4
|
|||
|
|||
|
When you are calling a procedue that is defined into package, you must need to concatenate the package name before calling it, look at the code:
Code:
declare months1 book.months%type; years1 book.years%type; begin years1 := 02; get_books.get_books_order(months1, years1); dbms_output.put_line(months1||' '||years1); end; |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > cant find the error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|