create or replace procedure p_ssuser(VAR_USERID IN INT)
IS
V_USERNAME VARCHAr2(34);
begin
SELECT USERNAME INTO V_USERNAME FROM SS_USER WHERe USERID =VAR_USERID;
END;
如果没输出参数 ,在java中如何获取结果。。。有输出参数如何获取
跪求大神帮忙!!!!!! java中 如何获取只有输入参数的存储过程的结果
答案:1 悬赏:50 手机版
解决时间 2021-02-09 06:19
- 提问者网友:伴风望海
- 2021-02-08 22:10
最佳答案
- 五星知识达人网友:渡鹤影
- 2021-02-08 22:16
写代码的时候,你完全可以把存储过程看作一张表或者视图
import java.sql.*;
public class ProcedureTest
{
public static void main(String args[]) throws Exception
{
//加载驱动
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
//获得连接
Connection conn=DriverManager.getConnection("jdbc:odbc:mydata","sa","");
//创建存储过程的对象
CallableStatement c=conn.prepareCall("{call FindCusts(?)}");
c.setString(1,"Tom");
ResultSet rs=c.executeQuery();
while(rs.next())
{
String cust=rs.getString("customerid");
System.out.println (cust);
}
c.close();
}
}
http://developer.51cto.com/art/201203/321033.htm
import java.sql.*;
public class ProcedureTest
{
public static void main(String args[]) throws Exception
{
//加载驱动
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
//获得连接
Connection conn=DriverManager.getConnection("jdbc:odbc:mydata","sa","");
//创建存储过程的对象
CallableStatement c=conn.prepareCall("{call FindCusts(?)}");
c.setString(1,"Tom");
ResultSet rs=c.executeQuery();
while(rs.next())
{
String cust=rs.getString("customerid");
System.out.println (cust);
}
c.close();
}
}
http://developer.51cto.com/art/201203/321033.htm
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯