How to extract sql query from Oracle reports - oracle

I have Oracle report file (rdf file). I need to find what are the queries running (SQL queries) to extract data for this report.
As an example, how to find what is the query running once we click on save button related to this RDF file?

Obviously, the simplest way is to open that report in Reports Builder (which supports RDF version you have; I mean, Reports 2.5 probably won't open a RDF created in version 10g) and have a look at the data model editor.
Otherwise, do as I do it - open a RDF (or, if you have a JSP - even better) with a text editor (such as Notepad) and perform search through the file - search for SELECT keyword. You'll find some useless entries, but you'll certainly see useful ones as well. Copy them out of the RDF file and ... well, do whatever you planned to do with them.

Related

Can we find a table that is used in a set of FMBs without opening it individually in Oracle Forms?

I am using both Oracle Forms version 11g and 12c.
Is it possible to find a table for e.g table1 used in the Oracle Forms application screens including LOV's without opening each FMB individually and searching in it.
Totally there are around 50-75 FMBs in the application.
Thanks
While Forms was a new software product, back then in its 3.0 version (or even lower), you could choose whether you'll keep the form source
in the database or
in that case, you could have written a query which selects data from the data dictionary and - hopefully - extract tables' names
in file system
file extension was .INP (not .FMB) and it was a textual file; it means that you could even create a form using text editor! Nobody probably did that, but hey - you could have done it.
.FMB is no longer textual file. Yes, you can open it it a text editor (such as Notepad++) and search for e.g. FROM (because any table used in form's PL/SQL units or LoVs is part of a SELECT statement which requires the FROM keyword) and get something like this:
Yes, you'll get "duplicates" if any table is referenced more than once.
Another option is to write a program which will parse the .FMB file and extract tables' names (I can't help with that, though).

How to extract Queries metadata from Power Query Editor

I am looking for a way to extract power queries metadata from power query editor to spreadsheet or word for documentation purposes to understand the transformations or formulas applied in each query present in power query editor.
I have read different comments in other sites including renaming .XLSX to .ZIP and inside xl\connections.xml there's a Microsoft.Mashup.OleDb.1 data connection with some metadata but I am not successful in extracting the queries metadata. I am looking for any automated process to extract power queries transformation data into spreadsheet outside of power query. Any suggestions or ideas will be great help for me.
You can access the code underlying any Power Query in Excel through the Queries object that is part of the workbook. It's in "Formula" property of the Query object. You can also get the name of the Query with the "Name" property. It just gives you the code as plain text, so it would be up to you to apply any context to that.
for i = 1 to ThisWorkbook.Queries.Count
ThisWorkbook.Queries(i).Name
ThisWorkbook.Queries(i).Formula
next
Note this only works in Excel 2016 or later. Older versions of Excel where PQ is installed as an add-in can't access PQ through VBA. I'm also unaware of any method to extract information on the dependencies between Queries within a workbook (though with consistent naming conventions you could pretty easily build this yourself I figure).

Crystal report: changing command's data source

I have to change the data source in quite a few reports. Its easy when the original data source uses table, but its more complicated when instead has a SQL command (well, practically its a view but made in the report, not in the original database).
Lets say that report has originally such command:
SELECT nbr FROM equipment WHERE equipment.owner='ABC'
I know that in the new database Equipment.nbr is called now Items.ID, so I can easily map this. But what about the rest of command, the "WHERE" part? In the new database there is obviously no Equipment.owner and possibly might not even be Items.owner. Does crystal simply drop this part? I know how to remake it, by simply adding selection formula to the report, but first I have to be know what happened to the "WHERE" condition, and after such mapping I can't anymore preview the SQL command in the data source.
Confrim me where you are using this query.
If it is in Data soruce then no issue this report will work.
If it is in formula then I have doubt crystal report won't accept this format even in basic syntax mode.

dbsaint - Retrieve form EXCEL

How can I retrieve data (using sql) from Excel to a table in Oracle database. I am using dbsaint.
Instead of DBSAINT, which developer tool should I use for this purpose?
The easiest way to do this is to export the data from Excel into a CSV file. Then use an external table to insert the data into your database table.
Exporting the CSV file can be as simple as "Save as ...". But watch out if your data contains commas. In that case you will need to ensure that the fields are delimited safely and/or that the separator is some other character which doesn't appear in your data: a set of characters like |~| (pipe tilde pipe) would work. Find out more.
External tables were introduced in Oracle 9i. They are just like normal heap tables except their data is held in external OS files rather than inside the database. They are created using DDL statements and we can run SELECTs against them (they are read only). Find out more.
Some additional DB infrastructure is required - the CSV files need to reside in an OS directory which is defined as an Oracle dictionary object. However, if this is a task you're going to be doing on a regular basis then the effort is very worthwhile. Find out more.
I don't know much about DbSaint; it's some kind of database IDE like TOAD or SQL Developer but focused at the cheap'n'cheerful end of the market. It probably doesn't support this exact activity, especially exporting to CSV from Excel.

csv viewer on windows environement for 10MM lines file

We a need a csv viewer which can look at 10MM-15MM rows on a windows environment and each column can have some filtering capability (some regex or text searching) is fine.
I strongly suggest using a database instead, and running queries (eg, with Access). With proper SQL queries you should be able to filter on the columns you need to see, without handling such huge files all at once. You may need to have someone write a script to input each row of the csv file (and future csv file changes) into the database.
I don't want to be the end user of that app. Store the data in SQL. Surely you can define criteria to query on before generating a .csv file. Give the user an online interface with the column headers and filters to apply. Then generate a query based on the selected filters, providing the user only with the lines they need.
This will save many people time, headaches and eye sores.
We had this same issue and used a 'report builder' to build the criteria for the reports prior to actually generating the downloadable csv/Excel file.
As other guys suggested, I would also choose SQL database. It's already optimized to perform queries over large data sets. There're couple of embeded databases like SQLite or FirebirdSQL (embeded).
http://www.sqlite.org/
http://www.firebirdsql.org/manual/ufb-cs-embedded.html
You can easily import CSV into SQL database with just few lines of code and then build a SQL query instead of writing your own solution to filter large tabular data.

Resources