我在执行plsql查询时遇到错误ORA-01422

时间:2017-03-13 12:22:21

标签: oracle

  

我在执行下面的plsql查询时遇到错误ORA-01422

Declare
    X NUMBER ;
    Bonus number; 
    begin 
    select acy_opening_bal into x from sttm_cust_account where branch_code ='000';
    bonus:= x+2000;
     dbms_output.put_line('bonus is: '|| bonus);
     end; 
    /

1 个答案:

答案 0 :(得分:0)

试试这个:

Declare
    X NUMBER ;
    Bonus number; 
    begin 
    select distinct first_value(acy_opening_bal) over (partition by branch_code  ORDER BY acy_opening_bal ASC) into x from sttm_cust_account where branch_code ='000';
    bonus:= x+2000;
     dbms_output.put_line('bonus is: '|| bonus);
     end; 
    /