【问题标题】:how to conver this Pro*c query into plsql procedure?如何将此 Proc 查询转换为 pl sql 过程?
【发布时间】:2021-04-22 07:54:53
【问题描述】:

''' 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;
}'''

【问题讨论】:

  • a) 你必须等待会说 Pro*C 和 Oracle 的 PL/SQL 的人然后去做,b) 解释这是什么一段代码可以让知道 PL/SQL 的人可以尝试提供帮助
  • 如果选择查询返回 null 它应该在异常中处理,如果它的返回值则 pro*c 代码(如果找到)运行

标签: oracle stored-procedures plsql procedure proc


【解决方案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;
/    

【讨论】:

  • 如果(发现){ 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;我确实需要这组代码说的
  • 抱歉,我不会翻译那个代码,我不会说 Pro*C。
猜你喜欢
  • 2021-05-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-29
  • 2016-01-23
  • 2022-01-22
  • 2011-12-14
相关资源
最近更新 更多