问题描述
我有一个过程可以将值插入一个表并更新另一个表的行.该程序编译无任何错误.如果我在PL/SQL代码中手动调用它,则表将更新.
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;
/
我试图通过单击按钮在Java类中调用此存储过程.用户在GUI框架的文本字段中输入值,这些值需要发送到存储过程.
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.
这是我的Java代码-
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.
推荐答案
我遇到了同样的问题,并找到了解决方案.实际上,当我搜索答案时,其他帖子提到可能存在权限问题".这里退出情况.作为解决方法或解决方案,需要执行以下操作:-丢下SP.-使用参数(即您的最终SP)重新创建SP
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)
您可能先创建了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.
这篇关于ORA-06550:第1行,第7列:PLS-00201:标识符"PAYMENT_UPDATE"必须声明为ORA-06550:第1行,第7列:PL/SQL:语句已忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!