With the help of one of StackOverflow’s I beat one problem, but now I have another. In my procedure I have this code:
BEGIN
FOR nr IN 1..102
LOOP
DBMS_OUTPUT.PUT_LINE(nr);
EXECUTE IMMEDIATE
'BEGIN ' ||
'IF rec.column_' || nr ||' IS NULL THEN ' ||
':x:=1; ' ||
'ELSE ' ||
':x:=0; ' ||
'END IF; ' ||
'END; '
USING OUT isnull;
IF isnull = 1 THEN
DBMS_OUTPUT.PUT_LINE('test');
END IF;
END LOOP;
END;
Unfortunately when I try to run this procedure I get en error: PLS-00201 identifier ‘rec.column_1′ must be declared. I’ ve found that:
In the dynamic SQL that you are executing, you refer to OrderStoreData, but no variable of that name is defined in the dynamic SQL.
The code executed by the Execute Immediate execute in it’s own scope, and everything not defined explicitly as part of the NDS or passed in as a bind variable will be out of scope.
But I do not know how to deal with this.
Record must be accessed from dynamic sql block, so place it for example in package header. Then it’s globally available…