Cause: FDPSTP failed due to ORA-06550: line 1, column 7:PLS-00221: is not a procedure or is undefined - oracle

I'm trying to run a concurrent request in APPS but i keep getting this error
(Cause: FDPSTP failed due to ORA-06550: line 1, column 7:
PLS-00221: 'XXINV_ITEM_ORACLE_E5B0' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored)
and heres my package body its just a simple insert.
CREATE OR REPLACE PACKAGE BODY APPS.XXINV_ITEM_ORACLE_E5B0 IS
PROCEDURE inv_com_proc (
o_chr_errbuf OUT VARCHAR2,
o_num_retcode OUT NUMBER
)
AS
begin
EXECUTE IMMEDIATE 'TRUNCATE TABLE XXINV.XXINV_ITEM_ORACLE_E5B0';
Insert into XXINV.XXINV_ITEM_ORACLE_E5B0(ORGANIZATION_CODE ,
ITEM_NUM,
ON_HAND_QUANTITY ,
ITEM_TYPE ,
STATUS ,
MATERIAL_COST ,
MATERIAL_OVERHEAD_COST,
RESOURCE_COST,
OVERHEAD_COST,
OUTSIDE_PROCESSING_COST,
SUBINVENTORY_CODE ,
LOCATORS )
select OWNING_ORG_CODE, ITEM_NUMBER, ON_HAND_QUANTITY, ITEM_TYPE, STATUS, MATERIAL_COST ,
MATERIAL_OVERHEAD_COST,
RESOURCE_COST,
OVERHEAD_COST,
OUTSIDE_PROCESSING_COST,
SUBINVENTORY_CODE ,
LOCATOR
from apps.XXRPT_INV_VALUATION_D535_V
where apps.XXRPT_INV_VALUATION_D535_V.SUBINVENTORY_CODE = 'FG' AND apps.XXRPT_INV_VALUATION_D535_V.STATUS = 'ONHAND';
COMMIT;
END;
end XXINV_ITEM_ORACLE_E5B0;

When you define the Concurrent Program Executable in System Administration, make sure you the Execution File Name includes the schema.package.procedure, as in APPS.XXINV_ITEM_ORACLE_E5B0.inv_com_proc (no parenthesis).

It seems you're trying to execute the package itself - that won't work. You must execute a procedure/function within the package:
DECLARE
o_chr_errbuf VARCHAR2(256);
o_num_retcode NUMBER;
BEGIN
APPS.XXINV_ITEM_ORACLE_E5B0.inv_com_proc ( o_chr_errbuf, o_num_retcode);
END;
/
A simple test:
DECLARE
err VARCHAR2(256);
CODE NUMBER;
BEGIN xx(err, CODE); END;
ORA-06550: line 5, column 7:
PLS-00221: 'XX' is not a procedure or is undefined
ORA-06550: line 5, column 7:
PL/SQL: Statement ignored
SQL> SELECT * FROM a;
ID
---------------------------------------
SQL> DECLARE
2 err VARCHAR2(256);
3 CODE NUMBER;
4 BEGIN
5 xx.tst(err, CODE);
6 END;
7 /
PL/SQL procedure successfully completed
SQL> SELECT * FROM a;
ID
---------------------------------------
1

Related

'LANG_CUR' is not a procedure or is undefined ORA-06550 Error

1.I have been trying to fetch 1 column from a table using reference cursor in plsql, table only has 11 column lang_cur is the declared cursor.
create or replace PACKAGE MOVIE_PKG
AS
PROCEDURE lang_display(lang_cur out SYS_REFCURSOR);
END MOVIE_PKG;
create or replace PACKAGE BODY MOVIE_PKG
AS
PROCEDURE lang_display(lang_cur out SYS_REFCURSOR)
as
begin
OPEN lang_cur FOR select lang_name from LANGUAGE_SELECT;
end lang_display;
END MOVIE_PKG;
declare
lang_cur SYS_REFCURSOR;
begin
movie_pkg.lang_display(lang_cur);
for data in lang_cur
loop
dbms_output.put_line('langauge:'||data.lang_name);
end loop;
end;
GETTING THIS ERROR
ORA-06550: line 5, column 13:
PLS-00221: 'LANG_CUR' is not a procedure or is undefined
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:)```
You can use FETCH:
declare
lang_cur SYS_REFCURSOR;
lang_name LANGUAGE_SELECT.LANG_NAME%TYPE;
begin
movie_pkg.lang_display(lang_cur);
LOOP
FETCH lang_cur INTO lang_name;
EXIT WHEN lang_cur%NOTFOUND;
dbms_output.put_line('langauge:'||lang_name);
END LOOP;
CLOSE lang_cur;
END;
/
db<>fiddle here

I don't understand what is the problem in my store procedure

Create or replace PROCEDURE SSp_EmpHoursInfo
(p_EHrsInfo OUT SYS_REFCURSOR)
AS
BEGIN
OPEN p_EHrsInfo FOR
Select
a.personid, a.first_name, a.last_name,c.hoursworked,d.carecentername, c.break
from person a
join employee b on a.personid = b.empersonid
join employee_assigned_care_center c on b.empersonid = c.empersonid
join care_center d on c.empersonid = d.carecenterid
where hoursworked> 10;
END SSp_EmpHoursInfo;
Everytime I am trying to call the store procedure it is giving me this error msg:
Error starting at line : 225 in command -
BEGIN SSp_EmpHoursInfo (hoursworked> 10); END;
Error report -
ORA-06550: line 1, column 3:
PLS-00201: identifier 'HOURSWORKED' must be declared
ORA-06550: line 1, column 52:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
The problem is very obvious.
BEGIN SSp_EmpHoursInfo (hoursworked> 10); END; is not the proper way of calling it.
The procedure parameter must be the sys_refcursor.
You must use:
DECLARE
OUTPUT_CUR SYS_REFCURSOR;
BEGIN
SSp_EmpHoursInfo (OUTPUT_CUR );
-- USE CURSOR ACCORDINGLY
END;
/

Apex button and procedure

Im trying to create button in Apex which execute given procedure. As input values I gave two date fields called Poczatek and Koniec. The button should execute this procedure on submit. It perfectly works in Oracle, but throw a lot of errors in Apex.
set serveroutput on
create or replace procedure KORELACJA(:Poczatek, :Koniec)
IS
miasto VARCHAR(25);
korelacja NUMBER;
cursor c1 is
SELECT TEMP.nazwa, corr(TEMP.temperatura, WILGOTNOSC.wilg)
FROM TEMP INNER JOIN WILGOTNOSC
on TEMP.nazwa = WILGOTNOSC.nazwa
and TEMP.data = WILGOTNOSC.data
WHERE TEMP.data between to_date(:Poczatek, 'YYYY-MM-DD') and to_date(:Koniec, 'YYYY-MM-DD')
GROUP BY TEMP.nazwa;
BEGIN
DBMS_OUTPUT.put_line(RPAD('Miasto',10)||RPAD('Korelacja',10));
open c1;
FOR i IN 1..6
LOOP
commit;
fetch c1 into miasto, korelacja;
DBMS_OUTPUT.put_line(RPAD(miasto,10)||RPAD(korelacja,10));
END LOOP;
close c1;
END KORELACJA;
/
Errors look like this:
1 error has occurred
ORA-06550: line 2, column 5: PL/SQL: ORA-00922: missing or invalid option
ORA-06550: line 2, column 1: PL/SQL: SQL Statement ignored ORA-06550: line 6,
column 11: PLS-00103: Encountered the symbol "NUMBER" when expecting one of the
following: := . ( # % ; ORA-06550: line 9, column 18: PLS-00103: Encountered the symbol "JOIN" when
expecting one of the following: , ; for group having intersect minus order start
union where connect
Anyone knows the solution?
I'd suggest you to leave the procedure in the database; call it from Apex.
As you said that it works OK, I'm not going to examine the code. Just modify the first line:
create or replace procedure KORELACJA(par_Poczatek in date,
par_Koniec in date)
is ...
Then, in Apex process, call the procedure as
korelacja(:p1_poczatek, :p2_koniec);
Note that you might need to apply TO_DATE function to those items, using appropriate format mask, such as
korelacja(to_date(:p1_poczatek, 'dd.mm.yyyy',
to_date(:p1_koniec , 'dd.mm.yyyy');
If you insist on keeping the procedure in Apex' process (I wouldn't recommend it), the you don't need CREATE PROCEDURE but an anonymous PL/SQL block. It won't accept any parameters - use Apex items directly.
declare
miasto VARCHAR(25);
korelacja NUMBER;
cursor ...
WHERE TEMP.data between to_date(:p1_Poczatek, 'YYYY-MM-DD') ...
begin
...
end;

Executing Stored Procedure - Oracle PL SQL

I'm currently trying to execute a stored procedure in Oracle PL SQL. I keep running into the same error for the below with execution.
I've tried both execution with the same error
SET SERVEROUTPUT ON;
EXEC get_phone(200.00,500.00);
OR
SET SERVEROUTPUT ON;
DECLARE
c_minprice products.price%type;
c_maxprice products.price%type;
BEGIN
c_minprice := get_phone(200);
c_maxprice := get_phone(500);
END;
ERROR from executing the above:
c_minprice := get_phone(200);
*
ERROR at line 5:
ORA-06550: line 5, column 15:
PLS-00306: wrong number or types of arguments in call to 'GET_PHONE'
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored
ORA-06550: line 6, column 15:
PLS-00306: wrong number or types of arguments in call to 'GET_PHONE'
ORA-06550: line 6, column 1:
PL/SQL: Statement ignored
****Sample Snip-its form my code:
CREATE OR REPLACE PROCEDURE get_phone
(
c_minprice IN products.price%type,
c_maxprice IN products.price%type,
i_result OUT VARCHAR2
) AS
--Checking if starting price range is valid or not
IF c_minprice IS NULL THEN
i_result := 'Starting price range should be valid and cannot be empty';
RAISE V_MINPRICE; -- Raising exception if starting price is null
END IF;
--Checking if end price range is valid or not
IF c_maxprice IS NULL THEN
i_result := 'End price range should be valid and cannot be empty';
RAISE V_MAXPRICE; -- Raising exception if end price is null
END IF;
Your procedure requires three parameters so you have to pass in three parameters
DECLARE
l_result varchar2(100);
BEGIN
get_phone( 200, 500, l_result );
END;
/
should work. Of course, your procedure seems rather pointless. And if the goal is simply to return a result, you really ought to be using a function rather than a procedure with an out parameter.
get_phone expects 3 arguments, c_minprice, c_maxprice and i_result. You are only passing it one number. Pass it the rest of the arguments.

Oracle procedure compiling successfully but show errors

Using Oracle SQL Developer I created a simple procedure. The procedure compiles successfully, but when I type the command:
execute CMPPROJECTPROCSELECT();
BEGIN CMPPROJECTPROCSELECT(); END;
I get the following errors:
Error starting at line : 1 in command -
execute CMPPROJECTPROCSELECT()
Error report -
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'CMPPROJECTPROCSELECT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Error starting at line : 2 in command -
BEGIN CMPPROJECTPROCSELECT(); END;
Error report -
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'CMPPROJECTPROCSELECT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Please help me to solve this. I know it's a small error. Also I have specified the data types, declarations of names correctly.
My procedure code is
CREATE OR REPLACE PROCEDURE CMPPROJECTPROCSELECT(
p_projectname IN VARCHAR2,
p_description OUT VARCHAR2)
IS
BEGIN
SELECT DESCRIPTION
INTO p_description
FROM CMPPROJECT
WHERE PROJECTNAME = p_projectname;
EXCEPTION
WHEN NO_DATA_FOUND THEN
p_description:= NULL;
COMMIT;
END CMPPROJECTPROCSELECT;
execute CMPPROJECTPROCSELECT();
BEGIN CMPPROJECTPROCSELECT();
END;
EXECUTE is SQL*Plus command.
You are not passing the required parameters to the procedure. You have declared two parameters for your procedure:
p_projectname IN VARCHAR2,
p_description OUT VARCHAR2
So, you need to declare the required parameters and then pass it to the procedure:
DECLARE
proj_desc VARCHAR2(2000);
BEGIN
CMPPROJECTPROCSELECT('project_name', proj_desc);
-- use the OUT value of proj_desc later
END;
/
On a side note, you do not need COMMIT at all. It is required to permanently commit a DML and has nothing to do with a SELECT ..INTO clause.
SELECT DESCRIPTION INTO p_description FROM CMPPROJECT WHERE PROJECTNAME = p_projectname;
EXCEPTION
WHEN NO_DATA_FOUND THEN
p_description:= NULL;
COMMIT; -- You don't need COMMIT at all
UPDATE A working demonstration:
In PL/SQL:
SQL> CREATE OR REPLACE PROCEDURE get_emp(
2 p_ename IN VARCHAR2,
3 p_job OUT VARCHAR2)
4 IS
5 BEGIN
6 SELECT job INTO p_job FROM emp WHERE ename = p_ename;
7 END;
8 /
Procedure created.
SQL> sho err
No errors.
SQL> set serveroutput on
SQL> DECLARE
2 job VARCHAR2(20);
3 BEGIN
4 get_emp('SCOTT',JOB);
5 DBMS_OUTPUT.PUT_LINE('The output is '||job);
6 END;
7 /
The output is ANALYST
PL/SQL procedure successfully completed.
In SQL*Plus:
SQL> VARIABLE JOB VARCHAR2(20);
SQL> EXECUTE get_emp('SCOTT', :JOB);
PL/SQL procedure successfully completed.
SQL> PRINT JOB;
JOB
--------------------------------
ANALYST

Resources