Error: Msg [5526 : HY000] SPL1045:E(L21), Invalid or missing INTO clause

Training
Enthusiast

Error: Msg [5526 : HY000] SPL1045:E(L21), Invalid or missing INTO clause

create PROCEDURE B2C_CM

 

(v_StartDate INTEGER,

v_EndDate INTEGER,

v_CID INTEGER)

 

DYNAMIC RESULT SETS 1

 

BEGIN

 

if ((v_StartDate = 0 or v_EndDate = 0) and v_CID <> 0) then

 

select a.CID, a.ContactDate_ID GrantDate_ID, a.NumberOfPoints NumOfGoldTokens

from DWH.DW_Contacts a

where a.CampaignCode = 1111

and a.ContactDate_ID >= 20170329

and a.CID = v_CID

and a.GlobalContactType_ID = 43

and a.OfferCode_ID = 495

order by CID,GrantDate_ID;

 

else

select CID from DWH.DW_Contacts a

where CID=0;

end if;

END;

 

Please help with this error - i don't understand what's wrong...

 

4 REPLIES
Enthusiast

Re: Error: Msg [5526 : HY000] SPL1045:E(L21), Invalid or missing INTO clause

I thing in stored procedure when you use SELECT keyword, it can't be use alone (without inserting to table or variable).

Enthusiast

Re: Error: Msg [5526 : HY000] SPL1045:E(L21), Invalid or missing INTO clause

hi, tnx, but i think the problem is in this lines:

 

 else
  begin
   select CID=0, GrantDate_ID=0, NumOfGoldTokens=0
  end

Teradata Employee

Re: Error: Msg [5526 : HY000] SPL1045:E(L21), Invalid or missing INTO clause

To return a result set, you must declare a cursor for the SELECT statement and OPEN the cursor.

Enthusiast

Re: Error: Msg [5526 : HY000] SPL1045:E(L21), Invalid or missing INTO clause

Did it!

 

Tnx a lot