How can I pass a column name as a parameter to a SQL statement ?
I have a table with columns named Log1,Log2,...,Log10.
I want to run a loop and for each cicle to update the alue in LogX column.
This is my code :
<<
DECLARE
logX myTable.Log1%TYPE;
BEGIN
for i IN 1..11 LOOP
logX := CONCAT('Log',TO_CHAR(i,'99'));
UPDATE myTable set &logX='010100000000000';
end loop;
END;
>>
"logX" is the varaible that contais the current column name.
Thanks,
Richard