I am newbie to SQL.
I want to insert data into table using below for-loop query. But unable to identify the issue
declare
cursor mac is SELECT DISTINCT(MAC) FROM DEVICES;
cmd varchar2(200);
begin
for c in mac loop
cmd := 'INSERT INTO MAC VALUES(DEVICES_ID_SEQ.nextVal,'||c.MAC||',"ABC","123")';
execute immediate cmd;
end loop;
end;
For each MAC in existing table, I want to insert new record.