 <p>You don't need EXECUTE IMMEDIATE in this context.</p> <pre><code>DECLARE long_var long:=0; BEGIN DBMS_OUTPUT.PUT_LINE(LENGTH(long_var)); SELECT filesize INTO long_var FROM files; DBMS_OUTPUT.PUT_LINE(LENGTH(long_var)); END; / </code></pre> <p>EXECUTE IMMEDIATE runs a stand alone statement of SQL from your PL/SQL code. It can't return anything to your code. The statement you're using isn't valid SQL so you get the ORA-00905. It is valid PL/SQL code and so works as you'd expect once EXECUTE IMMEDIATE is removed.</p> <p><strong>Edit</strong></p> <p>Code for your follow on question: To do this with more than one row you can use this</p> <pre><code>DECLARE CURSOR C1 IS SELECT filesize FROM files; BEGIN FOR files IN c1 LOOP DBMS_OUTPUT.PUT_LINE(LENGTH(files.filesize)); END LOOP; END; / </code></pre>