plsql - error in pl/sql package body -


i having error:

error(42,22): pls-00103: encountered symbol ")" when expecting 1 of following: current

i have written package few functions , procedures.

here package:

-- specification --  create or replace package superhero_package  function get_full_superheroname(v_superheroname in varchar2)     return varchar2; procedure get_superheros(v_city in varchar2); procedure get_all_villans; function get_max_xp     return number; function get_strongest_superhero     return varchar2;  end superhero_package;  -- body --  create or replace package body superhero_package   function get_full_superheroname(v_superheroname in varchar2)     return varchar2         begin             select first_name, last_name              v_fname, v_lname             superhero             superhero_name = v_superheroname;              return (v_fname || " " || v_lname);         end;  procedure get_superheros(v_city in varchar2)             cursor justice_league             select superhero_name superhero city = v_city;             league_member justice_league % rowtype;         begin             open justice_league;             loop                  fetch justice_league league_member;                 exit when (justice_league % notfound);                 dbms_output.put_line(league_member.name);             end loop;             close justice_league;         end;  procedure get_all_villans             cursor dark_force             select villan superhero;             force_member dark_force % rowtype;         begin             open dark_force;             loop             fetch dark_force force_member;             exit when (dark_force % notfound);             dbms_output.put_line(force_member.villan);             end loop;             close dark_force;         end;  function get_max_xp()     return number         declare             n_xp := 0;         begin             select max(xp) n_xp superhero;             return n_xp;         end;  function get_strongest_superhero()     return varchar2         declare              v_name := 'dna';             v_fname := 'swayam';             v_lname := 'raina';         begin             select superhero_name, first_name, last_name             v_name, v_fname, v_lname             superhero             xp = get_max_xp();             return (v_fname || " " || v_lname || " aka " || v_name);         end;  end superhero_package; 

you code full of mistakes. please check below corrections.

create or replace package superhero_package    function get_full_superheroname (v_superheroname in varchar2)  return varchar2;     procedure get_superheros (v_city in varchar2);     procedure get_all_villans;     function get_max_xp  return number;     function get_strongest_superhero return varchar2; end superhero_package;  -- body --  create or replace package body superhero_package    function get_full_superheroname (v_superheroname in varchar2)     return varchar2     v_fname varchar2(1000);      v_lname varchar2(1000);     begin       select first_name, last_name         v_fname, v_lname         superhero        superhero_name = v_superheroname;        return(v_fname||'--'||v_lname);    end;     procedure get_superheros (v_city in varchar2)          cursor justice_league(vr_city varchar2)  --- parameterized query                select superhero_name            superhero           city = vr_city;        league_member  justice_league%rowtype;    begin       open justice_league(v_city);  --this way call.        loop          fetch justice_league league_member;           exit when justice_league%notfound;  -- no brackets needed           dbms_output.put_line(league_member.superhero_name);        end loop;        close justice_league;    end;     procedure get_all_villans          cursor dark_force                select villan          superhero;        force_member   dark_force%rowtype;    begin       open dark_force;        loop          fetch dark_force force_member;           exit when dark_force%notfound;           dbms_output.put_line (force_member.villan);        end loop;        close dark_force;    end;     function get_max_xp       return number        n_xp number:= 0;          --never use declare here     begin       select max (xp) n_xp superhero;        return n_xp;    end;     function get_strongest_superhero        return varchar2          v_name  varchar2(1000)  := 'dna';                  --------declaration missing       v_fname varchar2(1000)  := 'swayam';       v_lname varchar2(1000)  := 'raina';    begin       select superhero_name, first_name, last_name         v_name, v_fname, v_lname         superhero        xp = (select get_max_xp() dual);  ----general practrice call function in clause        return (v_fname||' '||v_lname||'aka'||v_name); --no double quotes    end; end superhero_package; 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -