dimanche 8 décembre 2019

Why do I have an error "exact fetch returns more than requested number of rows"?

    1. create or replace procedure cities (
    2. vname in varchar2,
    3. vuni out varchar2
    4. ) as
    5. cursor c is
    6. select city_name, uni_name from uni ;
    7. cx c%rowtype;
    8. begin
    9. select uni_name into vuni from uni; 
    10. open c;
    11. loop
    12. fetch c into cx;
    13. exit when c%notfound;
    14. if (vname = 'Almaty') then
    15. select distinct cx.uni_name into vuni from uni where  cx.city_name = vname;
    16. elsif (vname = 'Nur-Sultan') then
    17. select distinct cx.uni_name into vuni from uni where cx.city_name = vname;
    18. elsif (vname = 'Aktau') then
    19. select distinct cx.uni_name into vuni from uni where cx.city_name = vname;
    20. else
    21. select distinct cx.uni_name into vuni from uni where cx.city_name = vname;
    22. end if;
    23. end loop;
    24. close c;
    25. end;

Aucun commentaire:

Enregistrer un commentaire