I have checked over this several times. The column count matches yet I keep getting an error saying the fetch into statement does not match the count
declare cur_range CURSOR FOR
SELECT
GroupID,
OddEven,
RangeLow,
RangeHigh
PostCode1,
PostCode2,
ID,
OldPrimaryID,
ThFareID
FROM tmpNewPrimaryRange;
OPEN cur_range
FETCH NEXT FROM cur_range
into
@cur_GroupID
, @cur_OddEven
, @cur_RangeLow
, @cur_RangeHigh
, @cur_PostCode1
, @cur_PostCode2
, @cur_ID
, @cur_OldPrimaryID
, @cur_ThFareID
Error: Cursorfetch: The number of variables declared in the INTO list must match that of selected columns.
If you were consistent in your placement of commas either before or after columns, you might have spotted this:
declare cur_range CURSOR FOR
SELECT
GroupID,
OddEven,
RangeLow,
RangeHigh --- <-- ******* NO COMMA HERE ******
PostCode1,
PostCode2,
ID,
OldPrimaryID,
ThFareID
This is saying SELECT ... RangeLow, RangeHigh AS PostCode1, PostCode2 ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With