I'm trying to figure out the code to add a new column to the ATA_ENTERTAINER table called MORE_THAN_ONE with a NUMBER datatype (this code will be outside of PL/SQL code). This column will hold the number of style types an entertainer has if they have more than one (if they have one, place a NULL in this column).
My code should, using an explicit cursor and loop structure, go through each entertainer and determine the number of styles they have. If an entertainer has more than one, I need modify the value in the MORE_THAN_ONE column for that entertainer with the number of styles (a NULL should be put in this column if not more than one). I also need to use FOR UPDATE and WHERE CURRENT OF as part of my solution. Using a basic loop to solve this problem, and an IF for any decision structures.
This is what I have right now. It doesn't show me any errors, but somehow, my table doesn't update/change when I run this code.
DECLARE
ata_entId ata_entertainer.entertainer_id%TYPE;
ata_st_entId ata_entertainers_style.entertainer_id%TYPE;
ata_more ata_entertainer.more_than_one%TYPE;
ata_count NUMBER(10) := 0;
CURSOR ata_rec IS
SELECT entertainer_id
FROM ata_entertainers_style
WHERE ata_st_entId = ata_entId
FOR UPDATE;
BEGIN
OPEN ata_rec;
LOOP
FETCH ata_rec INTO ata_st_entId;
EXIT WHEN ata_rec%NOTFOUND;
IF ata_st_entId = ata_entId THEN ata_more := ata_count+1;
UPDATE ata_entertainer SET more_than_one = ata_more
WHERE CURRENT of ata_rec;
END IF;
END LOOP;
CLOSE ata_rec;
END;
/

ATA_ENTERTAINER.ATA_ENTERTAINERdoes not contain theMORE_THAN_ONEcolumn. Have you successfully added that column to the table, as stated in your question?