尝试在SQL服务器中执行以下查询时出现错误SQL错误:executeQuery方法必须返回结果集.
with cte
AS
(
SELECT GUID,seq original_seq_no, ROW_NUMBER()
OVER ( PARTITION BY GUID ORDER BY seq) AS new_seq_no
FROM CHK_SEQ
)
update CHK_SEQ
set CHK_SEQ.seq = r.new_seq_no
from cte r
where CHK_SEQ.seq = r.original_seq_no AND CHK_SEQ.GUID= r.GUID;
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我.
我可以从 toad sql server 运行这个查询。
exec msp_FormBsBa_yeni 0,'20150101','20150131',5000,0,2,0,null,1,null,0
Run Code Online (Sandbox Code Playgroud)
从我的 Java 应用程序中,它生成了错误,因为该语句没有返回结果集。我尝试了很多东西,但我无法解决它。感谢您的帮助。
// Connection,Resultset ve PrepStatement Declaration
Connection connection = null;
PreparedStatement pstmt = null;
ResultSet rsa = null;
List<EntCari> listrows = new ArrayList<EntCari>();
try {
connection = ConnectionFactory.getConnection();
CallableStatement callableStatement = connection
.prepareCall("{call msp_FormBsBa_yeni(0,N'20150101',N'20150131',5000,0,2,0,null,1,null,0)}");
rsa = callableStatement.executeQuery();
// 2:resultset check
if (!rsa.next()) {
System.out.println("no data");
} else {
do {
// System.out.println("data exists");
// Statements
EntCari row = new EntCari();
row.setMusteriadi(rsa.getString("Unvan"));// rsa.getxxx("column")
listrows.add(row);
} while (rsa.next());
}
// 2---
} …Run Code Online (Sandbox Code Playgroud)