PLS-00103 Encountered symbol ">" error while executing stored prcedure - oracle

I am having below stored procedure, when I try to execute it throws error. All the things are proper but don't know why this error it throws. can anybody help me to sort out this.
create or replace PROCEDURE FR_Notes_Mng (
P_STR_ID IN VARCHAR2,
p_Ref_no in VARCHAR2,
P_UserId in VARCHAR2,
P_Note IN VARCHAR2,
P_datestamp IN VARCHAR2,
p_Request_ID in varchar2,
p_WrittenDate IN VARCHAR2
) AS
numSqlCode Number := 0;
RecCounter Number :=0;
strTable varchar2(30) := 'FR_Notes';
strAction varchar2(30) := 'Insert';
vSQLERM VARCHAR2(200) :=SUBSTR(SQLERRM, 1, 85);
BEGIN
Select Count(*) into RecCounter From FR_Notes where str_id=P_str_ID and ref_no=P_Ref_No and user_id=P_UserId and notes=P_note and datestamp=P_Datestamp and to_date(writtendate,'YYYYMMDDHH24MISS')=to_Date(p_WrittenDate,'YYYYMMDDHH24MISS') and request_id=p_request_id;
If RecCounter=0 then
insert into Fr_Notes Values
(p_str_ID,p_ref_no,p_UserId,P_note,p_Datestamp,to_date(p_WrittenDate,'YYYYMMDDHH24MISS'),p_Request_ID,'FR',sysdate);
commit;
end if;
EXCEPTION
WHEN OTHERS THEN
numSqlCode := SQLCODE;
INSERT INTO FR_UNEXPECTED_ERRORS (TABLE_NAME, KEY, ACTION, ERR_CODE)
VALUES (strTable, vSQLERM, strAction, numSqlCode);
END;
Error Thrown:
ORA-06550: line 1, column 47: PLS-00103: Encountered the symbol ">" when expecting one of the following: . ( ) , * # % & = - + < / > at in is
mod remainder not rem <> or != or ~= >= <= <>
and or like like2 like4 likec between || multiset member submultiset
When I execute it at database level its executed properly but failed in vbscript code. Below is the vb-script code I used to execute and which is throwing this error
function InsertNotes(str_id,ref_no,userId,Note,strdatestamp,writtenDates)
Dim strcon2: set strcon2=server.CreateObject("ADODB.Connection")
Dim sql2
Dim strcmd2
strcon2.open "Provider=MSDAORA;Data Source="&Application("DBDsn")&";User Id="&Application("DBUserName")&"; Password="&Application("DBPassword")&";"
sql2 = "rep2.FR_Notes_Mng"
Set strcmd2 = Server.CreateObject("ADODB.Command")
Set strcmd2.ActiveConnection = strCOn2
strcmd2.CommandText = sql2
strcmd2.CommandType = 4
strcmd2.Parameters.Append strcmd2.CreateParameter("p_str_id", 200,1,50,str_id)
strcmd2.Parameters.Append strcmd2.CreateParameter("p_ref_no", 200,1,50,ref_no)
strcmd2.Parameters.Append strcmd2.CreateParameter("p_UserId", 200,1,50,userId)
strcmd2.Parameters.Append strcmd2.CreateParameter("p_note", 200,1,200,Note)
strcmd2.Parameters.Append strcmd2.CreateParameter("p_Datestamp", 200,1,50,strdatestamp)
strcmd2.Parameters.Append strcmd2.CreateParameter("p_Request_id", 200,1,50,"012")
strcmd2.Parameters.Append strcmd2.CreateParameter("p_WrittenDate", 200,1,50,writtenDates)
strcmd2.Execute
end function

Actually I have checked what values are getting passed in VB script call to that stored procedure and found that value for str_id is not getting passed hence the procedure execution was getting failed and throwing above error.
ORA-06550: line 1, column 47: PLS-00103: Encountered the symbol ">" when expecting one of the following: . ( ) , * # % & = - + < / > at in is
mod remainder not rem <> or != or ~= >= <= <>
and or like like2 like4 likec between || multiset member submultiset
I have assigned one value to str_id variable and rechecked by executing the code and it worked properly.
One thing I came to know here by this error which is, when we don't pass required parameter value or we pass the parameter as null even if it is mandatory that time this type of error get generated.
Thanks for all who helped me over this ask.

Related

Procedure Failed to create compilation error

create or replace procedure testpga( psize number ) as
begin
declare
TYPE nAllotment_tabtyp IS TABLE OF char(2048) INDEX BY BINARY_INTEGER;
myarray nAllotmen_tabtyp;
begin
for i in 1.. psize_loop
myarray(i) := to_char(i);`bold`
end loop;
end;
enter code here
end;enter code here
/
LINE/COL ERROR
8/1 PLS-00103: Encountered the symbol "MYARRAY" when expecting one
of the following:
. ( * # % & - + / at loop mod remainder rem
<an exponent (**)> || multiset
The symbol "." was substituted for "MYARRAY" to continue.
8/12 PLS-00103: Encountered the symbol "=" when expecting one of the
following:
. ( * % & - + / at loop mod remainder rem <an exponent (**)>
|| multiset
LINE/COL ERROR
9/1 PLS-00103: Encountered the symbol "END" when expecting one of
the following:
begin function pragma procedure subtype type
current cursor delete
exists prior
create or replace procedure testpga( psize number )
as
TYPE nAllotment_tabtyp IS TABLE OF char(2048) INDEX BY BINARY_INTEGER;
myarray nAllotment_tabtyp;
begin
for i in 1.. psize
loop
myarray(i) := to_char(i); --'bold'
end loop;
end;
I suggest reading the PL/SQL Language Reference which is part of the Oracle database documentation and available online.

Json_table function in oracle forms 12c

I am fairly new to the oracle forms. I have a requirement of using the json_table function. When i run the below query I get the error message mentioned below. But when I run the same query in sql developer it works. Would be great if someone could help me find out the rootcause for the same. Thank you.
SELECT RPTD.GROUP_TODO_ID,
query_json.event_id
into :GLOBAL.RVS_ID,:GLOBAL.RV_EV_ID
FROM RGTD ,
RPTD
,json_table(RGTD.REVSHARE_INFO, '$' COLUMNS ( NESTED PATH '$.revenueShareFunds[*]' COLUMNS ( ID
VARCHAR2(10) PATH '$.rapId' , EVENT_ID VARCHAR2(12) PATH '$.revenueShareEventId')))
query_json
WHERE QUERY_JSON.ID = 'xxxxx'
AND RGTD.ID = RPTD.GROUP_TODO_ID
AND rownum =1;
Error I get while compiling the 12c oracle forms :
Compiling PRE-QUERY trigger on REVSHARE_PART_TO_DO data block...
Compilation error on PRE-QUERY trigger on REVSHARE_PART_TO_DO data block:
PL/SQL ERROR 103 at line 23, column 95
Encountered the symbol ";" when expecting one of the following:
) , * & = - + < / > at in is mod remainder not rem =>
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
The symbol ")" was substituted for ";" to continue.
For the recent versions of Forms(10,11), even the explicit join was not possible within the forms. So, you rather can put the query into a stored procedure within the DB such as
CREATE OR REPLACE PROCEDURE Get_ID_Values(
i_json_id IN VARCHAR2,
o_rvs_id OUT rptd.group_todo_id%type,
o_rv_ev_id OUT VARCHAR2,
o_error OUT VARCHAR2
)
AS
BEGIN
SELECT rptd.group_todo_id, query_json.event_id
INTO o_rvs_id, o_rv_ev_id
FROM rgtd
JOIN rptd
ON rgtd.id = rptd.group_todo_id
CROSS JOIN json_table(rgtd.revshare_info,
'$' COLUMNS(NESTED PATH '$.revenueShareFunds[*]'
COLUMNS(id VARCHAR2(10) PATH '$.rapId',
event_id VARCHAR2(12) PATH
'$.revenueShareEventId'))) query_json
WHERE query_json.id = i_json_id
AND rownum = 1;
EXCEPTION WHEN no_data_found THEN o_error := 'No Data Found';
WHEN others THEN o_error := sqlerrm;
END;
/
all call that from the current PRE-QUERY trigger.

Why does the dynamic sql statement erroring

I am trying to run the Dynamic SQL Query and get the output in the cursor. How to rewrite this statement?
OPEN ecur_SS FOR
EXECUTE IMMEDIATE 'select sSQLQUERY FROM DUAL';
END;
sSQLQUERY has my select statement.
sSQL := 'SELECT * from forms' ;
ecur_SS is out sys_refcursor
I am getting the following error:
Error: PLS-00103: Encountered the symbol "IMMEDIATE" when expecting
one of the following:
. ( * # % & = - + ; < / > at in is mod remainder not rem
<> or != or ~= >= <= <> and or like like2
like4 likec between using || multiset member submultiset The symbol "* was inserted before "IMMEDIATE" to continue.

If statement inside Trigger not working SQL(Oracle)

My goal is to create a trigger that checks if the number you are trying to enter NR_RECIBO is in the table Doc_cabecalho with the attribute TIPO_DOC = 4
CREATE OR REPLACE TRIGGER ValidaRecibo
BEFORE INSERT ON Recibo
FOR EACH ROW
DECLARE val NUMBER;
BEGIN
SELECT COUNT(*) INTO val
FROM Doc_cabecalho
WHERE (TIPO_DOC = 4 AND NR_DOCUMENTO = :NEW.NR_RECIBO);
IF val = 0
THEN (-20502, ' Only from department 4 ');
END IF;
END ValidaRecibo;
Yet, this raises the following error:
PLS-00103: Encountered the symbol "," when expecting one of the following:
* & = - + < / > at in is mod remainder not rem <> or != or ~= >= <= <> and or like like2 like4 likec as between || member submultiset
IF val = 0 THEN
raise_application_error(-20502, ' Only from department 6 ');
And you should decide between DOC_TIPO and TIPO_DOC ;)

Oracle Database PLSQL Error: PLS-00103

I'm writing simple function in Oracle Database 11g that count summary salary for employee. For this we need to count days with specific status. Days is present as fields in table (Day_1, Day_2, ..., Day_30).
But i have got error during compilation:
Error(50,9): PLS-00103: Encountered the symbol ";" when expecting one of the following: :=.(#%;
Code of my package (a place where there is an error marked in code of function f2):
CREATE OR REPLACE PACKAGE pack IS
FUNCTION f1 (id IN NUMBER) return t2 PIPELINED;
FUNCTION f2 (id IN NUMBER) return number;
end pack;
/
CREATE OR REPLACE PACKAGE BODY pack IS
FUNCTION f1 (id IN NUMBER) return t2 PIPELINED IS
name VARCHAR2(50);
num number;
BEGIN
FOR i IN 1 .. id LOOP
SELECT отдел
into name
from отдел
where ид_отдела = i;
select sum(КОЛИЧЕСТВО)
into num
from Таблица_3
join Таблица_2
on Таблица_3.КТО_ПРОДАЛ = Таблица_2.ЧЛВК_ИД
where отдел = i;
PIPE ROW( t1(i, name, num) );
END LOOP;
RETURN;
END f1;
FUNCTION f2 (id IN NUMBER) return NUMBER AS
WorkingDays NUMBER := 0;
CurrentDay VARCHAR2(50);
Salary NUMBER := 120;
Total NUMBER := 0;
BEGIN
FOR i IN 1 .. 30 LOOP
EXECUTE IMMEDIATE 'SELECT День_' || i || ' FROM Таблица_2 WHERE ЧЛВК_ИД = id INTO CurrentDay';
IF WorkingDays IN ('КОМАНДИРОВКА','ВЫХОДНОЙ','ПРАЗДНИК') THEN -- <--- Here
WorkingDays := WorkingDays + 1;
END IF;
END LOOP;
Total : = Salary * WorkingDays;
RETURN Total;
END f2;
end pack;
/
How can i solve this? Maybe the problem is in the logic of the program?
That is an error on parsing, and be aware that it often does not accurately show the error itself, but where the next symbol error occurred. For example:
declare
x number;
y number;
begin
if x = 1 then
y := 1 --I forget to put on the semi-colon to end the line
end if;
end;
You'd expect an error on the missing semi-colon. What you get is:
ORA-06550: line 7, column 2:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
The symbol ";" was substituted for "END" to continue.
Since in your comments you talk about changing things - perhaps to make it more readable for us (and thank you!), it may be obscuring the actual syntax glitch.
Two things I notice:
Total : = Salary * WorkingDays;
That has a space between the : and = that shouldn't be there
and:
FUNCTION f2 (id IN NUMBER) return NUMBER AS
which is normally
FUNCTION f2 (id IN NUMBER) return NUMBER IS

Resources