javasqloracle-adfjdeveloper

Missing IN or OUT parameter at index::2


I am using Oracle database with ADF. I get this error when executing the query:

select count(*)
       from notif_oper n,
            ot_operation o,
            posting p,
            ot_status s,
            client c
       where n.oto_id = o.oto_id
         and o.po_id = p.po_id
         and o.po_id = s.po_id
         and c.CL_ID = p.po_recipient
         and n.status in (0,2,4) and n.type_send = 3 and trunc(n.CREATE_DATE) = trunc(sysdate) - 2
         and s.stat_id = 4 and s.ZIPCODE_CUR = :p_zipcode_cur
         and ((:p_index = 3 and p.NOTE_ID_FIRST is not null)
         or (:p_index = 4 and p.NOTE_ID_LAST is not NULL));

Error is:

[2022-11-30 16:02:16,015] ERROR [220051/Compit] AdfDBTransactionUtil:174 - execute query FAILED:
;
params: [220051]
[2022-11-30 16:02:16,016] ERROR [220051/Compit] ExceptionManager:92 - getDocSubjects failed
java.sql.SQLException: Missing IN or OUT parameter at index:: 2
    at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:2139)

Solution

  • Can you tell us your exact JDev version, please?

    Your query has two paramaters, :p_zipcode_cur and :p_index.

    The log tells you that only one parameter having the value of 220051, was given. As the second parameter is missing, you get the error from the SQL execution.

    Check where the query is called and pass the second parameter. This should fix the error.