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 July 7th, 2005, 05:02 AM
huuphuoc6982 huuphuoc6982 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 1 huuphuoc6982 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 30 sec
Reputation Power: 0
Who can resolve the error PLS-00201: identifier ... must be declared?

The above error occured when I tried to create and using function from package.
- I logged in with SYSTEM account
- created package and function of package as follow:

SQL> create package manage_emp as
2 procedure fire_emp(empid number);
3 end manage_emp;
4 create package body manage_emp as
5 procedure fire_emp(empid number) is
6 begin
7 delete from emp where id=empid;
8 end fire_emp;
9 end manage_emp;
10 .

and using the function fire_emp of the package by command:

SQL> execute manage_emp.fire_emp(2);

But SQL*Plus displayed the error:

ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'MANAGE_EMP.FIRE_EMP' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

Who can give me the solution to this problem?
Thanks,
Phuoc Nguyen Huu.

Reply With Quote
  #2  
Old July 14th, 2005, 08:18 AM
xpi0t0s xpi0t0s is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 19 xpi0t0s User rank is Private First Class (20 - 50 Reputation Level)xpi0t0s User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 13 m 51 sec
Reputation Power: 0
Use / to execute the CREATE statement, not ".". Because you ended the command with effectively an empty line, SQL*Plus ignored what you typed, and the PLS-201 was caused by the fact that the package didn't exist.

However if you do use / at the end, you'll get an error on the second CREATE, because those are two separate commands and each needs its own terminator.

IOW, you must do:

create or replace package manage_emp as
procedure fire_emp(empid number);
end manage_emp;
/
create or replace package body manage_emp as
procedure fire_emp(empid number) is
begin
delete from emp where empno=empid;
end fire_emp;
end manage_emp;
/

then you'll get:
SQL> execute manage_emp.fire_emp(2);
PL/SQL procedure successfully completed.

(Note I changed ID to EMPNO so it would work on my d/b).

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Who can resolve the error PLS-00201: identifier ... must be declared?


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 4 hosted by Hostway
Stay green...Green IT