2017-05-05 172 views
0

我在下面的存儲過程中,當我嘗試執行它時會拋出錯誤。所有的事情都是正確的,但不知道爲什麼會出現這個錯誤。任何人都可以幫我解決這個問題。PLS-00103執行存儲過程時遇到符號「>」錯誤

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; 

引發的錯誤:

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

當我在數據庫級執行它的正常執行,但在VBScript代碼失敗。下面是我用來執行與該VB腳本代碼引發此錯誤

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

您確定這是生成此錯誤的實際代碼嗎? –

+0

該程序編譯沒有任何錯誤? – user75ponic

+0

是的,它在數據庫級別執行時運行時沒有錯誤,但是當我通過vb腳本中的ADODB代碼執行它時,它會拋出上面的錯誤,程序也編譯時沒有任何錯誤 – Audumbar

回答

0

其實在VB腳本調用中獲得通過什麼值給存儲過程,並發現str_id該值是沒有得到我已籤因此程序執行失敗並拋出以上錯誤。

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

我已經爲str_id變量賦值了一個值,並通過執行代碼進行了重新檢查,並且它正常工作。

有一件事我在這裏通過這個錯誤瞭解到,即當我們沒有傳遞所需的參數值,或者我們將參數傳遞爲null時,即使這種類型的錯誤生成時這是強制性的。

感謝所有幫助我解決此問題的人。