Error Code: 1172. Result consisted of more than one row
Hi, I am new to MySql, This above error is related to Stored procedure.
If i execute my SP with some parameter i am getting the Above error.
what should i do to come out of this error?
Thanks in advance.
Ex;call SPGetDetailsByID(682, 102, '::100', 'Windows', 4128);
The below is the full SP for your reference
CREATE PROCEDURE SPGetDetailsByID
(
p_ID int /* = null */,
P_Mode int /* = null */,
P_IPADDRESS varchar(100)/* =null */,
P_OsBrowser varchar(100)/* =null */,
P_Subscriberid int /* = null */
)
BEGIN
declare v_WorkflowID int ; declare v_documentid int; declare v_docname varchar(100); declare v_Name varchar(100); declare v_Email varchar(100);
select Workflowid into v_WorkflowID from VerticalizedWorkdetails where DocumentID = P_ID limit 1;
select DocumentName into v_docname from DocDetails where DocumentID=P_ID;
select Name into v_Name from SbscrbrDetails where SubscriberId=P_Subscriberid;
select EmailID into v_Email from ContactDetails where SubscriberId=P_Subscriberid;
select DocumentID into v_documentid from VerticalizedWorkdetails where WorkFlowID=P_ID;
select Name into v_Name from SbscrbrDetails where SubscriberId=P_Subscriberid;
select EmailID into v_Email from ContactDetails where SubscriberId=P_Subscriberid;
select distinct Sd.Name,
CD.EmailID,
vf.StatusID as StatusID,
VF.CreatedBy as SubscriberID,
'' as DocumentID,
'' as DocumentName,
1 as Initiater,
'' as WorkID,
'' as DelegatorEmailID,
'' as DelegatorName,
'' as SignatureType
from SbscrbrDetails SD
inner join
ContactDetails CD on cd.subscriberid = SD.SubscriberID
inner join
VerticalizedWorkFlowDetails VF on VF.CreatedBy = SD.SubscriberID
where VF.WorkFlowID = P_ID
union all
select distinct SD.Name,
CD.EmailID,
VD.StatusID,
VD.SubscriberID,
VD.DocumentID,
dd.DocumentName,
0 as Initiater,
vd.WorkID,
CD1.EmailID as delegateMailID,
SD1.Name as DelegatorName,
VD.SignatureType
from SbscrbrDetails SD
inner join
ContactDetails CD on cd.subscriberid = SD.SubscriberID
inner join
VerticalizedWorkdetails VD on VD.SubscriberId = SD.SubscriberID
left join
ContactDetails CD1 on VD.Delegateto = CD1.SubscriberID
left join
SubscriberDetails SD1 on VD.Delegateto = SD1.SubscriberID
inner join
DocumentDetails DD on DD.DocumentID = VD.DocumentID
where vd.WorkFlowID = P_ID order by WorkID;
INSERT INTO ACTIVITYLOG(SUBSCRIBERID,ACTION,DESCRIPTION,CREATEDDATETIME,IPADDRESS,OSandBrowser)
VALUES(P_Subscriberid,'Signing order diagram viewed',CONCAT('Viewed Signing Order diagram for:',SPACE(2)+CAST(P_ID as char(9))),NOW(),P_IPADDRESS,P_OsBrowser);
END;