Desired output:
Doe, John E 1234567891234567 Yes
Doe, Johnnie R 1234567891234567 No
Im trying to look up/loop to see it the credit card number in table_A can be found in table_B -- If
I can find the credit card nubmer then Yes otherwise No
DECLARE
CURSOR CUR_CREDIT_CARD_CK IS
select z.lastname||', '||z.firstname||' '||z.m, z.credit_card,
from TABLE_A Z, TABLE_B c
where z.ssn = c.ssn
having count(c.cardnumber) = 1
group by z.lastname||', '||z.firstname||' '||z.m, z.credit_card
order by z.lastname||', '||z.firstname||' '||z.m, z.credit_card;
CUR_CREDIT_CARD_CK%ROWTYPE;
BEGIN
OPEN CUR_CREDIT_CARD_CK;
LOOP
FETCH CUR_CREDIT_CARD
INTO MATCH;
EXIT WHEN CUR_CREDIT_CARD_CK%NOTFOUND;
IF Z.CREDIT_CARD = C.CARDNUMBER
THEN DBMS_OUTPUT.PUT_LINE
(CUR_CREDIT_CARD_CK||'YES');
ELSE DBMS_OUTPUT.PUT_LINE
(CUR_CREDIT_CARD_CK||'NO');
END IF;
END LOOP;
CLOSE CUR_CREDIT_CARD_CK;
END;
/
I'm not able to get this cursor to work. Any suggestions on how I can get this cursor to work?
Doe, John E 1234567891234567 Yes
Doe, Johnnie R 1234567891234567 No
Im trying to look up/loop to see it the credit card number in table_A can be found in table_B -- If
I can find the credit card nubmer then Yes otherwise No
DECLARE
CURSOR CUR_CREDIT_CARD_CK IS
select z.lastname||', '||z.firstname||' '||z.m, z.credit_card,
from TABLE_A Z, TABLE_B c
where z.ssn = c.ssn
having count(c.cardnumber) = 1
group by z.lastname||', '||z.firstname||' '||z.m, z.credit_card
order by z.lastname||', '||z.firstname||' '||z.m, z.credit_card;
CUR_CREDIT_CARD_CK%ROWTYPE;
BEGIN
OPEN CUR_CREDIT_CARD_CK;
LOOP
FETCH CUR_CREDIT_CARD
INTO MATCH;
EXIT WHEN CUR_CREDIT_CARD_CK%NOTFOUND;
IF Z.CREDIT_CARD = C.CARDNUMBER
THEN DBMS_OUTPUT.PUT_LINE
(CUR_CREDIT_CARD_CK||'YES');
ELSE DBMS_OUTPUT.PUT_LINE
(CUR_CREDIT_CARD_CK||'NO');
END IF;
END LOOP;
CLOSE CUR_CREDIT_CARD_CK;
END;
/
I'm not able to get this cursor to work. Any suggestions on how I can get this cursor to work?