Execution Error using out parameter in Oracle - oracle

begin
Num NUMBER;
EXEC GwInwForceQueueUpdateUser
('ITSC1','A07','167321','22202244333','20091103','1','110',:num);
end;
Error on line 0
begin
Num NUMBER;
EXEC GwInwForceQueueUpdateUser
('ITSC1','A07','167321','222
got Error :
ORA-06550: line 2, column 5:
PLS-00103: Encountered the symbol "NUMBER" when expecting one of the following:
:= . ( # % ;
ORA-06550: line 5, column 1:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
begin function package pragma procedure subtype type use
form
current cursor

Your PL/SQL code should look like this:
declare
Num NUMBER;
begin
GwInwForceQueueUpdateUser('ITSC1','A07','167321','22202244333','20091103','1','110',num);
end;

Related

ORACLE PLS-00103:, ORA-06550: := . ( # % ;

I've got a problem with procedure:
create or replace
PROCEDURE SOLVER AS
IS_ACTIVE "Parameter"."Value"%TYPE;
BEGIN
BEGIN
SELECT "Value" INTO IS_ACTIVE from "Parameter" WHERE "Name" = 'ARCHIVER';
EXCEPTION
WHEN OTHERS THEN
IS_ACTIVE:='OFF';
END;
When I try to run it, I gets an Error:
Error report:
ORA-06550: line 3, column 1:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
:= . ( # % ;
The symbol ";" was substituted for "END" to continue.
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
Version 3.2.09
Main Build 09-30
The error message strongly suggests you are getting the error when you call the procedure, not when you create it (and you did refer to 'when I try to run it'); so you are doing this:
begin
solver
end;
/
which generates exactly that error.
If you add a semicolon it will work:
begin
solver;
end;
/
db<>fiddle

PLS-00306: wrong number or types of arguments in call to a Oracle SP

I'm trying to execute a below SP and it throws be the below error:
CREATE OR REPLACE PROCEDURE denodo.CLEAR_INDEX
( INDEX_NAME1 IN VARCHAR2,
INDEX_NAME2 IN VARCHAR2,
IT_WORKED OUT BOOLEAN ) as
BEGIN
IT_WORKED := FALSE;
EXECUTE IMMEDIATE 'drop index ' || INDEX_NAME1;
EXECUTE IMMEDIATE 'drop index ' || INDEX_NAME2;
IT_WORKED := TRUE;
EXCEPTION
WHEN OTHERS THEN
IT_WORKED := FALSE;
END CLEAR_INDEX;
CLEAR_INDEX#0 [JDBC ROUTE] [ERROR] Received exception with message 'ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'CLEAR_INDEX'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
What is going on here? appreciate your help.
This error you generally face when you deal with BOOLEAN datatype as OUT parameter and you try to print it or do any operation with any other inbuilt Oracle packages. You cannot directly use BOOLEAN datatype in dbms_output.put_line or any other DBMS package. For instance,if you want to print the OUT parameter you need to use sys.diutil.bool_to_int.
See below example which demonstrate the error you faced when you try to execute as below:
DECLARE
inx VARCHAR2(100):='ABC';
var BOOLEAN;
BEGIN
CLEAR_INDEX(INDEX_NAME1=>inx ,IT_WORKED =>var);
dbms_output.put_line(var);
END;
You face the issue:
ORA-06550: line 6, column 3:
PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
ORA-06550: line 6, column 3:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action
To overcome such issue you must execute as below:
DECLARE
inx VARCHAR2(100):='ABC';
var BOOLEAN;
var1 varchar2(10);
BEGIN
CLEAR_INDEX(INDEX_NAME1=>inx ,IT_WORKED =>var);
var1:=CASE WHEN (sys.diutil.bool_to_int(var)) = 1 THEN 'TRUE'
WHEN (sys.diutil.bool_to_int(var)) = 0 THEN 'FALSE'
END;
dbms_output.put_line(var1);
END;
Output:
anonymous block completed
Mine is a similar case, however, a different call to a function, which has return type as Boolean and the input to the function is varchar2.
So, this is what I am doing:
Declare
v_ret1 varchar2(1000);
v_ret BOOLEAN;
Begin
v_ret := CASE WHEN SEI_PROCESS_MF_MNL_INVC_PKG.f_process_mf_mnl_invc(v_ret1) = 1 THEN 'TRUE'
WHEN SEI_PROCESS_MF_MNL_INVC_PKG.f_process_mf_mnl_invc(v_ret1) = 0 THEN 'FALSE'
END;
dbms_output.put_line(v_ret);
end;
I just wanted to see output of v_ret so that I can use that for further decision making. If v_ret is of type Boolean, the output should be either "TRUE" or "FALSE".

PL/SQL For & When Error

This is my code,
Declare
For num IN 1..10 LOOP
Continue When Mod(num,2)!=0;
DBMS_OUTPUT.PUT_LINE(num);
END LOOP;
END;
/
I am getting the following error:
SQL> # E:\dbms\f7.sql
For num IN 1..10 LOOP
*
ERROR at line 2:
ORA-06550: line 2, column 1:
PLS-00103: Encountered the symbol "FOR" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor
The symbol "begin" was substituted for "FOR" to continue.
ORA-06550: line 3, column 10:
PLS-00103: Encountered the symbol "WHEN" when expecting one of the following:
:= . ( # % ;
Please someone give me a working code so I can execute !!!
You don't need the declare block since you aren't declaring any variables, but you're missing the begin keyword:
BEGIN -- Here
FOR num IN 1..10 LOOP
Continue When Mod(num,2)!=0;
DBMS_OUTPUT.PUT_LINE(num);
END LOOP;
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.

How to call Oracle Procedure which has one OUT parameter

My oracle procedure structure,
CREATE OR REPLACE PACKAGE BODY NLS_ADMIN."MY_PKG"
AS
PROCEDURE DATA_PRC (oresult OUT NUMBER )
IS
varKeyValue varchar2(1);
BEGIN
...
...
END;
I tried to call above procedure by executing below statement,
declare
oresult NUMBER;
begin
EXECUTE DATA_PRC(oresult);
end;
But getting below exception. Please help me how to call this procedure.
ORA-06550: line 8, column 9:
PLS-00103: Encountered the symbol "DATA_PRC" when expecting one of the following:
:= . ( # % ; immediate
The symbol ":=" was substituted for "DATA_PRC" to continue.
Simply this:
declare
oresult NUMBER;
begin
MY_PKG.DATA_PRC(oresult);
end;

Resources