最近测试部遇到环境的问题,在我们开发这边开发,运行好的程序,到了测试部那里死活运行不过。应他们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退格、上翻键乱码问题
Oracle SQLPLUS提示符设置