PL/SQL視窗可執行,而預存程序內執行就報錯

來源:互聯網
上載者:User

PL/SQL視窗可執行,而預存程序內執行就報錯

最近測試部遇到環境的問題,在我們開發這邊開發,運行好的程式,到了測試部那裡死活運行不過。應他們dba要求,過去檢查。程式段如下:

我用vsql變數將執行的動態sql列印查看如下:

insert into tb_bil_acct_his_562
  (acct_id,
  acct_name,
  acct_nbr_97,
  cust_id,
  pay_method,
  branch_id,
  bank_acct,
  addr_id,
  crt_date,
  eff_date,
  exp_date,
  mod_date,
  eff_state,
  latn_id,
  addr_desc,
  post_code,
  mailing_flag,
  bank_acct_name,
  post_target_addr,
  empee_id,
  exch_id,
  month_id,
  serv_id,
  OPER_TYPE_ID,
  ACTION_DATE,
  ACTION_TYPE,
  HIS_ID,
  HAND_FLAG)
  select a.acct_id,
        a.acct_name,
        a.acct_nbr_97,
        a.cust_id,
        a.pay_method,
        a.branch_id,
        a.bank_acct,
        a.addr_id,
        a.crt_date,
        a.eff_date,
        a.exp_date,
        a.mod_date,
        a.eff_state,
        a.latn_id,
        a.addr_desc,
        a.post_code,
        a.mailing_flag,
        a.bank_acct_name,
        a.post_target_addr,
        a.empee_id,
        a.exch_id,
        a.month_id,
        a.serv_id,
        28,
        sysdate,
        1,
        seq_bil_acct_his_hisid_566.nextval,
        0
    from tb_bil_acct_566 a
  where a.acct_id = 5021006 and a.serv_id is null

該段sql在單獨的sql視窗可以順利執行,但預存程序一執行就報ora-00942 table or view doesn't exist

開始納悶了很久,後來查資料得知如果使用者有dba角色,角色裡包含的許可權在預存程序裡不會被繼承;所以又單獨對tb_bil_acct_566 ,seq_bil_acct_his_hisid_566.nextval等作了顯式賦權,問題得以解決。

rlwrap - 解決Linux下SQLPLUS退格、上翻鍵亂碼問題

SQLPLUS spool 到動態記錄檔名

Oracle SQLPLUS提示符設定

通過設定SQLPLUS ARRAYSIZE(行預取)加快SQL返回速度

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.