| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> Dynamic SQL
Below is a simple example of what I'm trying to accomplish. It's not working unfortunately. I don't think that EXECUTE IMMEDIATE likes the INTO to be in the sql statement. I think it wants something like EXECUTE IMMEDIATE sql_statement INTO varname. The problem is that 'varname' is what needs to be dynamic. Any ideas?
DECLARE
tmp1 VARCHAR(50);
tmp2 VARCHAR(50);
BEGIN
FOR loop_counter IN 1..2
LOOP
EXECUTE IMMEDIATE 'SELECT ''blah'' INTO tmp' || loop_counter || '
FROM DUAL';
END LOOP;
DBMS_OUTPUT.PUT_LINE(tmp1);
DBMS_OUTPUT.PUT_LINE(tmp2);
END;
Received on Fri Jun 06 2003 - 09:14:31 CDT
![]() |
![]() |