oracle - 如何将此 Pro*c 查询转换为 plsql 过程?
问题描述
''' select_wk910_exist() {
/* changes done for k3 */
MEMSET(wk910_exist_ccno);
EXEC SQL SELECT CARD_CUST_NO INTO :TAB1_exist_ccno FROM TAB1
WHERE APPLN_BATCH_NO!=:app_batch_no
AND CIF_NO=:cif_no AND CODE = code and rownum<2 ;
if ( SQL_ERROR )
{
sprintf(error_mesg,"App batch no....%s App serial no....%ld",
app_batch_no.arr,app_serial_no);
err130_details("Error while selecting EXIST CARD_CUST_NO from TAB1");
}
NULL_TERM(card_cust_no);
if (FOUND)
{
MEMSET(card_cust_no);
card_cust_no.len=sprintf(card_cust_no.arr,"%s",wk910_exist_ccno.arr);
SET_LEN(card_cust_no);
NULL_TERM(card_cust_no);
MEMSET(cust_no);
cust_no.len=sprintf(cust_no.arr,"%s",wk910_exist_ccno.arr);
SET_LEN(cust_no);
NULL_TERM(cust_no);
cif_no_exist=1;
}'''
解决方案
根据您的评论,看看这是否有帮助:
declare
l_ccn tab1.card_cust_no%type;
begin
select card_cust_no
into l_ccn
from tab1
where appln_batch_no <> :app_batch_no
and cif_no = :cif_no
and code = :code
and rownum < 2;
-- query returned something, continue the procedure
-- your code goes here; I don't know how to call Pro*C code from PL/SQL, sorry.
exception
when no_data_found then
-- select didn't return anything; handle the exception. As you didn't say how to handle
-- it, I'm just doing nothing
null;
end;
/
推荐阅读
- c# - winforms程序内的XAML窗口
- c# - Include 属性 lambda 表达式 [...] 无效。表达式应表示属性访问
- android - Wowza.GoCoder 不能与 org.bytedeco.javacv.FFmpegFrameRecorder 一起使用
- excel - VBA代码将带有颜色的单元格复制到同一工作表中的不同单元格
- kdb - kdb q 负数和 mod
- flutter - 如何消除appbar灰线抖动
- c# - 从字符串中删除“\\t\”
- java - 如何在泛型类中正确键入 no-arg 和 withVar 构造函数?
- javascript - 使用 jQuery 进入另一个锚点之前,保持超级菜单可见
- javascript - 使用托管字段获得付款随机数后提交 Braintree 表单