Send query results to a file using Toad
Hello,
I have a select statement that generates xml rows, and I need to send the results to a file. I am using TOAD VI. The rows generate ok but when I right click and choose the save as option all I end up with is an empty file.
Is there a way I can just send the results directly to a file instead of to the screen?
Thanks.
user11293056 wrote:
Would you happen to know of a website that shows how to create an xml file using SQL*Plus?
Thanks.A search of asktom.oracle.com for the following phrase found a couple interesting pages:
table(xmlsequence(cursor
On such page is this one:
http://asktom.oracle.com/pls/asktom/f?p=100:11:1074646661177911::::P11_QUESTION_ID:4061080732051
As an experiment, you might take a look at the output of the following (replace SELECT * FROM MY_TABLE_HERE with your SQL statement):
SELECT
FROM
TABLE(XMLSEQUENCE(CURSOR(
SELECT
FROM
MY_TABLE_HERE
)));Charles Hooper
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc.
Similar Messages
-
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
-
Error occurred while sending query result: 'java.lang.NullPointerException'
I am doing end to end scenario from SQL server to File
JDBC --XI -- File
I am getting the following Error while monitoring the sender CC in RWB
"Error occurred while sending query result: 'java.lang.NullPointerException'
Please Help !!Hi,
To see the Adapter Error log, try:
http://<XiServerHostName>:<J2EE-Port>/MessagingSystem
Try viewing the Audit Log for each message (Newspaper Icon)
Regards,
Amitabha -
Export query result to txt file
Hello,
I'm trying to export a query result to txt file but I facing some problems.
I'm using the comand below:
set echo off newpage 0 space 0 pagesize 0 feed off head off trimspool on
set colsep ,
spool C:\estados.txt
select id_estado,cod_estado,nme_estado from tb_estado;
spool off
First problem: My select statement is being writen on my estados.txt
Second problem: The results are being writen with a lot of blank spaces in start of line, for example, instead of write "1,AC,Acre" the line is write as " 1,AC,Acre".
Third problem: The "spool off" statement is being written on my estados.txt
How could I solve it?
Thanks1. Works here - what version of SQL*PLUS are you using?
2. If you want to prevent spaces, you have to write your SELECT like this:
select id_estado || ',' || cod_estado || ',' || nme_estado from tb_estado;Note: not tested.
3. See 1.
C. -
Error while sending query result
Hi all,
I am working on a JDBC-XI-IDoc scenario. In my sending JDBC adapter configuration, i have given the Query SQL statement as <b>SELECT * FROM SAP_PROMOTION</b> and Update SQL statement as: <b><TEST></b>
But when i go to adapter monitor, i am seeing an error as follws:
<b>Error: Sending query result failed with com.sap.aii.af.service.cpa.impl.exception.CPALookupException: Couldn't retrieve binding for the given channelId: Binding:CID=875514bc047b3557a5b53dfb5ef4babe; - retry
last retry interval started 10:54:09 2006-05-25
length 60,000 secs</b>
Can anybody help me how to solve this problem.
Regards,
DivijaDivija,
Am not sure if this is the exact cause for your problem, but would anyways suggest that you take a look at it,
<i>classes12.zip is not compatible with JDK 1.4.</i>
From the note : <b>831162</b>
Oracle JDBC Driver (classes12.zip / classes12.jar) Deadlocks
<b>Q: I have deployed the Oracle classes12.zip / classes12.jar JDBC driver as per the instructions in the XI Configuration Guide.
Unfortunately, I frequently notice hanging database connections. A thread dump taken according to the instructions in note 710154 shows one or more blocking JDBC Sender/Reciver threads and optionally that the JVM has detected a deadlock.
A: The Oracle classes12.zip / classes12.jar driver is compatible with Java 1.2 and Java 1.3 only, but not with Java 1.4. Please upgrade to a current driver (ojdbc14.jar), which does support the Java 1.4 JVM you are using.
Please make sure that you remove classes12.zip / classes12.jar from aii_af_jmsproviderlib.sda prior to adding the new driver as per the instructions in the answer to question #1 above as you will get a class name collision otherwise (all JARs from aii_af_jmsproviderlib.sda are loaded into the same class loader and the driver class name of both driver versions is the same).
Before deploying the updated driver, ensure that the new version is still compatible with your Oracle database server release. For details, please refer to the release notes provided by Oracle.</b>
Regards,
Bhavesh -
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 -
Write big query results into a file ? ? ?
Hi all,
The problem is: I want to write a simple query results into a file. I have no idea how to do that. Only thing I know is utl_ functions. Please advise GURUS how can I use them for big queries. Any example will be really appreciable.
Thank you in advance.
Message was edited by:
v838hi,
i´ld do it like that:
filedir varchar2(30):= '/usr/frajo/';
filename varchar2(30):= 'file.txt';
fhandle utl_file.file_type;
cursor x is
select ... (what ever)
begin
fhandle := utl_file.fopen (filedir, filename,'a');
open x;
loop
fetch x into (what ever)
exit when x%notfound;
utl_file.put_line (fhandle,'text and you results');
end loop;
utl_file.fclose(fhandle);
end;
happy xmas. franz -
I have a requirement to put the query result in a file(.csv),
Pls let me know is there a possibility to achieve this using dbms_output package
Thanks859486 wrote:
I have a requirement to put the query result in a file(.csv),
Pls let me know is there a possibility to achieve this using dbms_output packageNo. The DBMS_OUTPUT package is almost ALWAYS the wrong package to use. It is the most misunderstood and most frequently abused piece of PL/SQL software. So no - it is not suited in anyway to spool CSV output. In fact, trying it with a large SQLdataset can crash the Oracle server - as memory will be exhausted and the swap daemons will trash CPU utilisation.
To read or write a physical o/s file - the typical package used is UTL_FILE. It is fairly easy using UTL_FILE to create a CSV file.
However, there could be far better alternatives. The CSV file may be needed by a web client - in which case the file can be created as a CLOB and provided as a Mime text/csv data stream to a web browser (which usually will automatically open in Excel).
The CSV file may need to be delivered via e-mail. In which case, the CSV file contents can be delivered via UTL_SMTP to a mail server as an e-mail attachment.
The CSV file may be needed to be delivered to a remote server. In which case the CSV file can be created as a CLOB and this CLOB can be ftp'ed via PL/SQL to the remote server as a text file.
So there are many options in creating and delivering a CSV file. Using DBMS_OUTPUT though is not a sensible option - ever. -
How to display the out put of the sql query in a text file using forms
I want to display the out put of the sql query in a text file using forms 6.0.Same could be done using spool command in sqlplus but i want it using forms....Fiaz
Have a look at the text_io package:
http://www.oracle.com/webapps/online-help/forms/10g/state?navSetId=_&navId=3&vtTopicFile=f1_help/oraini/c_text_io.html&vtTopicId=
cheers -
Hi,
I have a sql*developer version 1.5 but i am getting a problem while saving query result to a file. When i click on "script output "-> "file icon" nothing is showing.
Can anyboby guide me whether its a bug or some other settings are required.
I have oracle 10.2.0.3 working on linux.
Thanks & regards
GirishI am getting the same thing and as far as I know it is a bug.
As a workaround, you can either copy the contents of the script output or run the query as a statement (F9) instead of as a script (F5) and export the query results from the results tab. -
Sending query result as html email
hi,
I have requirement to send query result as html emial to user, is there a possibility to send it?
database is 11.2.3
thanks,
7ZGoogle is your friend
http://oracle-base.com/articles/misc/email-from-oracle-plsql.php
https://www.google.nl/search?q=send+email+oracle+database+11g -
Saving query results to text file
Hi experts,
I would like to save a query results to text file.
The query has desined to the correct structure and I wish the query results will be saved automaticly to text file every time the query is running.
The query should cintain some sql code that will save the query to text file instead of show the query results.
What function of SQL should I add to query to achieve that goal. (The query is a long one).
Thanks in advance,
JosephIf you are talking about Query Manager, it is not difficult to do. No matter how long your query coding is, just go to the start point of your query. Then press CtrlShiftEnd to select all the TEXTs. CtrlC and CtrlV will copy the text (query codes) to text file easily.
Thanks,
Gordon -
Sending query results to an excel file
hai friends,
Can any one help me out in sending the results of a query to an excel file once i press a button on my jsp.
I need to display the results of the query and has to send those results to the excel file.
Thanks and regards,
ravikiranThe solution is simple and the trick lies in setting the Content Type of the response and producing the output.
If we remember, while coding in servlets, one needs to set the content type on the response object. For outputting in Excel format, the content type has to be set as "application/vnd.ms-excel"
Once this is done, the servlet knows that it has to produce the output in MS Excel Sheet.
You can query the databsae and loop over your record set and output it in any manner you like.
eg
<!-- Printing the Row Headers-->
out.println("Header1 \t Header 2 \t Header3");
<!-- printing the actual values from database-->
while(rs.next()){
out.println(rs.getString(1) + "\t" + rs.getString(2) + "\t" + rs.getString(3));
Hopefully this will work for all of you.
Thanks -
Query result to ASCII file output
Seems like there SHOULD be some rediculously simple solution
to this - but I sure haven't found it yet! I have a query which
produces the a varying number of columns (based on a multi-select
cfselect) which I need to output to a comma delimited ASCII (.TXT
or .DAT or .CSV file). I have all the steps worked out when the
number of columns and their names are known, but I need to make
this variable. First choice would be to be able to just "DUMP" the
query result into a text file. CFDUMP can send results to a text
file, but NOT in comma delimited format, and with all kinds of info
besides just the basic data. (NOT good!) Second choice, since the
"append to text file" uses an output property that expects a comma
delimited string variable would be to use CFLOOP to loop thru the
rows in the query and put them (a row at a time) into a variable,
then use that variable for the file append. Problem is I can't find
a way to just say "send *ALL* to the string variable. Every example
I have been able to find includes specifying the column NAMES when
doing anything with a row in the query result!!! Short of a brute
force series of if/then statements that specify EACH POSSIBILITY
(in this case 60 - 75 of them, and the number WILL GROW!) I haven't
been able to find a solution. There's GOTTA BE A WAY!!!!! :)auntiealias
> I tried that, but as far as I could figure you still
have to have a specific column name
Look at the udf more closely. If you read the documentation
it states all of the parameters are optional, except the query. So
if you do not supply column names, the function will use the
columnList variable to determine the names of the columns in the
query. If you look at the actual code, notice it uses array
notation to extract the values (not evaluate) .
... (code to create query) ...
<!--- pass in the query object only ---->
<cfset test = QueryToCSV2( data )>
http://cflib.org/index.cfm?event=page.udfbyid&udfid=1197
> I have a cfselect with multiple set to "yes" and the
selections are "which columns of
> data do you want to see?"
Hopefully you are not using the raw form value directly in
your sql, because that is a sql injection attack just waiting to
happen. -
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
-
How do I use the High Speed Data Logger with multiple I/O devices?
I am using the High Speed Data Logger vi to read from a 16 channel A/D card (NI PCI-MIO-16E). The project may require more than 16 channels. How can I use High Speed Data Logger to read from two A/D cards? Will it be able to write the data to one fil
-
hi while posting cross company code posting in F-02 for customer,the open item is not cleared ex: com.code:1000 have customer debit balance the customer paid to com.code 2000 in f-02, 40 bank in com.code:2000 15 cus. in com.code:1000 ha
-
Outlook 2013 add-in will not stay enabled
Everytime Outlook 2013 (windows) closes the add-in for iCloud changes to disabled. The only way I can sync calendars etc, is to manually enable the iCloud Add-in EVERY TIME I open Outlook. What's up with that? It used to work perfectly. I have been
-
Hi all, I am trying to extract value from XMLType column and Update the same with diff harcoded value. Can anyone please check whats going wrong here. If I use Xpath upto '/CoverageForm/Details/Clauses/' it works fine. If I use '/CoverageForm/Details
-
I uploaded videos to website server and when playing videos they keep buffering and stop & start
Hello, I edited videos in PP CS6 and encoded 1920x1080 clips in .mp4 format. Encoded vbr 2pass 5.00 mbps , audio is AAC 320 kbps, 48khz. The videos play perfect in player on destop, and when downloaded from site, but don't play well in website player