【标题描述】:
【测试类型:SQL功能/存储功能/接口功能/工具功能/性能/并发/压力长稳/故障注入/安全/资料/编码规范】【测试版本:2.0.0】 jdbc调用自定义函数,out参数和return值对numeric类型的0,返回结果不一致
【操作系统和硬件信息】(查询命令: cat /etc/system-release, uname -a):
【测试环境】(单机/1主x备x级联备):
【被测功能】:
【测试类型】:
【数据库版本】(查询命令: gaussdb -V):
【预置条件】:数据库正常运行
alter database postgres set behavior_compat_options ='proc_outparam_override';
【操作步骤】(请填写详细的操作步骤):
import java.sql.*;
public class callSP_type3 {
static final String driverName = "org.opengauss.Driver";
static final String urlString = "jdbc:opengauss://192.168.163.185:20000/postgres?batchMode=off";
static final String userName = "xxxx";
static final String password = "xxxx@123";
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws SQLException
{
Connection conn = null;
CallableStatement pstmt_callSP = null;
String strCallSP = "{? = call fn_ty_in_ty_out3(?)}";
try {
Class.forName(driverName);
conn = DriverManager.getConnection(urlString, userName, password);
//conn.setAutoCommit(false);
Statement stmt = null;
stmt = conn.createStatement();
stmt.execute("create or replace FUNCTION fn_ty_in_ty_out3(o_code out numeric) return numeric is begin o_code := 0; return o_code; end;");
pstmt_callSP = conn.prepareCall(strCallSP);
{
pstmt_callSP.registerOutParameter(1, Types.NUMERIC);
pstmt_callSP.registerOutParameter(2, Types.NUMERIC);
}
pstmt_callSP.execute();
System.out.println(pstmt_callSP.getObject(1));
System.out.println(pstmt_callSP.getObject(2));
pstmt_callSP.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
if(null != conn)
{
try
{
conn.rollback();
conn.close();
conn=null;
}catch (Exception e_close) {
e_close.printStackTrace();
}
}
}
}
}
【预期输出】:
0
0
【实际输出】:
0
0E-107
【原因分析】:
【日志信息】(请附上日志文件、截图、coredump信息):
【测试代码】:
Hey @DarkAthena, Welcome to openGauss Community.
All of the projects in openGauss Community are maintained by @opengauss_bot.
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at Here to find the details.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Hi @DarkAthena,
if you want to get quick review about your issue, please contact the owner in first: @周斌 ,
and then any of the maintainers: @Pike
and then any of the committers: @aaronwell , @Loong , @Kamus , @vimiix , @汪伟 , @travelliu
if you have any question, please contact the SIG: Connectors.
登录 后才可以发表评论