PLS-00103 Encountered symbol “>” error while executing stored prcedure

♀尐吖头ヾ 提交于 2019-12-12 06:00:31

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/43796867/pls-00103-encountered-symbol-error-while-executing-stored-prcedure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!