I believe the assignment in the WHERE
condition missed Single Quotes!
As the Query is framed a String, assigning a VARCHAR variable just paste the value like WHERE IV_USER = James.T.Sanders
. And it has to be either used as a bind variable or enclosed within single quotes !
OPEN user_list FOR 'select IV_USER FROM EXT_USER.PORTAL_ACCOUNTS';
LOOP
FETCH user_list INTO user_list_rec;
execute immediate 'update EXT_USER.PORTAL_ACCOUNTS set PERSON_ID=:ssan_new WHERE IV_USER='''||user_list_rec.IV_USER||''' ' USING ssan_new;
ssan_new := ssan_new + 1;
END LOOP;
OR (Without a Dynamic SQL for UPDATE, Ofcourse many solutions are possible without dynamic SQL)
OPEN user_list FOR 'select IV_USER FROM EXT_USER.PORTAL_ACCOUNTS';
LOOP
FETCH user_list INTO user_list_rec;
update EXT_USER.PORTAL_ACCOUNTS set PERSON_ID = ssan_new WHERE IV_USER = user_list_rec.IV_USER;
ssan_new := ssan_new + 1;
END LOOP;