0
votes

    create  or replace package pachet_f_p is
    function majorare_sal_manageri(sal in  NUMBER, majorare in  NUMBER) return NUMBER;
    end pachet_f_p;


    create or replace package body pachet_f_p
    is
     create or replace function majorare_sal_manageri(sal in  NUMBER, majorare in  NUMBER)
    return INTEGER is
    nr_angajati INTEGER :=0;
    begin
    dbms_output.put_line('Angajatii care primesc majorare de '|| majorare || 'au ID-urile urmatoare :');
    /*
    declare
    cursor numara_ang_cccc is
      select ID from MANAGERI where SALARIU = sal;
      m_ID MANAGERI.ID%TYPE;
    begin
      open numara_ang_c;
      loop
        fetch numara_ang_c into m_ID;
        exit when numara_angajati_cursor%NOTFOUND;
        dbms_output.put_line(m_ID);
        update MANAGERI 
        set
        SALARIU = SALARIU + majorare
        where  ID = m_ID;
        nr_angajati := nr_angajati +1;
      end loop;
      close numara_ang_cccc;
    end; 
    */
    return nr_angajati;
    end majorare_sal_manageri;

    end pachet_f_p;

I can run the first 3 rows, but the rest of it gets an error: Error(5,2): PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: begin end function pragma procedure subtype type current cursor delete exists prior Can someone, please, find what I did wrong?

1
See stackoverflow.com/questions/20334067/… that can help you with a resolution.zedfoxus
PLSQL..........I'm just dumb and tired. Thanksvv ss
PLSQL...................................................I saw that question, but doesn't work for me. Thank you anyway!vv ss
Are you using oracle or mariadb?zedfoxus
oracle sql developervv ss

1 Answers

1
votes

First create package specifications and Package body next(two separate pl/sql blocks)this compiles with no errors in Sql Developer

       create  or replace package pachet_f_p is
          function majorare_sal_manageri(sal in  NUMBER, majorare in  NUMBER) 
            return NUMBER;
        end pachet_f_p;
       -- add back slash here
       /    
        create or replace package body pachet_f_p
        is
         --create or replace (comment or remove this)
         function majorare_sal_manageri(sal in  NUMBER, majorare in  NUMBER)
        return number is
        nr_angajati number :=0;
        begin
        dbms_output.put_line('Angajatii care primesc majorare de '|| majorare || 'au ID-urile urmatoare :');
        /*
        declare
        cursor numara_ang_cccc is
          select ID from MANAGERI where SALARIU = sal;
          m_ID MANAGERI.ID%TYPE;
        begin
          open numara_ang_c;
          loop
            fetch numara_ang_c into m_ID;
            exit when numara_angajati_cursor%NOTFOUND;
            dbms_output.put_line(m_ID);
            update MANAGERI 
            set
            SALARIU = SALARIU + majorare
            where  ID = m_ID;
            nr_angajati := nr_angajati +1;
          end loop;
          close numara_ang_cccc;
        end; 
        */
          return nr_angajati;
          end majorare_sal_manageri;
         end pachet_f_p;
/