Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/03/2007, 06:51
rodymelo
 
Fecha de Ingreso: septiembre-2004
Mensajes: 92
Antigüedad: 20 años, 1 mes
Puntos: 0
error pls-00103

hola tngo esta funcion y me tira error en "declare"
El error que me dice es
"Compilation errors for FUNCTION DOO_PAMPA.MERGEBUS

Error: PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor external language
The symbol "begin" was substituted for "DECLARE" to continue.
Line: 5
Text: Declare"


CREATE OR REPLACE FUNCTION MergeBUs(P_PC_ID Pc_Main.Pc_Id%type)
RETURN varchar2
AS

Declare
P_result varchar2(150);
P_reader varchar2(50);
Cursor region_cursor IS
SELECT DISTINCT BUS_BusinessUnits.BUS_Name
FROM GAPS_BDI_BillingData, BUS_BusinessUnits
WHERE GAPS_BDI_BillingData.PC_ID=P_PC_ID and
BUS_BusinessUnits.BUS_ID=GAPS_BDI_BillingData.BUS_ ID;
Begin
OPEN region_cursor;
FETCH region_cursor INTO P_result;
loop
FETCH region_cursor INTO P_reader;
P_result:=P_result + ', ' + P_reader;
exit when region_cursor%notfound;
end loop;
CLOSE region_cursor;
return P_result;
end;
end;