How to output query results directly to a file
Hello,
I'm new to this and i need to know how to output the results of a query directly to a file instead of it displaying on the screen and then outputting to a file in SQL Developer Version 2.1.0.63.
Thanks in advance for any help!
Edited by: user13036938 on Jun 16, 2010 7:24 AM
Edited by: user13036938 on Jun 16, 2010 7:25 AM
for a really basic spool:
SPOOL [FILEPATH];
SELECT [SOMETHING] FROM [SOMETABLE] WHERE [SOMECONDITION];
SPOOL OFF;see also:
http://www.oracle.com/technology/products/database/sql_developer/files/sql_worksheet_commands.html
for a list of other useful SQLPlus commands supported by SQL Developer
Edited by: Irian on 16-giu-2010 17.08
Similar Messages
-
Output query result to a text file in ORACLE
I Need a procedure for generating output query into text file in Oracle.
for Example,
A table called Tab1
the columns are c1,c2,c3,c4,c5.
I want to store the data in text file in...
First row as a column name & then, appear the records in second row onwards...
c1|c2|c3|c4|c5.
Please kindly provide the solution for this ASAP.In case you are using Oracle 9i or higher you should better create a DIRECTORY rather then setting utl_file_dir,e.g.
SQL> CREATE DIRECTORY log_dir AS '/appl/gl/log';
SQL> GRANT READ ON DIRECTORY log_dir TO DBA; http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#ARPLS069 -
How to output a query results into a text file
How to output a query results into a text file instead of outputing it to the screen..
is there a way for us to write a SQL query which specifies to output the query results to a text file.
Pls let me know how to do it
Thanking u in advance
regards
MuralyMuraly,
If you are using SQL*Plus 8.1.6 or later, you can also spool output to a file in HTML format, eg
SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON
SPOOL c:\temp\report.html
SELECT DEPARTMENT_NAME, CITY
FROM EMP_DETAILS_VIEW
WHERE SALARY>12000;
SPOOL OFF
SET MARKUP HTML ENTMAP OFF
In iSQL*Plus 9.0.1 (the browser-based interface to SQL*Plus) onwards, you can also send the HTML output to a new web browser window, or an html file -- much easier than the command line method.
Alison -
How to get query result in comma dilimited text or excel file?
Does anybody know how to get query results in comma delimited
text file or excel file, I tried spool abc.txt, but the result
showed some ------ lines
ThanksTry doing this in your sql scripts
set heading off
set pagesize 0
set linesize 4000
set feedback off
set verify off
set trimespace on
set colsep ","
spool output.txt
select * from dual (or whatever you are querying
spool off
There may be a couple other set statement that you could add but
this should get you started in the right direction -
Output query result in XML format
folks:
could anybody provide more information
about how to generate query result in
xml format? looks like DBXML is for demo only
and i have heard that PLSQL XML parser is the way to go; so far i have not found
a sample yet on how to actually
do the XML generation; if you know more
about it, please let me know; thanks in
advance.
BillHere are some sample apps that might interest you:
[list]
[*][url [URL=http://technet.oracle.com/tech/xml/xsql_servlet/index2.htm?Code&files/ffhome.html]The]http://technet.oracle.com/tech/xml/xsql_servlet/index2.htm?Code&files/ffhome.html]The XML Flight Finder
[*][url [URL=http://technet.oracle.com/sample_code/tech/xml/xmlb2b/doc/xb2bhome.html]B2B]http://technet.oracle.com/sample_code/tech/xml/xmlb2b/doc/xb2bhome.html]B2B with XML
[list]
Enjoy,
-rh -
How to display query result in seperated page.
How to display query result in seperated page, if the results are very big (more than 5000 records) and there are so many concurrent users (about 500 - 1000 users).
Are there any solutions or frameworks?
Plese help me .........
thanks,
--bhasinHi,
How to display query result in seperated page?I think RowSet will be the better technology to use in this
situation.For more information on this please visit http://developer.java.sun.com/developer/Books/JDBCTutorial/chapter5.html
which explains in detail about RowSets.
Hope this helps.
Good Luck.
Gayam.Srinivasa Reddy
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support/ -
How to save query result in excel file
Hi all,
How to save query result in excel file from sql*plus tool.
thank youDo you really need an Excel file (binary) or a simple CSV?
If you just need a CSV then search for DUMP_CSV at http://asktom.oracle.com or at this forum
If you need formatting and/or multiple worksheets then you can use free tools like
https://xml-spreadsheet.samplecode.oracle.com/ or https://exceldocumenttype.samplecode.oracle.com/
Regards
Marcus -
How to return query result in procedure
Hi all,
Can anyone tell me how to return query result in pl/slq procedure using out .
thank you
regards
P PrakashProcedure for sys_refcursor:
create or replace procedure ptest(c out sys_refcursor) is
begin
open c for select * from dual;
end;Procedure for collections(although sys.ODCIVarchar2List is varray, same example you can use with "table of")
create or replace procedure ptest2(c out sys.odcivarchar2list) is
begin
select dummy
bulk collect into c
from dual;
end;Example:
declare
c sys_refcursor;
v varchar2(100);
vt sys.odcivarchar2list;
begin
ptest(c);
fetch c into v;
dbms_output.put_line('1.Cursor data: '||v);
ptest2(vt);
dbms_output.put_line('2.Collection data: '||vt(1));
end;Regards,
Sayan M. -
Display the query result in an Excel file??
hi there..
am writing one script file that queries my DB and display the query result in an Excel file??
i.e: if my query is :
select col1, col2
from table;
and i want the results to dispalys in 2 col. in an Excel spreadsheet..
Appreaciating ur cooperation..
Mouradset colsep to a delimiter that is not normally part of your data like |
also setup the environment with these other setup commands
Set Echo Off;
Set Concat Off;
Set Pagesize 9999;
Set Feedback Off;
Set Verify Off;
Set Term Off;
Set Space 0;
Set Colsep '|'
Set Underline Off;
If you wanted to use a comma delimiter the setup would be same but the set colsep='","'
with the addition of concatenating a " on the first col and last col of the query
eg.
-- if first col and last_col are character types then
SELECT '"'||col1,....,last_col||'"'
FROM table;
Otherwise if either is a number they would have to be converted with a TO_CHAR -
How can I export query results from sqlplus on the command line? Are there ways to specify the format such as CSV, TAB, XML, etc?
I've seen one approach that involves creating a shell script and piping the output to a file:
#!/bin/sh
sqlplus user/password <<__EOF__
set heading off;
set newpage none;
select f1, ',', f2, ',', f3 from some_table;
__EOF__
Then pipe the output to a file. Is there a simpler solution to this?http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:235814350980
-
SSMS Addin - How To Access Query Results Grid
Hi,
I want to access Query Result Grid(Results) in SSMS addin but I did'nt found anything.
How can I access Query Result Grid, Rows, Columns and Cells when I executed a script?
Thanks.SQL Server Management Studio currently supports query execution results to be displayed in three different ways: Results to Grid,
Results to Text and Results to File.
By default SQL Server Management Studio is configured to display query results in
Grid format. If you want to change the default to some other option follow these steps.
1. In SQL Server Management Studio, under Tools menu, click
Options as shown in the snippet below.
2. In the Options dialog box, expand Query Results, expand
SQL Server and then select General as shown in the snippet below. In the right side panel choose one of the three options shown below in the
Default Destination for results drop down list and click
OK to save the changes as shown in the snippet below. The changes will go into effect once you open a New Query window.
Query Result Options for Results to Text
In this format you have the option to display the results in a different tab as well as setting different output options.
In the Options dialog box, expand Query Results, expand
SQL Server and then select Results to Text tab as shown in the snippet below. In the right side panel first select the checkbox for
Display results in a separate tab and then select the checkbox for
Switch to results tab after the query executes and then click
OK. If you would like to also display the column name in the result set then choose the option Include column headers in the result set
as shown in the snippet below.
The options you can use in the Text format are:
Output format: - In the above snippet you could see that by default the output is displayed as columns aligned. Some of the other options that are available are Comma Delimited,
Tab Delimited, Space Delimited and Custom Delimited. If you choose the Custom Delimited option in the Output format drop down list then you need to specify a character of your choice for the delimiter in the
Custom delimiter text box.
Include column headers when copying or saving the results: - If this option is selected, then whenever the results are copied to clipboard or it is saved to a file the column headers are also copied along with the results.
Include the query in the result set: - The text of the query is displayed as part of query output under the messages tab.
Scroll as results are received: - If this option is selected, then the display focuses on the most recently returned records at the end of the results set.
Right align numeric values: - If this option is selected, then numeric values will be aligned to the right of the column.
Discard results after query executes: - If this option is selected, then the query results are not displayed in the reviewing pane.
Display results in a separate tab: - If this option is selected, then the result set after query execution will be displayed in a new tab instead of at the bottom of the query window.
Switch to results tab after the query executes: - If this option is selected, then after the query execution the screen focus will be set to the results tab.
Maximum number of characters displayed in each column: - This sets the maximum characters to display for any one column. So if you have a column that is 500 characters this will only show the first 256 if you keep the default setting.
Ref link :http://www.mssqltips.com/sqlservertip/2346/different-options-for-query-results-in-sql-server-management-studio/
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/ -
How to get Query Results based on Analysis Authorization Ranges????
Hi Experts,
I have gone through the lot of SDN Links, however not able to find the answer to my question.
I have an Authorization Issue, NO Authorization
Error : EYE 007 ( Insufficient Authorizations )
<b>Here is the issue:</b>
Need to see the complete query result when I gave the range in Analysis Authorization for Controlling Area 001-005. Controlling Area is auth relevant and right now a variable is inserted in the query for it. If I select Controlling Area 001, the result for Controlling Area 001 is displayed in query. If 002 then also displayed. If I do not enter anything, then I get the <b>Eye 007 error message</b>.
I am not sure how do I display/authorize the entire result in the query for all the Controlling Areas, I have authorized user to see??
<b>Its really urgent, please help..!</b>
Here are the logs:
Authorization Check Log
Date and Execution Time (Local Server)
Execution Date: 06.09.2007
Execution Time: 14:48:41
Executed Query: 0CCA_C11/GBCCA_MP01_Q0002_AP
Executed by User ZBI_TEST_001
Executed with Analysis Authorizations of Another User ZBI_TEST_001
InfoProvider Check
Building the Buffer...
...Buffer Built
Are there authorizations for accessing InfoProvider 0CCA_C11 with activity 03?
Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03
InfoProvider Check
Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03
Relevant Characteristics for Detailed Authorization Check
(Characteristics with Full Authorization Are Not Listed!)
List of Effective Authorization-Relevant Characteristics for InfoProvider 0CCA_C11:
0CO_AREA
0TCAACTVT
Relevant Characteristics for Detailed Authorization Check
(Characteristics with Full Authorization Are Not Listed!)
List of Effective Authorization-Relevant Characteristics for InfoProvider :
List Is Empty:
There Are No Characteristics That Have to Be Checked in Detail
Authorization Check
Detail Check for InfoProvider 0CCA_C11
Preprocessing:
Selection Checked for Consistency, Preprocessed and Supplemented As Needed
Subselection (Technical SUBNR) 1
Check Node Definitions and Value Authorizations...
Node- and Value Authorizations Are OK
End of Preprocessing
Filling the Buffer...
...Buffer Filled
Main Check:
Subselection (Technical SUBNR) 1
Supplementation of Selection for Aggregated Characteristics
No Check for Aggregation Authorization Required
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
CO_AREA = '0003'
AND TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Authorized
Subselection (SUBNR) Is Authorized
Authorization Check Complete
Authorization Check
Detail Check for InfoProvider 0CCA_C11
Preprocessing:
Selection Checked for Consistency, Preprocessed and Supplemented As Needed
Subselection (Technical SUBNR) 1
Check Node Definitions and Value Authorizations...
Node- and Value Authorizations Are OK
End of Preprocessing
Filling the Buffer...
...Buffer Filled
Main Check:
Subselection (Technical SUBNR) 1
Supplementation of Selection for Aggregated Characteristics
No Check for Aggregation Authorization Required
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Partially or Fully Authorized (Intersection) Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
( CO_AREA < '0001'
OR CO_AREA > '0005' )
AND TCAACTVT = '03'
Value selection partially authorized. Check of remainder at end
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
( CO_AREA < '0001'
OR CO_AREA > '0005' )
AND TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Not Authorized
All Authorizations Tested
Message EYE007: You do not have sufficient authorization
No Sufficient Authorization for This Subselection (SUBNR)
Following CHANMIDs Are Affected:
184 ( 0CO_AREA )
Authorization Check CompleteHi,
Have you defined the vaule for 0CO_AREA as BT 001-005 in you Authorization for 0CO_AREA.Also how have you defined your Authorization Variable on the query? Have you define as select options or interval? I thing you need to define it as interval or select options.
Hope it helps,
Cheers,
Balaji -
How to save query result on the file server as excel file?
Hi everyone,
I need to save the the query result on the file server as excel file.
Do you have any idees how can I do it?
Regards
Erwini dont think you can save as excel file but you can save it as CSV use APD or RSCRM BAPI for this
-
How to display query result like this
I got a query...gives list of names.
i want to display
11. Peter
12. Jessica
32. Leo
15. Jamie
36. Edward
how i get static number infront of my query result.
static number is not in order.Amm85 wrote:
I got a query...gives list of names.
i want to display
11. Peter
12. Jessica
32. Leo
15. Jamie
36. Edward
how i get static number infront of my query result.
static number is not in order.
You could use the function queryAddColumn to add the numbers as a separate column to the query.
Let us suppose the name of the query is "myQuery". Then you could proceed as follows
<!---Define your "static" list of numbers --->
<cfset staticList = "11,12,32,15,36,13,23,14,33,16,44,31,17,34,18">
<!--- Create an array from the static list. --->
<cfset staticNrArray = ArrayNew(1)>
<cfset staticNrArray = listToArray(staticList)>
<!--- Add the array as a column to the query. --->
<cfset nColumnNumber = QueryAddColumn(myQuery, "staticNr", "integer", staticNrArray)>
<!--- Verify whether it works as expected--->
<cfdump var="#myQuery#">
The list I have given here has 15 numbers. This will naturally instruct ColdFusion to add a new column named staticNr, having 15 rows. You might like to know that the queryAddColumn function enables padding.
Here is how it works. Suppose that the query originally had only 8 rows before you added the column(of 15 rows). Then, in the new query, ColdFusion would pad the last 7 rows of the other columns with null values. If the original query had 20 rows instead, then Coldfusion would pad the last 5 rows corresponding to the staticNr-column with null values. -
How to send query results from BW to R/3 abap program
Hi,
I have to bring in query results from BW into a abap program written in R/3...can anyone help me on how to accomplish this(BW to R/3) please...i was thinking if reporting agent or broadcasting should help but i dont know how to get started.
Please help.
Thank you so much.Hi Vijay,
As i know, you can send data from BW to Flat file or into any table in BW or to BW application server only.
You need 3rd party to send data to different server.
You can use
1. Tcode : RSCRM_BAPI to download query values/results into a table or into a flat file. OR
2. You can use Infospokes to generate files from ODS/CUBE/master data objects to flat files(local/application server) or to a table.
3. Using information broadcasting we can send mail(dont know much options), but i dont think generation of file possible.
You need to trnasfer generated file from BW to R/3 and load into R/3 using BDC or LSMW(if data is low).
I think, you can also use RFC function modules to read data from BW to R/3, plz check with ABAPer.
Hope it Helps
Srini
Maybe you are looking for
-
Standard Report with Condition Type and Condition Records
Hello to all, Is there any standard report available in which Condition Type and Condition values are displayed in either column or row format? The selection criteria can be either Quotation, Contract, Sales Order, Delivery, Invoice or Billing. Thank
-
What are the Interfaces in ABAP
Hi all, What are the Interfaces in ABAP ? send me any material on the same
-
Table for Analysis authorization along with values for authorization fields
Hi, I am looking for table that contains the Analysis Authorization name along with values for all the authorization fields within this Analysis Authorization. Individually i can go to PFCG or Rsecadmin but since i need all the Analysis auth objects,
-
Hello to the Board I'd be most grateful is someone could please help me get my wireless connection up and running on my HP dv2000. I have installed network manager which connects fine when using wired connection. When I click the network manager ico
-
ITunes Search not finding requested music
Today I was trying to search an artist in iTunes and it doesn't show up at all. I have done all my updates on my iPad and Mac Pro laptop. The particular band I am searching is Mighty Joe Plum and I cannot find it any where in iTunes. Any help would b