|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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). |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Who can resolve the error PLS-00201: identifier ... must be declared? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|