CREATE PROCEDURE getpatientclaim(IN idd int) BEGIN
create temporary table spec(patient_id int,claim_id int,procedure_code int);
insert INTO spec SELECT p.patient_id,p.claim_id,p.procedure_code FROM
payment p LEFT JOIN patient_visit_cpt pvc ON p.patient_id = pvc.patient_id
WHERE p.claim_id = idd;
END
it successfully created and i tried to call procedure like this
call getpatientclaim(4963);
output comes like :
it returned an empty result set.
The select query returns many rows but in procedure it returns empty. please help
Add
SELECT * FROM `spec`;
at the end of your procedure body (before END
).
But do you really need a temporary table for this? Just
CREATE PROCEDURE getpatientclaim(IN idd int) BEGIN
SELECT p.patient_id,p.claim_id,p.procedure_code
FROM payment p LEFT JOIN patient_visit_cpt pvc ON p.patient_id = pvc.patient_id
WHERE p.claim_id = idd;
END
would produce the same outcome. (And in that case a VIEW
would probably more appropriate.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.