问题标签 [callable-statement]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 在获取输出参数之前,Jaybird CallableStatement 不执行
我有这个Java
代码:
存储过程rm_set_coordinates
在哪里:Firebird
当我执行此代码时,ref_car
表中的数据没有改变。但是,如果我将此行添加到上面的代码中:
返回oresult
输出参数的值然后没关系,ref_car
表中的数据被更新。
java - Java callableStatement 给出错误:尝试设置 SQL 中未出现的参数名称
我想使用 Java CollableStatement 中的命名参数执行 Oracle 存储过程。从语法上讲,当我们执行我们得到 SQL 错误的应用程序时,一切都很好 -
Java 代码 -
Oracle 存储过程 -
当我执行上面的 java 语句时,我得到了异常 -
*java.sql.SQLException: 尝试设置 SQL 中没有出现的参数名称:src_cd_ekey*
注意-我还尝试以相同的过程顺序传递所有参数,而对于其他 2 个参数,我传递了 null。但仍然得到相同的异常。
请有人帮助我们解决这个问题。
java - “prepared-statement”是存储过程吗?
“prepared-statement”是存储过程吗?从这个链接看来不是。与准备好的语句的比较 从这个链接它似乎是。JDBC介绍
(ctrl+f存储过程查找第二个链接中存储过程相关的位)
在后一个链接中,他们在该官方 oracle 网页中显示的代码示例是准备好的语句,而不是我认为它对应于存储过程的可调用语句。
sql-server - 使用 CallableStatement 设置 NULL
我正在使用带有 sql server 2008 的 JDBC。我在表中有一个类型为“decimal(18, 2)”的列。我想使用“CallableStatement”向该列插入一个空值。我怎么做?
我试过了callstmt.setNull(14, java.sql.Types.DECIMAL);
。但这不起作用。
HTTP 状态 404 - /NSBMHCGcom.microsoft.sqlserver.jdbc.SQLServerException:%20Error%20converting%20data%20type%20nvarchar%20to%20numeric./eHRMS_AR_M_display_SetupOTConditions
这是我得到的错误。
类型状态报告
消息 /NSBMHCGcom.microsoft.sqlserver.jdbc.SQLServerException:%20Error%20converting%20data%20type%20nvarchar%20to%20numeric./eHRMS_AR_M_display_SetupOTConditions
说明 请求的资源 (/NSBMHCGcom.microsoft.sqlserver.jdbc.SQLServerException:%20Error%20converting%20data%20type%20nvarchar%20to%20numeric./eHRMS_AR_M_display_SetupOTConditions) 不可用。
这是代码的一部分。
==================================================== ====================================================
==================================================== ====================================================
sql - 不能使用方法 void java.sql.CallableStatement.setObject(String parameterName, Object x, int targetSqlType)
这是我的程序代码: 规范:
身体:
这是我的代码,以便通过 CallableStatement 调用过程:
程序可以正常运行。但是,如果我将 callable.setObject (2, "COSC1310", Types.VARCHAR) 替换为
我收到错误:
尽管这里有文件,但还是出了点问题。我应该怎么办 ?
java - 从java调用oracle过程
以下是我的 pl\sql 和 java 用法:
PL\SQL:
爪哇:
我在执行调用时遇到错误:
java.sql.SQLException:ORA-06550:第 1 行,第 7 列:PLS-00306:调用“GETDETAILS”时参数的数量或类型错误
sql - 是否可以在不同的连接上执行 CallableStament?
CallableStatement
重用的实例通常被认为是一种好习惯(请查看此处)。
但是在创建. 时CallableStatement
,该语句(据我所知)绑定到特定的Connection
. 所以我们通常会这样做:
根据我的检查,以下内容不会执行查询:
我的问题是:如果我想重用所有CallableStatement
实例,但另一方面仍然能够获得新连接并关闭旧连接(并非总是打开相同的连接),我该怎么办?
java - 参数号 2 不是 OUT 参数
这是我的错误堆栈跟踪:
程序第一行:
CREATE DEFINER=devel@11.22.33.44 PROCEDURE MyStoredProcedure(IN login VARCHAR(255), OUT variable DECIMAL(20,2)
我不知道如何让它工作。
谢谢
java - Java: Callablestatement.prepareCall turns CALL in SELECT
First line of simple MySQL procedure:
.prepareCall turns my CALL into a SELECT (my guess) which mysql considers a Function and gives me a error:
The System.out gives me:
How can I properly call this procedure?
java - CallableStatement getResultSet returns null when using output parameter
I'm getting some strange results when trying to retrieve multiple result sets from my stored procedure. The stored proc works fine if I execute directly from SQL server management studio.
This is confusing because of the javadoc for execute
and getResultSet
:
execute: Returns true if the first result is a ResultSet object; false if the first result is an update count or there is no result
getResultSet: the current result as a ResultSet object or null if the result is an update count or there are no more results
getResultSet should only return a null here if there are no more results right? However, I know from executing the query in SQL server that there are 3 result sets returned.Am I missing something here?
As a test, I ran getMoreResults()
to see if I the resultSets were missing for some reason:
getMoreResults
returns true but yet when I try to get the result set, it still returns a NULL. This isn't quite what I would want anyway because it would skip my result set but I should at least be retrieving the 2nd result set.
What could cause this? Is there something about the way that SQL Server is returning the result sets that is causing the issue or is there something that I'm missing? Any suggestions would be appreciated.
UPDATE
It turns out that this was related to the output parameter I created
I removed the parameter and updated the call to
And it worked. I get all 3 result sets correctly now. Since I don't care that much about the return code, this is probably fine. In the academic interest, why would the output parameter cause issues with retrieving the result sets?