ORA-06550: line 1, column 7: PLS-00201: identifier 'PAYMENT_UPDATE' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored

扶醉桌前 提交于 2021-02-08 11:57:25

问题


I have a procedure to insert values into one table and update rows of another table. The procedure compiled without any errors. If I manually call it within PL/SQL codes, the tables are updated.

CREATE OR REPLACE PROCEDURE payment_update
      (bId IN number, pType IN varchar2, pAmt IN number )
AS
BEGIN
    INSERT INTO payment 
     VALUES (PID_SEQ.NEXTVAL,
              bId, 
              pType, 
              (SELECT CURRENT_DATE FROM DUAL),
              pAmt);
    UPDATE booking 
        SET payment_status = 'FP', 
          paid = pAmt
    WHERE booking_id = bId;
END;
/

I am trying to call this stored procedure in a Java class, through the click of a button. The user enters values into a text field of the GUI frame, those values need to be sent to the stored procedure.

This is my Java code -

private void payButtonActionPerformed(java.awt.event.ActionEvent evt) {                                          
    int i = unpaidJTable.getSelectedRow();
    int bookingId =Integer.parseInt(bIdText.getText());
    String pType = pTypeText.getText();
    double pAmt = Double.parseDouble(pAmtText.getText());
    CallableStatement callableStatement = null;
    String paymentUpdateRecord = "{call payment_update(?, ?, ?)}";
    try{
       callableStatement = conn.prepareCall(paymentUpdateRecord);
       callableStatement.setInt(1, bookingId);
       callableStatement.setString(2, pType);
       callableStatement.setDouble(3, pAmt);
       callableStatement.executeUpdate();
       conn.commit();
       System.out.println("Successfully updated!");
   }
    catch(SQLException e){
       System.out.println(e.getMessage());
   }

On clicking this button, I get an error pasted above as the question. Can someone please help me out? I can't figure out what I need to declare.


回答1:


I faced same problem and figured out the solution. Actually, When I searched for answer, other post mentioned that 'there could be permission issue'. Which is quit the case here. As a workaround or solution need to do following: -Drop you SP. -Recreate SP with Parameter (i.e. your final SP)

You might have created SP first and later did some changes in Parameter section. See if this helps. However, it did in my case.




回答2:


PLS-00201: identifier 'PROC_NAME' must be declared ORA-06550: line 1, column 7:

I was able to resolve the issue by creating synonym for the procedure.



来源:https://stackoverflow.com/questions/43199043/ora-06550-line-1-column-7-pls-00201-identifier-payment-update-must-be-decl

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