Cache Procedure with multiple inserts
I am trying to create a Procedure in Caché, but this message is showing:
<UNDEFINED>frmit+118^%qaqpsq *mt("v",1)
This is the procedure:
CREATE PROCEDURE testebi.sp_cargainicial()
BEGIN
INSERT INTO testebi.Fato_Atendimentos (
PK_OsProcedimento )
SELECT ID
from dado.TblOsProcedimento ;
UPDATE testebi.Fato_Atendimentos as A SET PrimeiraOS = 1
FROM
(select min(convert(int,data)) data, paciente
from dado.arqordemservico
group by paciente) as b
WHERE a.fk_paciente = b.paciente and a.fk_Data = b.data;
end
It works if I try to create the procedure with only the INSERT or with UPDATE part like this:
CREATE PROCEDURE testebi.sp_cargainicial()
BEGIN
UPDATE testebi.Fato_Atendimentos as A SET PrimeiraOS = 1
FROM
(select min(convert(int,data)) data, paciente
from dado.arqordemservico
group by paciente) as b
WHERE a.fk_paciente = b.paciente and a.fk_Data = b.data;
end
Have you ever see this error?