PL/SQL Oracle Application Express 中的错误

PL/SQL error in Oracle Application Express

我正在尝试在 OAE 中制作一个包含函数、过程和游标的程序包。当我尝试 运行 它时,出现以下错误

Error at line 21: PLS-00103: Encountered the symbol "CURSOR" when expecting one of the following: end not pragma final instantiable order overriding static member constructor map

这是我的代码:

 create or replace package PACKAGEPROIECT as

procedure DEL_BANCA (
   p_banid.id_banca%TYPE) IS
BEGIN 
  DELETE FROM banci_pnu
  WHERE id_banca=p_banid;
  IF SQL%NOTFOUND THEN RAISE_APPLICATION_ERROR(-20203, 'Nicio banca nu a fost stearsa din baza de date');
  END IF;
  END DEL_BANCA;
BEGIN
    PACKAGEPROIECT.creste_credit(1,20,'ipotecar');
END;


function formatNume (p_nume IN VARCHAR, p_prenume IN VARCHAR)
    RETURN VARCHAR IS
BEGIN
    RETURN p_nume || ' ' || p_prenume;
END;
    CURSOR c_toticlientii IS
    SELECT nume,prenume FROM clienti
    v_formatareNume varchar(70);
BEGIN
  FOR v_clientRecord IN c_toticlientii
  LOOP v_formatareNume := formatNume(v_clientRecord.nume, v_clientRecord.prenume);
  INSERT INTO temp_table(fname) VALUES (v_formatareNume);
END LOOP;
END formatNume; 
COMMIT;
END;

我做错了什么? 谢谢!

包规范 中声明 CURSOR 在顶部,即 在声明函数和过程之前。

同样的顺序甚至适用于匿名块

我在这里写了一篇关于它的文章http://lalitkumarb.com/2014/07/07/order-of-item-list-in-declaration-part-of-plsql-anonymous-block-pls-00103/

声明部分的项目列表顺序如下:

  • 变量、游标、类型、子类型、常量等项目列表

  • 函数。

  • 程序。