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.
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.
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.
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 ;)
I am trying to connect to the oracle db using jdbc driver and that part works fine. After that I want to execute some pl/sql bolck and this is where I am having problem which seems to be syntactical. Can somebody please help me in fixing this? I tried to figure out but could not. Below is the code snippet.
userlist = ['John', 'Sam', 'Lucia']
$userlist.each do|usr|
puts "Working on #{usr}"
stmt = <<-EOF
DECLARE
CURSOR cur IS
SELECT sid, serial#
FROM v$session WHERE username = upper('#{usr}');
BEGIN
FOR rec IN cur
LOOP
EXECUTE IMMEDIATE 'ALTER USER #{usr} IDENTIFIED BY chng';
dbms_output.put_line('Killing sessions which belong to #{usr}...');
EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION '''||session_rec.sid||','||session_rec.serial#'''';
END LOOP;
END;
EOF
#in the initialize method I established the connection and it is working fine.
plsql_stmt = #conn.create_statement
plsql_stmt.execute_update(stmt)
end
Error message:
Working on John
NativeException: java.sql.SQLException: ORA-06550: line 10, column 100:
PLS-00103: Encountered the symbol "'" when expecting one of the following:
. ( * # % & = - + ; < / > at in is mod remainder not rem
return returning <an exponent (**)> <> or != or ~= >= <= <>
and or like like2 like4 likec between into using || bulk
member submultiset
The symbol "*" was substituted for "'" to continue.
Thank you.
Refactor the big bad plsql into a plsql procedure and use https://github.com/rsim/ruby-plsql to call it from ruby
That error message suggest that you have a SQL syntax error, specifically around an apostrophe. I would puts stmt and inspect it.