Jc3000 bueno te muestro todo el plsql es el siguiente
Código PHP:
reate or replace
FUNCTION getAcronimoServPrincipPaquetiz
(
INT sol,
BOOLEAN prin,
BOOLEAN comp) RETURN VARCHAR
IS
BEGIN
DECLARE
servicio INTEGER;
solicitud INT;
tipo INTEGER;
tiposervicio VARCHAR;
acro VARCHAR;
prin_acro VARCHAR(2);
com_acro VARCHAR(1);
BEGIN
SELECT dp.servicio ,
dp.numero_solicitud,
s.tipo ,
gettiposervicio(dp.servicio)
INTO servicio,
solicitud ,
tipo ,
tiposervicio
FROM detalle_paquetizacion dp
inner join paquetizacion
ON(dp.codigo_paquetizacion = paquetizacion.codigo)
inner join solicitudes s
ON(s.numero_solicitud = dp.numero_solicitud)
WHERE p.numero_solicitud_paquete = sol
AND principal ='''';
acro := '\';
IF tipo = 12 THEN
IF prin = true THEN
prin_acro := '''';
ELSE
prin_acro := '''';
END IF;
IF comp = true THEN
com_acro := '''';
ELSE
com_acro := ''';
END IF;
SELECT dcd.acronimo_diagnostico
INTO acro
FROM cargos_directos cd
inner join diag_cargos_directos_hc dcd
on (dcd.codigo_cargo_directo=cd.codigo_datos_hc)
where cd.numero_solicitud = solicitud
AND dcd.principal = prin_acro
AND dcd.complicacion = com_acro limit 0,1;
ELSE
IF tiposervicio IS NOT NULL THEN
IF tiposervicio IN (R,Q,D) THEN
SELECT d.diagnostico
INTO acro
FROM sol_cirugia_por_servicio sc
INNER JOIN diag_post_opera_sol_cx d
ON(d.cod_sol_cx_servicio=sc.codigo
AND d.principal = prin
AND d.complicacion = comp )
WHERE sc.numero_solicitud = solicitud
AND sc.servicio = servicio limit 1;
END IF;
IF tiposervicio = P THEN
SELECT dp.acronimo
INTO acro
FROM res_sol_proc rsp
INNER JOIN diag_procedimientos dp
ON(dp.codigo_respuesta =rsp.codigo
AND dp.principal = prin
AND dp.complicacion = comp)
WHERE rsp.numero_solicitud = solicitud
ORDER BY rsp.codigo DESC limit 0,1;
END IF;
END IF;
END IF;
IF acro IS NULL THEN
acro := ;
END IF;
RETURN acro;
END;
END;
estos on los errores que saca
Error(35,24): PLS-00103: Encountered the symbol "\" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternatively
Error(50,9): PLS-00103: Encountered the symbol "INNER" when expecting one of the following: , ; for group having intersect minus order start union where connect