【发布时间】:2017-04-07 02:04:37
【问题描述】:
我想用这个程序来显示用户名和手机号码,当我使用 select 时结果集是这样的:
声明enter image description here
当程序运行时,我得到这个: enter image description here
错误 ORA-01722:无效号码
ORA-06512:在“ABPROD.SHAREPOOL”,第 24 行。
当我在光标中使用 unique 或 distinct 时,没有任何显示。 代码来源:
create or replace procedure sharepool (assignment in varchar2,myorgname in varchar2) is
rightid T_CLM_AP30_RIGHT.RIGHT_ID%type;
orgid t_clm_ap30_org.org_id%type;
begin
select t.right_id into rightid from T_CLM_AP30_RIGHT t where t.rightdesc=trim(assignment);
dbms_output.put_line(rightid||trim(myorgname)||assignment);
select t.org_id into orgid from t_clm_ap30_org t where t.orgname=trim(myorgname);
dbms_output.put_line(orgid);
declare
cursor namelist is select distinct a.username,a.mobile from t_clm_ap30_user a, T_CLM_AP30_RIGHT_AUTH t where a.user_id=t.user_id and t.right_id=rightid and t.poolorgrange=orgid ;
begin
for c in namelist
loop
dbms_output.put_line(c.username||' '||c.mobile);
end loop;
end;
end sharepool;
【问题讨论】:
-
您在此处发布的代码显然不是您正在执行的代码,因此真的不清楚您希望我们如何提供帮助。我们只能说 INVALID_NUMBER 错误表明将字符串转换为数字失败。可能这意味着您的连接条件之一是将字符串列与数字列进行比较,并且您在字符串列中有无法转换为数字的值。
-
我已经发布了我的完整代码。当我运行它时,我得到了这个:ORA-01722:无效号码 ORA-06512:在“ABPROD.SHAREPOOL”,第 24 行 ORA-06512:在第 1 行
标签: plsql cursor unique distinct