气死我了!!!!!!

fengjie 2002-11-06 01:36:38
我在SQLSERVER中创建了这样的一个类似的存储过程:
CREATE PROC TEST

AS
DECLARE @ErrorSave INT
SET @ErrorSave = 0
IF @@ERROR<>0
SET @ERRORSAVE=@@ERROR

RETURN @@ERRORSAVE

如果没有错误应该返回0才对.

但我用PB调用的时候,sqlca.sqlcode 老是得到-1说

procedure has not been executed or has not results!

这到底是什么原因?

顺便问问,

存储过程的那个返回值怎样得到它?

感激涕怜!!




...全文
54 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhanwei 2002-11-09
  • 打赏
  • 举报
回复
右边的管理
fengjie 2002-11-09
  • 打赏
  • 举报
回复
谢谢

我真的不知道怎么给分你们呀,

请简单说一下,不然我会很内疚的.
winwhere 2002-11-06
  • 打赏
  • 举报
回复
PFC 是 powerbuild foundation class 即PB的基础类库,纯PB代码编写,主要是将开发企业应用管理程序的常用的功能写出来了,如果采用PFC作为编写企业管理系统的框架,会节省很多功夫。

其设计思想是面向对象的,各功能的实现采用了服务的概念。
里面有非常多的PB技巧
fengjie 2002-11-06
  • 打赏
  • 举报
回复
对了,在帮助文件里我怎么找也找不到呀,用什么关键字去找,

那个PFC SERVERS是不是PB中的一个工具,是与开发系统主程序分开的吗??


能不能来点介绍呀.
fengjie 2002-11-06
  • 打赏
  • 举报
回复
叼! 我怎么给你分啊!不晓得怎给呀!
fengjie 2002-11-06
  • 打赏
  • 举报
回复
实在太太谢谢了.我要给你一千分!!!

哈哈哈!

好人哪! PB还有什么类似的问题
balloonman2002 2002-11-06
  • 打赏
  • 举报
回复
老问题,老办法,:),详见PB帮助:

In addition to result sets, Sybase Systems 10.x and 11.x stored procedures may return a long integer return value and output parameters of any data type. After all of the result sets have been returned, PowerScript requires you to issue one final FETCH procedure_name INTO . . . statement to obtain these values. The order in which these values are returned is:

return value, output parm1, output parm2, ...

Example 1

The following stored procedure contains one input parameter (@deptno) and returns a result set containing employee names and salaries for that department. It also returns two output parameters (@totsal and @avgsal), and a return value that is the count of employees in the department.

CREATE PROCEDURE deptroster @deptno integer,

@totsal double precision output,
@avgsal double precision output

AS

DECLARE @number_of_emps integer
SELECT emp_fname, emp_lname, salary FROM employee
WHERE dept_id = @deptno
SELECT @totsal = sum(salary),
@avgsal = avg(salary),
@number_of_emps = COUNT(*) FROM employee
WHERE dept_id = @deptno
RETURN @number_of_emps;

Example 2

The following PowerScript code fragment declares and executes the deptroster stored procedure, processes the result set, and then fetches the return value and output parameters.

integer fetchcount = 0

long lDeptno, rc
string fname, lname
double dSalary, dTotSal, dAvgSal

lDeptno = 100

DECLARE deptproc PROCEDURE FOR
@rc = dbo.deptroster
@deptno = :lDeptno,
@totsal = 0 output,
@avgsal = 0 output
USING SQLCA;

EXECUTE deptproc;

CHOOSE CASE SQLCA.sqlcode
CASE 0
// Execute successful. There is at least one
// result set. Loop to get the query result set
// from the table SELECT.
DO
FETCH deptproc INTO :fname, :lname, :dSalary;
CHOOSE CASE SQLCA.sqlcode
CASE 0
fetchcount++
CASE 100
MessageBox ("End of Result Set", &
string (fetchcount) " rows fetched")
CASE -1
MessageBox ("Fetch Failed", &
string (SQLCA.sqldbcode) " = " &

SQLCA.sqlerrtext)
END CHOOSE
LOOP WHILE SQLCA.sqlcode = 0

// Issue an extra FETCH to get the Return Value

// and Output Parameters.
FETCH deptproc INTO :rc, :dTotSal, :dAvgSal;
CHOOSE CASE SQLCA.sqlcode
CASE 0
MessageBox ("Fetch Return Value and Output" &
"Parms SUCCESSFUL", "Return Value is: " &
string (rc) &
"~r~nTotal Salary: " string (dTotSal) &
"~r~nAverage Sal: " string (dAvgSal))
CASE 100
MessageBox ("Return Value and Output Parms" &
"NOT FOUND", "")
CASE ELSE
MessageBox ("Fetch Return Value and Output" &

"Parms FAILED", "SQLDBCode is " &
string (SQLCA.sqldbcode) " = " &
SQLCA.sqlerrtext)
END CHOOSE

CLOSE deptproc;
CASE 100

// Execute successful; no result set.
// Do not try to close.
MessageBox ("Execute Successful", "No result set")

CASE ELSE

MessageBox ("Execute Failed", &
string (SQLCA.sqldbcode) " = " &
SQLCA.sqlerrtext)

END CHOOSE

754

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧