0

I have a stored procedure that returns formatted, delimited text using dbms_output.put_line statements. Currently, we run the script in Toad and manually paste the output into Excel, but I was hoping I could cut out a step and get the output directly into Excel. I created a connection and set the properties to run the SP: that works fine (more or less -- the next step would have been to figure out how to supply a parameter). However, since no query is being returned, Excel doesn't recognize that there's anything to be done. Is there any way to do this automagically? Thanks.

ETA: I was just trying to figure out if I could build a cursor by inserting the GET_LINE output into it and return that, but that didn't look like it was going to work out.

4
  • And thus why you shouldn't rely on using dbms_output to pass information out. Instead, can't you update the stored procedure to either log the information into a table that you can query, or else return the information out as a parameter?
    – Boneist
    Mar 19, 2015 at 12:17
  • For all practical purposes, the answer is "no". I didn't write the system, I just have to deal with it. Mar 19, 2015 at 12:19
  • I suppose you might be able to get excel to use dbms_output.get_line(s) to read from the buffer, but I'm not sure how well that would work. I'd seriously be looking to amend the stored proc, if I were you, though! (I appreciate that maybe that's not always possible, though.)
    – Boneist
    Mar 19, 2015 at 12:40
  • 1
    Do you need to add the results to an already existing spreadsheet or a new one? You could just pipe the results to a file and open that in Excel.
    – Ben
    Mar 19, 2015 at 13:06

1 Answer 1

0

If you are using Toad most recent versions (10+) allow you to save your output as an excel file. Earlier versions also allow this but with different commands.

In the output section at the bottom right click on any part of the results:

  • select "Export Dataset".
  • select your choice of export file (Excel file)
  • select a file path and file name
  • choose whatever options such as saving the sql on a separate worksheet you need
  • press the button in the lower right corner

Even if the output is comma delimited csv you can then have excel convert it into a real xls or xlsx format.

1
  • Good idea, but the problem here is "no dataset" -- otherwise, I'd be able to read it in Excel. I'm trying to cut out the Toad step, not do it in a different way. Mar 19, 2015 at 13:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.