存储过程 :
贴代码:
public int PauseAccount(string account)
{
int iResult=456;
try
{
OracleParameter[] paramList=new OracleParameter[2]; paramList[0]=new OracleParameter("p_UserName",OracleType.VarChar);
paramList[1]=new OracleParameter("p_Rtcode",OracleType.Number);
paramList[0].Value=account;
paramList[1].Direction=ParameterDirection.Output; bool bIsSusc=daCon.ExecuteProcedure("ICS_User_Pause",paramList);
if(bIsSusc)
{
iResult=Convert.ToInt32(paramList[4].Value.ToString());
}
}
catch(Exception ex)
{
Tools.WriteLog("ICS UserPortal",ex,System.Diagnostics.EventLogEntryType.Error);
}
return iResult;
}调用代码:int iResult=aa.PauseAccount("0594811113");
贴代码:
public int PauseAccount(string account)
{
int iResult=456;
try
{
OracleParameter[] paramList=new OracleParameter[2]; paramList[0]=new OracleParameter("p_UserName",OracleType.VarChar);
paramList[1]=new OracleParameter("p_Rtcode",OracleType.Number);
paramList[0].Value=account;
paramList[1].Direction=ParameterDirection.Output; bool bIsSusc=daCon.ExecuteProcedure("ICS_User_Pause",paramList);
if(bIsSusc)
{
iResult=Convert.ToInt32(paramList[4].Value.ToString());
}
}
catch(Exception ex)
{
Tools.WriteLog("ICS UserPortal",ex,System.Diagnostics.EventLogEntryType.Error);
}
return iResult;
}调用代码:int iResult=aa.PauseAccount("0594811113");
解决方案 »
- 求RedHat 4.8下安装Oracle10.2.0.1方法
- sos。。。头一次使用数据库,就遇到问题了
- 如何用pl sql 导出数据库dmp文件以及log日志和dat文件
- Oracle 9i 下载问题
- 关于oracle text 全文检索的一个问题(请赐教)
- ado.net连接oracle时,可以指定会话用的客户端字符集吗?
- 事务中不提交或不回滚会造成连接上的内存泄漏吗?
- insert into 的时候要插入的变量里面含有很多字符,如:',",\ 等等应该怎么写?
- oralce修改了props$参数,无法进入sqlplus?
- 急问,在FUNCTION中创建临时表
- 一个用户的default tablespace 和 temporary tablespace 有什么区别啊
- ▲求按金额分类计费的SQL▲
(
p_UserName in varchar, --父帐号
p_RetCode out number -- 返回码:0=成功 非0=错误码
)
/* p_RetCode 返回码定义
20 参数不合法
40 找不到父帐号
50 更新业务订购表历史记录表和服务订购历史记录表失败
*/
is
v_userid number(10);
v_tranid number(10);
CURSOR cur_srv_sub IS select transactionId from user_srv_subscription where userid = v_userid;
begin
....
end ICS_User_Pause;
因为你的程序里面有封装.所以别人很难看出你的后台的类是否有问题的.
/**
* 调用存储过程p_dtsgfztj_getsql
* sql功能描述: 返回报表表体
* @param startDate 开始日期
* @param endDate 结束日期
* @return result sql语句:
* @throws DAOException 数据访问异常
*/
private static String getContent(String startDate, String endDate) throws
DAOException {
DBconn db = null;
String sql = null;
ResultSet rs = null;
Connection con = null;
CallableStatement call = null;
try {
db = new DBconn();
con = db.getConnection();
call = con.prepareCall("call p_dtsgdttj_getsql(?,?,?)");
call.registerOutParameter(3, java.sql.Types.VARCHAR);
call.setString(1, startDate);
call.setString(2, endDate);
rs = call.executeQuery();
sql = call.getString(3);
}
catch (ConnectionException e) {
throw new DAOException(e, "统计报表失败!");
}
catch (SQLException e) {
throw new DAOException(e);
}
finally {
if (rs != null) {
try {
rs.close(); //关闭结果集
}
catch (Exception e) {
e.printStackTrace();
}
}
if (call != null) {
try {
call.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
if (con != null) {
try {
con.close(); //关闭连接
}
catch (Exception e) {
e.printStackTrace();
}
}
}
return sql;
}
* 调用存储过程p_dtsgdttj_getsql_top:
* 返回获得表头的sql语句
* sql功能描述: 返回数组列数
* @param startDate 开始日期
* @param endDate 结束日期
* @return int 数组列数
*
* @throws DAOException 数据访问异常
*/
private static int getCol(String startDate,
String endDate) throws DAOException {
DBconn db = null;
int col = 0;
ResultSet rs = null;
Connection con = null;
CallableStatement call = null;
try {
db = new DBconn();
con = db.getConnection();
call = con.prepareCall("{call p_dtsgdttj_getsql_top(?,?,?,?)}"); //调用存储过程
call.registerOutParameter(3, java.sql.Types.VARCHAR); //登记输出参数为字符串(out)
call.registerOutParameter(4, java.sql.Types.INTEGER); //登记输出参数为数字(out) call.setString(1, startDate); //为in参数赋值
call.setString(2, endDate); //为in参数赋值
rs = call.executeQuery(); //置入结果集中
col = call.getInt(4); //
}
catch (ConnectionException e) {
throw new DAOException(e, "统计报表失败!");
}
catch (SQLException e) {
throw new DAOException(e);
}// 关闭数据库资源
finally {
if (rs != null) {
try {
rs.close(); //关闭结果集
}
catch (Exception e) {
e.printStackTrace();
}
}
if (call != null) {
try {
call.close();
}
catch (Exception e) {
e.printStackTrace();
}
} if (con != null) {
try {
con.close(); //关闭连接
}
catch (Exception e) {
e.printStackTrace();
}
}
}
return col;
}