Forum Stats

  • 3,770,915 Users
  • 2,253,181 Discussions
  • 7,875,654 Comments

Discussions

Need to Get latest 10 record from each table in a Schema with separate excel file

Kumarnkl
Kumarnkl Member Posts: 10 Red Ribbon

Requirement : Need to create excel file. Each sheet in excel file should content latest 10 records from each table in a schema. Please provide suggestion to get SQL query OR any tools OR any other ideas.

Example

Schema - XX

IN that schema have 3 table (Table1, Table2, Table3). It's the scenario

Result should be : Create the EXCEL FILE, In the excel each sheet should content latest 10 records from each table in a schema.

Sheet1 Name -Table1 (Each sheet should content latest 10 records)

Sheet2 Name -Table2 (Each sheet should content latest 10 records)

Sheet3 Name -Table3 (Each sheet should content latest 10 records).


Please assist us by your valuable information.

Answers

  • Jason_(A_Non)
    Jason_(A_Non) Member Posts: 2,046 Silver Trophy

    Why is this in the Advanced Queueing forum as it has nothing to do with AQ?

    What defines "latest 10" for you and how do you find them? In most of the tables for the system I work with, that would be based off audit columns (created date and mod date). Some tables don't have that because there is no reason to track it based off the table's purpose.

    Is this a one-time thing or a repeating task?

    Is it just these three tables always or was that what you listed as an example?

    What version of Oracle. That makes a difference at how you go about getting "10".

    Me, I'd use the software tool I already have (PL/SQL Developer) and write three queries and execute them all at once and then have the tool export the results into a single Excel file. This is assuming the task is a one-time or low enough frequency that the cost of developing/maintaining an automated approach outweighs doing it manually. You could write a PL/SQL approach to save the files to disk at a location the DB server can access using third party packages people have written to work with Excel. I can't recall right now whether those tools deal with multiple worksheets in an Excel file or not though.

  • Kumarnkl
    Kumarnkl Member Posts: 10 Red Ribbon

    Thanks for response Jason. It's one-Time task Just checking whether is any possibility to achieve my requirement in simple way. We are also using PL/SQL developer. Right now we are export records by fetching each and every table separately.