Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 20th, 2004, 05:19 PM
j9nicolelp2 j9nicolelp2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 18 j9nicolelp2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 59 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old November 20th, 2004, 09:42 PM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
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;
/

Reply With Quote
  #3  
Old November 20th, 2004, 10:37 PM
j9nicolelp2 j9nicolelp2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 18 j9nicolelp2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 59 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old November 21st, 2004, 01:26 PM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
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;

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > cant find the error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway