我可以在 Powerbuilder 中调用 sp_send_dbmail 吗?

发布于 2024-12-04 17:57:20 字数 340 浏览 1 评论 0原文

DECLARE sp_send_dbmail PROCEDURE FOR sp_send_dbmail
    @profile_name = :ls_Null,
    @recipients = :ls_To,
    @copy_recipients = :ls_Null,
    @blind_copy_recipients = :ls_Null,
    @subject    = :ls_Null,
    @body = :ls_Body,
    @importance = :ls_Importance,
    @rtn = :li_Rtn OUTPUT;

EXECUTE sp_send_dbmail;
DECLARE sp_send_dbmail PROCEDURE FOR sp_send_dbmail
    @profile_name = :ls_Null,
    @recipients = :ls_To,
    @copy_recipients = :ls_Null,
    @blind_copy_recipients = :ls_Null,
    @subject    = :ls_Null,
    @body = :ls_Body,
    @importance = :ls_Importance,
    @rtn = :li_Rtn OUTPUT;

EXECUTE sp_send_dbmail;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

始终不够爱げ你 2024-12-11 17:57:20

我不知道为什么不,调用存储过程传统上不是 PowerBuilder 的问题。
从我所看到的来看,该代码似乎很好。

执行后检查 SQLCA.SQLCode 和 SQLCA.SQLErrText 以确定是否存在错误。你可以使用类似的东西:

if SQLCA.SQLCode <> 0 then
   MessageBox("Error", "Error Code: " + String(SQLCA.SQLDBCode) + "~r~n" + &
   "Error Message: " + SQLCA.SQLErrText)
end if

I'm not sure why not, calling stored procs isn't traditionally a problem with PowerBuilder.
That code seems fine from what I can see of it.

After the execute check for SQLCA.SQLCode and SQLCA.SQLErrText to determine if there is an error. You can use something like:

if SQLCA.SQLCode <> 0 then
   MessageBox("Error", "Error Code: " + String(SQLCA.SQLDBCode) + "~r~n" + &
   "Error Message: " + SQLCA.SQLErrText)
end if
美胚控场 2024-12-11 17:57:20

在您的交易对象上声明本地外部函数。打开您的自定义事务对象,然后转到“本地外部函数”选项卡。

定义您的过程或 package.procedure 调用,如以下示例所示:

// stored proc no package
SUBROUTINE SubRtnName(args) RPCFUNC   

// function
long ll_rtn = FUNCTION FuncRtnVal(int li_arg) RPCFUNC 

// standard proc with some in/out parameters
SUBROUTINE CalcAmount(string LS_In1, ref string LS_Out2) RPCFUNC

// package.procedure
SUBROUTINE SubRtnName(args) RPCFUNC ALIAS FOR "PackageName.ProcName"

// more complex package.procedure definition
SUBROUTINE CalcPenaltyAmt(string LS_In1, ref string LS_Out2[]) RPCFUNC ALIAS FOR "Penalty.P_Calc_Amount"

使用子例程或函数名称后定义的名称调用代码中的过程:

// call standard proc
SQLCA.SubRtnName(parms);

// call package.procedure
SQLCA.CalcPenaltyAmt('stingarg', ref ls_ref_string_array);

这假设您在应用程序对象中定义并设置为 SQLCA 的非可视事务对象。如果没有自定义事务对象,您就无法定义这样的外部函数。完成的方法是创建一个标准的非可视类型事务,然后在自定义变量中的应用程序对象中将 SQLCA 替换为 n_tr_transaction。

Declare Local External Functions on your transaction object. Open your custom transaction object, then go to Local External Functions tab.

Define your procedure or package.procedure calls like some of these examples:

// stored proc no package
SUBROUTINE SubRtnName(args) RPCFUNC   

// function
long ll_rtn = FUNCTION FuncRtnVal(int li_arg) RPCFUNC 

// standard proc with some in/out parameters
SUBROUTINE CalcAmount(string LS_In1, ref string LS_Out2) RPCFUNC

// package.procedure
SUBROUTINE SubRtnName(args) RPCFUNC ALIAS FOR "PackageName.ProcName"

// more complex package.procedure definition
SUBROUTINE CalcPenaltyAmt(string LS_In1, ref string LS_Out2[]) RPCFUNC ALIAS FOR "Penalty.P_Calc_Amount"

To call the procedures in code using the name defined after subroutine OR function name:

// call standard proc
SQLCA.SubRtnName(parms);

// call package.procedure
SQLCA.CalcPenaltyAmt('stingarg', ref ls_ref_string_array);

This assumes you have a non-visual transaction object defined and set as the SQLCA in your application object. Without a custom transaction object you cannot define external functions like this. The way you accomplish, is create a standard non-visual of type transaction, then in your application object in custom variables replace SQLCA with your n_tr_transaction.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文