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

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.

Related

Is there any table where Oracle APEX usage log is stored

I was just wondering if there is any standard table , where we can see which user has accessed which report in Oracle APEX, based on date and time. Basically the audit history ?
I can do it by inserting the needed data in a custom table but, is there any standard way, where we have all this information?
Regards,
Abha
Oracle APEX has indeed internal tables where it stores all of this information. The name of the view to have insight into this data is apex_workspace_activity_log.
select s.workspace,
s.apex_user,
s.application_id,
s.application_name,
s.page_id,
s.page_name,
s.view_date,
s.apex_session_id
from apex_workspace_activity_log s
/
Here you can see WHO accessed a page, WHAT page has been accessed and WHEN that page has been accessed (date and time). This is not on individual report level, as you asked for, but at least you can see it on page level.
Use following views to see what report exists on which page and join that information as you like.
apex_application_page_rpt
apex_application_page_ir
apex_appl_page_igs
select * from APEX_WORKSPACE_ACTIVITY_LOG
select * from APEX_ACTIVITY_LOG

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 report query to Oracle with Allow multi value parameter

I use Crystal report 2011 to create report from with data from Oracle database. I have a Allow multi values parameter name userid (userid is string).
I want to query
Select ... from table where userid in {?userid};
I try {?userid}, ({?userid}), '{?userid}' ... but it's not working.
what should I do?
Put the cursor on the place where you want it, and double click on the parameter.

Crystal Reports Issue turning a string into a number

I'm having one of those throw the computer out the window days.
I am working on a problem involving Crystal Reports (Version 10) and an Oracle Database (11g).
I am taking a view from the database that returns a string (varcahr2(50)) which is actually a number, when a basic SELECT * query is run on this view I get the number back in the format 000000000000100.00.
When this view is then used in Crystal Reports I can view the field data, but I can't sum the data as it is not a number.
I began, by attempting to using ToNumber on the field, to which Crystal's response was that the string was not numeric text. Ok fair enough, I went back to the view and ran TO_NUMBER, when this was then used in crystal it did not return any results. I also attempted to run TO_CHAR on the view so that I could hopefully import the field as text and then perform a ToNumber, yet the same as with the TO_NUMBER no records were displayed.
I've started new reports, I've started new views. No avail.
This seems to have something to do with how I am retrieving the data for the view.
In simplistic terms I'm pulling data from a table looking at two fields a Foreign Key and a Value field.
SELECT PRIMARY_KEY,
NVL(MAX(DECODE(FOREIGN_KEY, FOREIGN_KEY_OF_VALUE_I_NEED, VALUE_FIELD)), 0)
FROM MY_TABLE
GROUP BY PRIMARY_KEY
When I attempted to put modify the result using TO_NUMBER or TO_CHAR I have used it around the VALUE_FIELD itself and the entire expression, wither way works when the run in a SQL statement. However any TO_NUMBER or TO_CHAR modification to the statement returns no results in Crystal Reports when the view is used.
This whole problem smacks of something that is a tick box or equivalent that I have overlooked.
Any suggestions of how to solve this issue or where I could go to look for an answer would be greatly appreciated.
I ran this query in SQL Developer:
SELECT xxx, to_number(xxx) yyy
FROM (
SELECT '000000000000100.00' XXX FROM DUAL
)
Which resulted in:
XXX YYY
000000000000100.00 100
If your field is truly numeric, you could create a SQL Expression field to do the conversion:
-- {%NUMBER_FIELD}
TO_NUMBER(TABLE.VALUE_FIELD)
This turned out to be an issue with how Crystal Reports deals with queries from a database. All I needed to do was contain my SQL statement within another Select Statement and on this instance of the column apply the TO_NUMBER so that Crystal Reports would recognize the column values as numbers.
Hopefully this helps someone out, as this was a terrible waste of an afternoon.

Update Reports to filter with an Oracle function in Crystal Reports 2008

I have several reports, and on each one of them i have a few tables included.
Lets say 3 tables, tableA, tableB and tableC.
I want to use the following Oracle Function to filter the result set passing also a report parameter:
AND function(tableB.field1, tableB.field2, tableB.field3, {?report_parameter}) = 'S'
Facts to be aware of:
Oracle Functions can only be used on SQL Expressions and/or SQL Commands in Crystal Reports.
SQL Expressions cannot contain report parameters (so, not an option).
Crystal Reports lets you replace a report table with a SQL Command, but does not let you replace several tables to a single SQL Command.
We do not want to re-build all the reports all over again.
We do not want to replace a single table to a SQL Command because it affects performance in a high level since Crystal does not transform the tables and the SQL Command on a single query when executing the report.
This Oracle Function selects data from other tables and therefore can not be rewritten on a Report Custom Function.
The {?report_parameter} is an information that only the application knows. It is filled by the application before exporting the report to the user.
What could I do to work around this?
No knowing exactly why your function requires tables and parameter, I can only give you vague, untested options. None of the options are ideal:
rewrite your Oracle function as 'Custom Function' (CF); reference CF in record-selection formula; filter will be applied WhileReadingRecords (i.e. the function will not be sent to the database)
rewrite your function as a stored procedure that accepts one parameter, but returns a record set (the parameter will be recognized by Crystal Reports); join the other tables to the stored procedure. The stored procedure will need to be written in a manner that will support Crystal Reports' data needs (using result from a stored procedure with parameters as value for gauge chart - crystal reports in asp.net application)

Resources