How to get View from Oracle to Jaspersoft Studio? - oracle

I have created the following view in Oracle:
CREATE OR REPLACE FORCE VIEW "TEST_ASSIGNMENT"."VPRODUCTCATALOG" ("PRODUCTCODE", "GROUPCODE", "PRODUCTGROUPPATH") AS
select "code" as productCode,
func_groupCode("code") as groupCode,
func_productPath("code") as productGroupPath
from "Products";
I want to create a report in Jaspersoft Studio which will have information from this View.
How can I get this View into Jaspersoft? It seems to me that Jaspersoft only have ordinary SELECT for option.

Firstly, a "View" is not PL/SQL code, it's a standard SQL object.
You have to write a normal SQL query like:
SELECT * FROM "TEST_ASSIGNMENT"."VPRODUCTCATALOG"`
If you want to execute PL/SQL code you must select PL/SQLlanguage from the language list, but it is a more advanced topic and not required in your requirement.

Related

Jaspersoft Studio - Oracle JDBC Data Adapter - Set Specific Schema as Current Schema

I have the latest version of Jaspersoft Studio and I am using Oracle's JDBC data adapter (ojdbc11.jar), but the connection is made with the default schema, while I want the queries of each report to be executed in another schema (let's call it that: "MySchema").
For example a report with this SELECT clause will not work:
select *
from myTable
while a report with this SELECT clause will work:
select *
from MySchema.myTable
I tried things like this:
jdbc:oracle:thin:#//10.1.1.55:1521/DOMAIN.COM;connectionProperties={currentSchema=MySchema}
or this:
jdbc:oracle:thin:#//10.1.1.55:1521/DOMAIN.COM;connectionProperties={CURRENT_SCHEMA=MySchema}
or this:
jdbc:oracle:thin:#//10.1.1.55:1521/DOMAIN.COM?searchpath=MySchema
or this:
jdbc:oracle:thin:#//10.1.1.55:1521/DOMAIN.COM??currentSchema=MySchema
but without success.
Do you have a solution in this direction or do you know of any other way to solve the problem?
This is an extremely big problem if you consider that I have reports that make selects to dozens of tables and functions.

Viewing the last edit date of a procedure in Oracle SQL Developer

In SQL Server Management Studio, there's a tab called Object Explorer Details that you can look at to see when a table or a procedure is created or last modified.
Is there something similar for Oracle SQL Developer?
View > Reports > Data Dictionary Reports
Open the All Objects Report
You can filter/sort the report to restrict to a specific schema or object type, or even filter on the last updated date (Last_DDL)
* Query way *
With Oracle, you can query the view all_objects
* GUI way *
Search for the objects that you want and the check the Details tab
Let say you want information about OE_ACKNOWLEDGMENT_PUB package body
Then you click on the object name
Then you click on Details tab

Crystal Reports displays blank (null) values for some fields from an Oracle view

Summary
We have a Crystal Report referencing a single Oracle view. There are no other tables or joins in the report. The view is composed of several selects, joins, and other data transformations (e.g., sum, case, to_date, group by).
Four columns from the view display as blank (null) in the report. These same columns display correctly in Oracle SQL Developer and via a select using the Oracle Data Provider for .NET in a C# application. All other columns display correctly in the report.
In addition the Browse Field option displays no values for the affected fields, but does display options for unaffected fields of the same type. Similarly, if I make an affected field a parameter of the report no options are presented.
We verified that in all cases we are connecting as the same read only user in Crystal Reports, Oracle SQL Developer, and in our Web Application.
Failed Resolution Attempts
We removed and replaced the view and fields in the Crystal Report.
We created a brand new report connecting to the same view.
We created a new view (from the same SQL) to be used in the same report
We verified database via Crystal Reports
We converted implicit date conversion from
score_month = '01-SEP-2017'
to
score_month = TO_DATE('01-SEP-2017', 'dd-MON-yyyy')`
per https://stackoverflow.com/a/37729175/19977
Other Oddities
Exporting the data from the view to a table works, but we want to use a view
We're at a loss as to what the cause of this issue is. Any ideas?
Several edits to the view were required to resolve this issue.
We removed Oracle specific sql per https://stackoverflow.com/a/37729175/19977. Example:
-- replace
TRUNC(sysdate, 'MONTH') AS score_month`
-- with
TO_DATE('01-SEP-2017', 'dd-MON-yyyy')
-- and replace
where score_month = '01-SEP-2017'
-- with
where score_month = TO_DATE('01-SEP-2017', 'dd-MON-yyyy')
Fully qualify all tables and views used in the Oracle view with the schema and table name. Example:
-- replace
FROM table t
-- with
FROM our_schema.table t
It remains unclear why the view would work as intended from Oracle SQL Developer and in application via the Oracle Data Provider for .NET but not from Crystal Reports. Further insight into this issue is welcome.

What command should I use to get the actual value of a parameter in Toad for Oracle?

I'm trying to get the actual value of OPTIMIZER_SECURE_VIEW_MERGING in Toad for Oracle but I don't know how.
Try this:
select *
from v$parameter
where upper(name) = 'OPTIMIZER_SECURE_VIEW_MERGING'
See Oracle doc for details on v$parameter
Your login would need read access to the v$parameter view. FYI, there is no dependency on TOAD for this - just a straight SQL query, can be run from any SQL client.
I am running TOAD 12, and you can also view all the current oracle parameters from the Database/Administer/Oracle Parameters menu item.

How to search strings inside Oracle Procedures, Functions and Triggers?

I need to find strings inside Oracle Procedures, Functions and Triggers.
For SQLServer I use something like this:
SELECT DISTINCT so.name
FROM syscomments sc
INNER JOIN sysobjects so ON sc.id=so.id
WHERE sc.TEXT LIKE '%m4_plf_par_periodo%'
There is something like this for Oracle?
Give me a clue.
Best Regards,
you can query ALL_SOURCE (contains the source to all programs you have access to).
Alternatively, DBA_SOURCE describes the text source of all stored objects in the database and USER_SOURCE contains the text source of your stored objects only.
See this question for the solution using USER_SOURCE.
Use the "Find Database Object" wizard in free Oracle DB tool "SQL Developer".
To be exact, download and install Oracle SQL Developer from Oracle --> Create a new connection to the database, using a power-user --> In the SQL Developer menu choose "View" --> open menu item "Find DB Object" --> opens a Find Database Object Widget on the left panel --> Choose the DB connection --> Select specific schemas to search --> Select "All Source Lines" node --> type a string to search --> Click Go.
Expect it to do a non-cases-sensitive wild-card search in all source of Triggers/Procedures/Functions/Packages, owned by the selected schema and display a comprehensive search report of sample lines of code from each object where it was located.

Resources