0

I am having trouble creating a .sql batch file that can execute a select statement on SQL Developer.

This is my code:

set pagesize 500
spool  @c:\temp\output.log
set echo on 

SELECT OBJECT_NAME 
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'TABLE'
AND OWNER = 'DWBATCH'
GROUP BY = 'OBJECT_NAME'

spool off

The script will display the original output, and the select statement is not being executed. I will appreciate any input to what is wrong with this script, since it should work according to my knowledge.

5
  • You need a semicolon at the end of your query. (Or a slash on the next line). See the documentation. Your group-by is wrong too though, so are you getting an ORA-00936 error? Commented Jan 9, 2017 at 19:08
  • The group by was not needed so I edited that out and added in a semi-colon at the end. I am not getting a error instead It is displaying the original output, which would be displayed without the select statement. Commented Jan 9, 2017 at 19:49
  • Not sure what you mean about original output. If you're running this as a script (F5) clear the script output window, run it again, and copy what is in the output window as text - and add it to the question. Maybe you just mean you're seeing the command echoed, which is normal; this may be usefui. But you should see the query results too (even if it just says 'no data found'). Commented Jan 9, 2017 at 19:52
  • This is not related to tag batch-file (read the tag info)! Commented Jan 10, 2017 at 12:38
  • You are missing a ; at the end of your SQL statement. Commented Jan 10, 2017 at 12:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.