Spool command in SQL Developer 3.1
Hi,
I am using sqldeveloper-3.1.05.97 .
There are few scripts that I need to run on a EBS sandbox to generate txt files for a analysis tool input .
The script is meant to be run with SQL * Plus but I am getiing a TNS listener error due to which I want to use SQL Developer.
The Spool command is able to create file in local directory but the oputput is not the query result but the query itself. Please help if anything is wrong in the syntax below:
ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY';
SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET COLSEP |
SET MARKUP HTML OFF
SET LINESIZE 600
SPOOL FND_USER.txt
SELECT USER_ID, USER_NAME, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, START_DATE, END_DATE, DESCRIPTION, LAST_LOGON_DATE, PASSWORD_DATE, PASSWORD_ACCESSES_LEFT, PASSWORD_LIFESPAN_ACCESSES, PASSWORD_LIFESPAN_DAYS, EMPLOYEE_ID, CUSTOMER_ID, SUPPLIER_ID
FROM APPS.FND_USER;
SPOOL OFF
Hi Partha,
It seems the line "SET PAGESIZE 0" is suppressing all output in SQL Developer, and not just "all headings, page breaks, titles, the initial blank line, and other formatting information" as documented for SQL*Plus. Keep in mind that SQL Developer does not yet provide full support for all SQL*Plus formatting commands. For example, without SET PAGESIZE 0, the script output tab shows these messages:
line 2: SQLPLUS Command Skipped: set NEWPAGE 0
line 3: SQLPLUS Command Skipped: set SPACE 0
line 8: SQLPLUS Command Skipped: set MARKUP HTML OFF
I will log a bug for this.
Regards,
Gary
SQL Developer Team
Similar Messages
-
Using the equivalent of a BREAK ON command in SQL Developer SQL window
Folks.
In SQL*PLUS "BREAK ON Col1 ON Col2;", I can generate a report similar to the following:
Col1Value1 Col2Value1 Col3Value1
Col3Value2
Col3Value3
Col2Value2 Col3Value1
Col3Value2
Col3Value3
Col1Value2 Col2Value1 Col3Value1
Col3Value2
Col3Value3
Col2Value2 Col3Value1
Col3Value2
Col3Value3
etc.
I want to be able to do the same thing in my SQL Developer SQL window so that I can export the results to a spreadsheet file.
Does anyone know if this is possible?
I've tried using the SQL*PLUS BREAK command in my SQL Developer window but it appears to be ignored. My resultset looks something like
Col1Value1 Col2Value1 Col3Value1
Col1Value1 Col2Value1 Col3Value2
Col1Value1 Col2Value1 Col3Value3
Col1Value1 Col2Value2 Col3Value1
Col1Value1 Col2Value2 Col3Value2
Col1Value1 Col2Value2 Col3Value3
Col1Value2 Col2Value1 Col3Value1
Col1Value2 Col2Value1 Col3Value2
Col1Value2 Col2Value1 Col3Value3
Col1Value2 Col2Value2 Col3Value1
Col1Value2 Col2Value2 Col3Value2
Col1Value2 Col2Value2 Col3Value3
.OK thanks.
I did get around this by using SQL*PLUS to generate an output file with a separation character between the columns and spooling the SQL*PLUS output to a text file.
I then open the text file with Excel and specify the same character as a column separator. Seems to load properly into Excel. -
SQLPLUS commands in SQL Developer
We are using 11g with Sql Developer. We have some script such as healthcheck etc provided by oracle support, which has SQLPLUS commands in it.
We are not able to run those in SQL Developer. We are getting errors.
Are there any way, we could invoke SQLPLUS shell within SQL Developer?
Thanks in helping.Hi qwe16235
SQLPLUS command failed - not enough arguments
line 36: SQLPLUS Command Skipped: set lines 300
line 37: SQLPLUS Command Skipped: set pages 999
These are formatting commands we do not do yet.
The other command seems like an error in the middle of a PL/SQL block which we should have covered, just the start of it is not enough to know what the error is.
An example of bad pl/sql error reporting:
input:
show parameter error <-------------- Dummy command so the plsql block does not begin at 1
begin <----------------starting at line 3
broken plsql; <------------- bad plsql at line (start)3+(from ora error)2 = 5 (should be 4 - must be one off)
end;
output:
NAME TYPE VALUE
sec_protocol_error_further_action string CONTINUE
sec_protocol_error_trace_action string TRACE
Error starting at line 3 in command:
begin
broken plsql;
end;
Error report:
ORA-06550: line 2, column 8:
PLS-00103: Encountered the symbol "PLSQL" when expecting one of the following:
:= . ( @ % ;
The symbol ":=" was substituted for "PLSQL" to continue.
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
-Turloch
SQLDeveloper team -
AddVMOption command in SQL developer configuration files
Greetings developers,
I'm a newbie in database and Java world trying to understand what the Oracle sql developer configuration files do by executing AddVMOption commands. I'm guessing this command is something to do with Jdeveloper. Please enlighten me what the command does.
Regards,
ValerieValerie,
Nothing to do with JDeveloper at all.
SQL Developer (and JDeveloper incidentally) are created using Java - the AddVMOption's that you are referring to are arguments passed to the Java Virtual Machine that is used to run SQL Developer. For example, you can use AddVMOption to give more memory to SQL Developer.
Hope this clarifies,
John -
SPOOL Command in PL/SQL developer
Hi,
Iam executing below command in PL/SQL Developer7.0
SPOOL 'U:/MyFiles/test.txt';
select sysdate from dual;
spool off;
Iam getting ORA-00900: Invalid SQL Statement. Please let me know what is the exact syntax for SPOOL in PL/SQL Developer.Hi;
Please see below note which is mention to using of spool wiht example:
http://www.scribd.com/doc/4542950/How-to-Spool-in-Oracle
http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12043.htm
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1317802337341
spool sql*plus's output
Regard
Helios -
Spool from SQL Developer 2.1
Hi all, i have various scripts that use spool to write results to text files. When i run these scripts i get errors for commands like "spool" and "prompt". It's possible to run this scripts and generate spools from my SQL Developer 2.1? Thanks in advance.
We've found that scripting in SQL*PLUS is easier for us. Of course, we've been using it for years and years ...
Evita pointed out that SQL*Developer's scriptiing capabilities are more limited than SQL*PLUS'. You can simulate spooling by executing the query(queries) as a script in the SQL worksheet and then saving the output pane.
Athough the prompt command probably won't work in SQL*DEVELOPER you can still use substitution variables, instead getting a default window with the name of your substitution variable allowing data entry. -
SQL Developer, SQL Server and the ampersand
Hello,
I am connected to a SQL Server database (2008) and am having difficulty getting a query to run properly in SQL Developer (3.1.07).
Simplified Example
select table_field
from table
where table_field <> 'This & That';
Expected results
table_field
Other stuff
Other stuff
Other stuff
Actual results
table_field
Other stuff
This & That
This & That
I cannot seem to get SQL Developer to recognize the & as a literal ampersand. I've tried escaping it numerous ways, but it always thinks it is a variable.
The query works exactly as expected in MS SQL Management Studio and Toad. Of course, I can just run it in one of those but I'd like to try to get this to work in SQL Developer. Suggestions?
Please let me know if I can provide further information. Thanks.Hi,
SQL Developers worksheet is designed for Oracle, but we allow you to run statements against SQL Server and other non Oracle databases.
This can lead to some quirks, like the one you experienced.
Oracles SQL*Plus uses ampersand to define substitution variables.
Oracle SQL Developer has implemented the same concept.
Unfortunately this does not make sense when running something against a non Oracle database.
As a workaround, you can run the following SQL*Plus command in SQL Developer, before your SQL Server query.
SET DEFINE OFF;
select 'hello & goodbye';
The following maybe of some help as well.
http://dermotoneill.blogspot.com/2010/11/workheet-hints.html
http://dermotoneill.blogspot.com/2010/12/sql-server-and-sybase-browsing.html
Regards,
Dermot.
SQL Developer Team. -
Executing a procedure - Works on Isql Plus but not SQL Developer??
Hi folks.
I am playing around with some design and structure stuff, mostly just passing values around procedures. I have one procedure (procedure1) which takes a sysdate and then passes it to another procedure (procedure2) which takes the parameter and does a dbms_output.put_line.
Both objects are valid, and compile correctly. I use
exec procedure1;
in iSql Plus and it works perfectly. It prints the dates out and all.
However if I use the exact same command in SQL Developer it gives me error "ORA-00900: invalid SQL statement"
I don't understand why this happens?? The code executes perfectly in one but not the other...Remember that SQL*Plus commands don't work in the worksheet. So, this would fail
exec my_procIn the worksheet you have to declare an anonymous block....
begin
my_proc;
end;
/If you right-click on the procedure in the Navigator and select Run then SQL*Dev will throw up a harness for you. Very handy if you want to get DBMS_OUTPUT, set variables, etc.
Cheers, APC
http://radiofreetooting.blogspot.com -
SQL Developer 1.5.5 SPOOL command
Hello,
I have a question to SQLplus command SPOOL
Testsetting:
SQL Developer 1.5.5_5969
Oracle 10g Release 10.2.0.3.0
The output from SPOOL in the log file is only a subset from what I get in the Script Output Panel.
I don't see the SQL Error Message and the number of rows selected or updated. See the scenario below.
Does anybody know, how I can get the whole output to the log file?
Testcase: Start ScriptRunner (F5)
=================================
SET ECHO ON
SPOOL C:\tmp\test.log
SET SERVEROUTPUT ON
SET FEEDBACK ON
WHENEVER SQLERROR EXIT ROLLBACK
select lcode from test_table;
update test_table set lcode = NULL where 1=2;
update test_table set lcode == NULL where 1=2;
SET SPOOL OFF
EXIT
A.) Output from ScriptRunner (F5) at Script Output Panel:
=========================================================
SET ECHO ON
SPOOL C:\tmp\test.log
SET SERVEROUTPUT ON
SET FEEDBACK ON
WHENEVER SQLERROR EXIT ROLLBACK
select lcode from test_table
LCODE
GL
GL
SK
3 rows selected
update test_table set lcode = NULL where 1=2
0 rows updated
update test_table set lcode == NULL where 1=2
Error starting at line 3 in command:
update test_table set lcode == NULL where 1=2
Error at Command Line:3 Column:28
Error report:
SQL Error: ORA-00936: Ausdruck fehlt
00936. 00000 - "missing expression"
*Cause:
*Action:
Rollback
B.) Output from SPOOL in log file:
==================================
SET SERVEROUTPUT ON
SET FEEDBACK ON
WHENEVER SQLERROR EXIT ROLLBACK
select lcode from test_table
LCODE
GL
GL
SK
update test_table set lcode = NULL where 1=2
update test_table set lcode == NULL where 1=2
Thanks
MarkusThe connections are in
C:\Documents and Settings\Application Data\SQL Developer/system1.5.0.53.38/o.jdeveloper.db.connection.11.1.1.0.22.49.35/connections.xml
If you want to back them up, you can just right-click export from the tree.
-kris -
SPOOLing in sql developer does not take into consideration SET ECHO OFF
I'm running SQL Developer 3.1.07.42 on Windows 7 64 bit with java 1.7
I have the following very simple script just to show the problem:
SET ECHO OFF;
SET FEEDBACK OFF;
SET SERVEROUTPUT ON;
SET VERIFY OFF;
SET PAGES 0;
SET HEAD OFF;
SPOOL c:\test.sql
SELECT 1, 2, 3 FROM DUAL;
SPOOL OFF;
/if I run it in TOAD 10.6.0.42 it creates the file with
1 2 3This is as expected (by me)
if I run the exact same query in SQL Developer 3.1.07.42 , it creates the file with:
< SELECT 1, 2, 3 FROM DUAL
1 2 3(the < above is actually ">" but the CODE formatting software is screwing ">")
but I don't want the ECHOed command to be spooled. For the life of me, I cannot find a way to disable the ECHO from spooling in sql developer.
Tried the same in 3.0.4 and 2.1.1 with the same (bad) result (plus some warning on some of the unsupported SET commands).
Am I missing something obvious? Cause like this, the spool command cannot be used in sql developer to generate a CSV file for example, because of the echoed command. And windows doesn't come with SED by default so that is out. (plus that my original script is integrated into a much larger and complex set of scripts and the main script using them is executed from SQL Developer as a company policy (so that everybody uses the same tool and the code runs the same for everybody))
Any ideas/suggestions are welcome
Thanks.Hi Gary, you seem to have some extensive knowledge. I'd like to follow-up on this thread and try to understand why SQL Developer won't hide the code even though I'm already running the code as a Worksheet (I assume you mean Run Script F5 button in SQL Developer).
I generally develop in SQL Developer that does a lot of dbms_output to echo data using a Spool command. When I'm in SQL Developer I can't get the code NOT to spool, it typically is echoed directly in the spool file at the top followed by the dbms_output data. If I save the sql file and run in in sqlplus it only outputs the data (good). If I use @C:\xyz_script.sql and hit F5 in SQL Developer it only outputs the data (per your previous answer) -- good.
So why can't I hit F5 in SQL Developer in the script file and have it only output the data? It just doesn't work no matter how many "SETs" you turn-off.
Looks like Echo, Term, Feed are supported in SQL Developer, maybe supported means something other than work.
http://www.oracle.com/technetwork/developer-tools/sql-developer/sql-worksheet-commands-097146.html -
Does SQL Developer allow file spooling?
Hello, I'm asking whether SQL Developer application allows me to use the spool command to save all the queries I entered during a session into a text file, just like we used to do in sqlplusw.exe, so that they can be used for reference? or do we have to save each single query we enter?
You can also select All in the output windows. Then you can right click to export the data from the output in several format.
Regards -
How to execute command(program) from external file in Oracle SQL developer
Hi,
Does anyone know, Oracle SQL developer version 1.0.0.14.67 got any function that can execute command from an external file?
Example, i have 100 insert SQL inside a text file,
and i want to use Oracle SQL developer to execute it. How do i read from my text file? Thanks a lots.If you're new to Oracle, do yourself and us a favour: read some tutorials and manuals. What sqldev's worth, better download the latest version (1.1.2), lots of fixes and enhancements...
Now for the big popper: to run an external file: @file
Best of luck,
K. -
How to execute sqlplus command like 'show parameters ' in SQL Developer?
Hi guys,
here's another problem i just ran into, is it possible to run sqlplus cmd like 'show parameters ' in this tool? anyone can help? thanks in advance.thanks.
and i just looked into the user guide and found that several sqlplus commands were unsupported in SQL Developer, including 'show '. i don't know why but anyway i get the answer, i can go back to use sqlplus itself. -
Hi, omniscient all!
I have a code sample where I try to request some URL from an inactive server:
declare
l_text varchar2(32000);
begin
l_text := utl_http.request('http://inactive.url:7777');
exception
when others then
declare
l_errcode number := utl_http.get_detailed_sqlcode;
begin
dbms_output.put_line(l_errcode);
dbms_output.put_line(sqlerrm(l_errcode));
end;
end;
/When I run it in Oracle SQL Developer it shows:
anonymous block completed
-12541
ORA-12541: TNS:no listenerWhen I run it in the APEX 4.0 SQL Commands window it shows:
-29263
ORA-29263: HTTP protocol error
Statement processed.The question is: why?
In real world, I need to make a HTTP POST request (no problem) and catch some exceptions. But instead of the usual ORA-12541 error APEX throws an ORA-29261 one.Any thoughts?
-
Is Sql plus command avaliable in sql developer
SQL developer is able to do most of thing can be done with sql plus with GUI , cool.
However, seems sql command, such as show parameter, start database have to be done in sql plus.
is this true?
most of time in my development, I just open sql developer now. but seems in this statuation, i have to use sql plus.jz2 wrote:
SQL developer is able to do most of thing can be done with sql plus with GUI , cool.
However, seems sql command, such as show parameter, start database have to be done in sql plus.
is this true?
most of time in my development, I just open sql developer now. but seems in this statuation, i have to use sql plus.As far as I know you still have to start the database from SQL*PLUS. If your schema has privileges you can get parameter values in SQL*Developer by querying V$PARAMETER (SET_CATALOG_ROLE privilege).
The two tools are not the same. Much of what you can do with SQL*PLUS you can do with SQL*Developer but I feel that SQL*PLUS still has better scripting abilities along with its bind variable storate. On the other hand the GUI interface of SQL*Developer Is fairly easy to use. The danger is editing procedures/functions/packages in the database forgetting to back them up from SQL*Developer first; SQL*PLUS forces me to use scripts.
Depending on what I am doing I use either SQL*PLUS or SQL*Developer (which I like better for queries with long select lists).
I'm having trouble getting DBMS_OUTPUT.PUT_LINE to work the way I expect in SQL*Developer; sometimes the output just does not appear without repeated executions of the generating program.
Maybe you are looking for
-
All of a sudden, the CDs I burn from Itunes do not play back. I thought it was just the CDs purchased from Itunes but it is all music from my library. I export the playlist & it burns but when I go to play it back, nothing. I have tried several stere
-
Printer cannot print after disabling SNMP
I need to disable SNMP for network security reasons. After doing so from the web configuration page of my P2035N printer, network users cannot print to this printer. It shows as 'offline', even on the web page. We have tried restarting the printer
-
Basic Quick Selection Tool Question
Is this just a newer way to do the same thing the other selections tools have been doing for years OR is there a benefit to this tool over the other selection tools?
-
Hypothetical situation - net 10.10.10.0/24 routes to PIX 'outside' int webserver on the 'inside' at 192.168.1.1 ACLs asside for the moment, is it possible to have any www traffic hitting the 'outside' interface forwarded towards 192.168.1.1? Without
-
Using Java extensions with EJBs
I'm having difficulty getting something working, and would appreciate some help. I have an EJB packaged into a JAR with its deployment descriptors. This EJB uses classes that are held in a 3rd party JAR file and I've added that JAR file to the EJB JA