Saving query result to a file

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
Girish

I 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.

Similar Messages

  • 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,
    Joseph

    If 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

  • Saving query results to a file

    How do i store the results of the a query into a file? Following is the query i am trying to use...
    Thanks.
    StringBuffer sb = new StringBuffer().append("SELECT ").append(select)
                        .append(" FROM ").append(DISTRIBUTOR_TABLE);
              if (where != null && 0 < where.length()) {
                   sb.append(" WHERE ").append(where);
                   if(hasState){
                        sb.append(" UNION ");
                        sb.append("SELECT ").append(select).append(" FROM ").append(DISTRIBUTOR_TABLE);
                        sb.append(" WHERE ").append("ID =(select DISTRIBUTOR from statesApply where STATE = '?' ");
              }

    1. set up a db conection 9set the driver name, server url, port, login, password, etc)
    2. open the connection
    3. execute the query (using statement or preparestatement)
    4. iterate over the resultset
    a) store the data from the result set in an object
    5. close the resultset, statement, connection
    6. write to a file
    a) depends on how you want to store the data (if text.use PrintWriter)
    check out the Sun website for tutorial on using JDBC (database..it's pretty good and easy..you'll get started in no time)
    also check out the IO tutorial (specifically on PrintWriter to write String to a text file)

  • 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
    Erwin

    i dont think you can save as excel file but you can save it as CSV use APD or RSCRM BAPI for this

  • 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?
    Thanks

    1. 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.

  • How to save query result in excel file

    Hi all,
    How to save query result in excel file from sql*plus tool.
    thank you

    Do 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:
    v838

    hi,
    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

  • Query results to a file

    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
    Thanks

    859486 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.

  • Saving query results to a flat file

    Hello Experts!
    We have a very specific issue on our current project and I would like to know if any of you have ever done something similar. We are taking query results from BW (after complex calculations, some based on SY-DATE) and saving them to flat files to transfer to a SQL database structure on the Enterprise Portal. From here, the portal team renders the information into more "static" dashboards that include mouse over features and even limited drilldown (i.e. no matter where a user clicks the report always drills down on profit center)
    There are many reasons why the model is set up as such (mostly training of executive level end users), and even though it doesn't mesh with the idea that BW could do this work on its own, we have to work with what we have.
    We have come up with 3 possible ways to save this data to flat files and hopefully someone can tell us which might be the most effective.
    1.) Information Broadcasting. If we broadcast XML files to the portal, will the portals team be able to read that data into a SQL database? Is there another way to use broadcasting to create and send a flat file to specific location?
    2.) RSCRM_BAPI. This transaction seems to not support texts.
    3.) Open Hub. In order to get the open hub to work, we first have to save all of our query results to direct write data store objects using APD. (calculations based on current date, for example, would require daily full loads to the underlying data providers otherwise.)
    What is the best way to accomplish this? Is information broadcasting capable of doing this?
    Thanks!

    Hi Adam,
    Do you have to use flat files to load the information to a SQL database? (if so maybe someone else has a suggestion on which way would be the best).
    I try to stay away from flat file uploads as there is a lot of manual work involved. May I suggest setting up a connection to your SQL table in the DBCON table and then writing a small abap program to push data into the SQL database (which you can automate).
    1) Use APD to push data into a table within BW.
    2) Go to transaction SM30 > table DBCON and setup a new entry specifying the conncection parameters to your SQL database.
    3) In SE38 Write an ABAP program along the folloing lines (assuming the connection you set in DBCON is named conn1:
    data: con_name like dbcon-con_name
    con_name = 'conn1'.
    exec sql.
      set connection :con_name
    endexec.
    ****have a select statement which reads data from your table which the data is saved from the APD into an internal table**********
    ****loop on the internal table and have a SQL insert statement to insert the records into the SQL table as below******
    exec sql.
    insert into <SQL TABLE> (column names seperated by ,)
    values (column names of the internal table seperated by ,)  if the internal table is named itab the columns have to be specified as :itab-column1
    If you decide to take this approach you may find more info on DBCON and the process in sdn. Good Luck!
    endexec.

  • Export query results to flat file with dynamic filename

    Hi
    Can anybody can point me how to dynamic export query serults set to for example txt file using process flows in OWB.
    Let say I have simple select query
    select * from table1 where daterange >= sysdate -1 and daterange < sysdate
    so query results will be different every day because daterange will be different. Also I would like to name txt file dynamicly as well
    eg. results_20090601.txt, results_20090602.txt, results_20090603.txt
    I cant see any activity in process editor to enter custom sql statment, like it is in MSSQL 2000 or 2005
    thanks in advance

    You can call existing procedures from a process flow the procedure can create the filename with whatever name you desire. OWB maps with file as target can also create a file with a dynamic name defined by an expression (see here ).
    Cheers
    David

  • Export query results into .csv file?

    Hello I have a T-SQL script that gets row counts for a specified date range and then needs to loop (by incrementing +1 day to get the next day's counts) for a large date range.  I'm aiming to output & append each query results day counts
    into a .csv file via a SQL Agent job since this will take quite a while to complete.
    Would using the following as an example template...
    INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0','Text;Database=D:\;HDR=YES;FMT=Delimited','SELECT * FROM [FileName.csv]')
    SELECT Field1, Field2, Field3
    FROM DatabaseName
    ...be the method or something else?
    If this is good to use I've tried running this but get the following error:
    Msg 7357, Level 16, State 2, Line 76
    Cannot process the object "SELECT * FROM [FileName.csv]". The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions
    on that object.
    Thanks in advance.

    Hi Techresearch7777777,
    The error in your post says that the file FileName.csv has to be created with the column names in the first row. Like:
    Field1,Field2,Field3
    Either you can create a schema.ini file under the same folder:
     [FileName.csv]
     Format=CSVDelimited
     ColNameHeader=False
     Col1=Field1 [DataType]
     Col2=Field2 [DataType]
     Col3=Field3 [DataType]
    For the [DataType],you can reference
    Schema.ini File (Text File Driver)
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • 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.

  • Select query results into excel file

    Hi,
    I want to put the results of a select query in an csv file(tab separated columns). I dont want to spool command for this . Is there any other method to do this.
    Thanks

    To get data from oracle to excel to use odbc driver to achive this.

  • Saving query results as excel

    hi,
    Is there a way to save the query results as excel programatically (some kind of utility which does the job)? we are using oracle 10g. This will be a nightly job.. so that every other day morning we have the huge excel report ready for viewing. Any help is appreciated..

    Did you think to try searching the forum? I typed in the EXACT string you used for your thread title and the first hit was ...
    Saving sql query result as excel file

  • 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.

Maybe you are looking for

  • How do you fix the zoom when trying to put a picture as your background?

    Every time I try to put a new background on my iPad mini, it zooms in way too far. This only started happening after I got IOS 7. Please Help! And I don't turn on the Optimal Zoom but it zooms anyways!

  • Cambodia (Khmer) font on iPod nano?

    Hi everybody here, i would like to know if it is possible to add a additional font into an iPod? Since there is no official Khmer font for Mac, iPod and iPhone. In iPhone and iPod touch, in order to display this font we have to install a package. Win

  • TS3999 How to repeat one event only on weekdays with iPad calendar?

    I want to use iPad 1 calendar to repeat one event on weekdays, that is to say, repeat five days in a 7-day week. However, I find that is impossible due to the matter of fact that I can only make repeating everyday possible. Anyone helps me? Thanks a

  • Need help on timestamp in oracle....

    hi in my web application i hav oracle as backend. Through web page i m suppose to make entry in the database. The table contains 2 entries for datatype TIMESTAMP(6) out of these one is compulsory (i.e not null) and other is not compulsory. here is wh

  • Iphoto disappeared in OSX lion!

    I had the entire ilife suite installed in snow leopard along with lots of iphoto and garageband projects, and when I upgraded to OSX lion it all disappeared. To add to that I now have to go to the mac app store to purchase them if I want them now ***