Need input on SQL Report
Hi,
I have a sql code which would generate the report. Eg
SPOOL TEST.LST
TTITLE CENTER 'KDI SQL QUERY REPORTS FOR DAILY MONITORING' SKIP 2
TTITLE LEFT 'CHECKING ANY PRICE FOUND FOR KD PACKS' SKIP 2
SELECT CI_CODE, SORK_NUMB, BATCH_NUMB
FROM CONS_TEMP GROUP BY SORK_NUMB, BATCH_NUMB, CI_CODE
ORDER BY CI_CODE, SORK_NUMB, BATCH_NUMB;
SPOOL OFF
I would like to see the report with "SELECT query, SELECT query ouptut and TITTLE command's output" . If I give echo on command , it print 'echo on' command also . Please help me out.
-Thambi
Hi,
I have a sql code which would generate the report. Eg
SPOOL TEST.LST
TTITLE CENTER 'KDI SQL QUERY REPORTS FOR DAILY MONITORING' SKIP 2
TTITLE LEFT 'CHECKING ANY PRICE FOUND FOR KD PACKS' SKIP 2
SELECT CI_CODE, SORK_NUMB, BATCH_NUMB
FROM CONS_TEMP GROUP BY SORK_NUMB, BATCH_NUMB, CI_CODE
ORDER BY CI_CODE, SORK_NUMB, BATCH_NUMB;
SPOOL OFF
I would like to see the report with "SELECT query, SELECT query ouptut and TITTLE command's output" . If I give echo on command , it print 'echo on' command also . Please help me out.
-Thambi
Similar Messages
-
Need advise on SQL Report base for APEX or jasper
Hello everyone,
I need some advise on how to approach this below report requirement. It has been bugging me for nearly 2 weeks now, and my time is running out.
Here is a simplified version of the database
Four tables: Defendant, Engagement, Service, Event.
A defendant can have more than 1 engagement, but they have only one open engagement at a time.
For each engagement, they will have services and events.
These events can be just general events or events that relates to the service.
Here is the script for the tables and sample data
CREATE TABLE "DEFENDANT"
("DEF_ID" NUMBER,
"FIRST_NAME" VARCHAR2(50 BYTE),
"LAST_NAME" VARCHAR2(50 BYTE),
"ACTIVE" NUMBER DEFAULT 1
Insert into DEFENDANT (DEF_ID,FIRST_NAME,LAST_NAME,ACTIVE) values (1,'Joe','Bloggs',1);
Insert into DEFENDANT (DEF_ID,FIRST_NAME,LAST_NAME,ACTIVE) values (2,'John','Doe',1);
CREATE TABLE "ENGAGEMENT"
("ENG_ID" NUMBER,
"DEF_ID" NUMBER,
"COURT_NAME" VARCHAR2(20 BYTE),
"DATE_JOINED" DATE,
"DATE_TERMINATED" DATE,
"ETHNICITY" VARCHAR2(50 BYTE),
"ACTIVE" VARCHAR2(20 BYTE)
Insert into ENGAGEMENT (ENG_ID,DEF_ID,COURT_NAME,DATE_JOINED,DATE_TERMINATED,ETHNICITY,ACTIVE) values (1,1,'AAA',to_date('01/09/12','DD/MM/RR'),to_date('20/09/12','DD/MM/RR'),'European','1');
Insert into ENGAGEMENT (ENG_ID,DEF_ID,COURT_NAME,DATE_JOINED,DATE_TERMINATED,ETHNICITY,ACTIVE) values (2,2,'BBB',to_date('01/10/12','DD/MM/RR'),null,'Asian','1');
Insert into ENGAGEMENT (ENG_ID,DEF_ID,COURT_NAME,DATE_JOINED,DATE_TERMINATED,ETHNICITY,ACTIVE) values (3,1,'AAA',to_date('22/09/12','DD/MM/RR'),null,'European','1');
CREATE TABLE "EVENT"
("EVENT_ID" NUMBER,
"ENG_ID" NUMBER,
"NOTES" VARCHAR2(20 BYTE),
"RELATED_SERVICE_ID" NUMBER,
"START_DATE" DATE,
"END_DATE" DATE,
"ACTIVE" NUMBER DEFAULT 1
Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (1,1,null,1,to_date('01/09/12','DD/MM/RR'),to_date('02/09/12','DD/MM/RR'),1);
Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (2,1,null,1,to_date('23/09/12','DD/MM/RR'),null,1);
Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (3,1,null,2,to_date('15/10/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),1);
Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (4,2,null,null,to_date('02/10/12','DD/MM/RR'),null,1);
Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (5,2,null,2,to_date('03/10/12','DD/MM/RR'),null,1);
Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (6,3,null,null,to_date('22/09/12','DD/MM/RR'),to_date('23/09/12','DD/MM/RR'),1);
Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (7,3,null,4,to_date('23/09/12','DD/MM/RR'),null,1);
Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (8,2,null,null,to_date('12/10/12','DD/MM/RR'),null,1);
CREATE TABLE "SERVICE"
( "SERVICE_ID" NUMBER,
"ENG_ID" NUMBER,
"DESCRIPTION" VARCHAR2(200 BYTE),
"DATE_STARTED" DATE,
"DATE_TERMINATED" DATE,
"ACTIVE" NUMBER DEFAULT 1
Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (1,1,'Counselling',to_date('15/09/12','DD/MM/RR'),to_date('18/09/12','DD/MM/RR'),1);
Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (2,1,'Housing',to_date('20/09/12','DD/MM/RR'),null,1);
Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (3,2,'Treatment',to_date('01/10/12','DD/MM/RR'),to_date('15/10/12','DD/MM/RR'),1);
Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (4,3,'Housing',null,null,1);
Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (5,1,'Other',to_date('05/10/12','DD/MM/RR'),null,0);
Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (6,2,'Treatment',to_date('16/10/12','DD/MM/RR'),null,1);****
And this is the view I am thinking to use as the base for the report
CREATE OR REPLACE FORCE VIEW "BASE_VW"
AS
SELECT Def.Def_Id,
Def.First_Name,
Def.Last_Name,
Eng.Eng_Id,
Eng.Court_Name,
Eng.Date_Joined,
Eng.Date_Terminated,
Eng.Ethnicity,
Ser.Service_Id,
Ser.Description,
Ser.Date_Started AS Service_Start_Date,
Ser.Date_Terminated AS Service_Date_Terminated,
Ser.Active AS Service_Active,
Ev.Event_Id,
Ev.Related_Service_Id,
Ev.Start_Date,
Ev.End_Date,
Ev.Notes,
ev.active AS event_active
FROM Defendant Def
LEFT OUTER JOIN Engagement Eng
ON Def.Def_Id = Eng.Def_Id
LEFT OUTER JOIN Service Ser
ON Eng.Eng_Id = Ser.Eng_Id
LEFT OUTER JOIN Event Ev
ON Ev.Eng_Id = Eng.Eng_Id;****
Requirement:
Report parameter: Start Date, End Date, Court_name
From chosen Court_name, list defendants who currently engage in the court.
For each defendant display
Section 1: Identifying Details: First Name, Last Name, Ethnicity, Date Joined Court
Section 2: All Services currently active that the defendant attend
Section 3: All Events that related to the service that the defendant attend
Section 4: All other events (don't have Related Service ID)
User must be able to download the whole report in spreadsheet or PDF format.
I did try to create a set of union selects (but the format is not that good, when no data return it display nothing, I would rather show some messages like "There is no associated events, rather than nothing")
and it only produces report for 1 defendant at a time.
We use Oracle APEX , so only select statement or PL/SQL Code return select statement is valid for report source.
In our place we use Jasper Report adjacent to APEX, but I have very little experience with Jasper report.
The developer who knows a lot about jasper report is too busy to help me.
Currently, I use union selects like below:
With Current_Engagement As
( Select Eng_Id From Engagement
Where Def_Id =2
And Date_Joined Is Not Null
And ( Date_Terminated Is Null Or Date_Terminated > Sysdate)
And Rownum =1
Select '1.Defendant ID' as col1, 'First Name' as col2, 'Last Name' as col3, 'Court Name' as col4, 'Ethnicity' as col5, 'Date Joined' as col6, 'Date Terminated' as col7
From Dual
Union All
Select Distinct to_char(Def_Id), First_Name, Last_Name, Court_Name, Ethnicity, to_char(Date_Joined), to_char(Date_Terminated)
From Base_Vw Inner Join Current_Engagement Ce On Base_Vw.Eng_Id = Ce.Eng_Id
Union All
select '2.Service ID', 'Service Description', 'Start Date', 'End Date', Null, Null, Null
from dual
Union All
Select distinct to_char(service_id), description, to_char(service_start_date), to_char(service_date_terminated), null, null, null
From Base_Vw Inner Join Current_Engagement Ce On Base_Vw.Eng_Id = Ce.Eng_Id
where service_active =1
Union All
Select '3.Event ID', 'Related Service ID', 'Start Date', 'End date', 'Notes', null, null
From Dual
Union All
Select distinct to_char(event_id), to_char(related_service_id), to_char(start_date), to_char(end_date), notes, null, null
from Base_Vw Inner Join Current_Engagement Ce On Base_Vw.Eng_Id = Ce.Eng_Id
Where Event_Active = 1
and related_service_id is not null
Union All
Select '4.Event ID', 'Start Date', 'End date', 'Notes', null, null, null
From Dual
Union All
Select distinct to_char(event_id), to_char(start_date), to_char(end_date), notes, null, null, null
From Base_Vw Inner Join Current_Engagement Ce On Base_Vw.Eng_Id = Ce.Eng_Id
Where Event_Active = 1
and related_service_id is nulland the result is kind of what I try to achieve (except that I need to work on display a message 'No data found' rather than nothing), But it seems that my code works only for one defendant.
COL1 COL2 COL3 COL4 COL5 COL6 COL7
1.Defendant ID First Name Last Name Court Name Ethnicity Date Joined Date Terminated
2 John Doe BBB Asian 01/10/12
2.Service ID Service Description Start Date End Date
3 Treatment 01/10/12 15/10/12
6 Treatment 16/10/12
3.Event ID Related Service ID Start Date End date Notes
5 2 03/10/12
4.Event ID Start Date End date Notes
4 02/10/12
8 12/10/12
10 rows selected
However, I struggle to find a way to apply this to more than 1 defendant and still keep the format.
Defendant 1
All details related to defendant 1
Defendant 2
All details relayed to defendant 2
Defendant n
All details relayed to defendant nIs it possible to display a report as above by using only SQL script ?
Thanks a lot in advance. I am willing to compensate financially to someone who can give me a solution.
Edited by: Ann586341. View base_vw SQL script is fixed.Thanks a lot Jeneesh. (You are really a guru.)
It is nearly 98% what the requirements ask for.
I just have one more question.
If I add more information into the database, just one more defendant
Insert into DEFENDANT (DEF_ID,FIRST_NAME,LAST_NAME,ACTIVE) values (3,'Minnie','Mouse',1);
--and one in Engagement table
Insert into ENGAGEMENT (ENG_ID,DEF_ID,COURT_NAME,DATE_JOINED,DATE_TERMINATED,ETHNICITY,ACTIVE) values (4,3,'BBB',to_date('05/10/12','DD/MM/RR'),null,'Latin America','1');Then I run the select statment again (without changing anything)
With Current_Engagement As
( Select Eng_Id
From Engagement
Where /*Def_Id =2
And*/ Date_Joined Is Not Null
And ( Date_Terminated Is Null Or Date_Terminated > Sysdate)
--And Rownum =1
titles as
( Select .9 dummy_rn,'1.Defendant ID' as col1, 'First Name' as col2, 'Last Name' as col3,
'Court Name' as col4, 'Ethnicity' as col5, 'Date Joined' as col6,
'Date Terminated' as col7
From Dual
union all
select 1.9,'2.Service ID', 'Service Description', 'Start Date', 'End Date',
Null, Null, Null
from dual
union all
Select 2.9,'3.Event ID', 'Related Service ID', 'Start Date', 'End date', 'Notes',
null, null
From Dual
Union All
Select 3.9,'4.Event ID', 'Start Date', 'End date', 'Notes', null, null, null
From Dual
all_titles as
( select dummy_rn,eng_id,col1,col2,col3,col4,col5,col6,col7
from current_engagement,titles
select col1,col2,col3,col4,col5,col6,col7
from (
select dummy_rn,eng_id,col1,col2,col3,col4,col5,col6,col7
from all_titles
Union All
Select Distinct 1,ce.eng_id,decode(Base_Vw.Eng_Id,null,'No Data',to_char(Def_Id)) def_id,
decode(Base_Vw.Eng_Id,null,'No Data',First_Name) First_Name,
decode(Base_Vw.Eng_Id,null,'No Data',last_Name) Last_Name,
decode(Base_Vw.Eng_Id,null,'No Data',court_Name) Court_Name,
decode(Base_Vw.Eng_Id,null,'No Data',ethnicity) Ethnicity,
to_char(Date_Joined), to_char(Date_Terminated)
From Base_Vw
right outer join Current_Engagement Ce
On Base_Vw.Eng_Id = Ce.Eng_Id
Union All
Select distinct 2,ce.eng_id,
decode(Base_Vw.Eng_Id,null,'No Data',to_char(service_id)),
decode(Base_Vw.Eng_Id,null,'No Data',description) ,
decode(Base_Vw.Eng_Id,null,'No Data',to_char(service_start_date)),
decode(Base_Vw.Eng_Id,null,'No Data',to_char(service_date_terminated)) ,
decode(Base_Vw.Eng_Id,null,'No Data',null),
decode(Base_Vw.Eng_Id,null,'No Data',null),
decode(Base_Vw.Eng_Id,null,'No Data',null)
From Base_Vw
right outer Join Current_Engagement Ce
On Base_Vw.Eng_Id = Ce.Eng_Id
where service_active =1
Union All
Select distinct 3,ce.eng_id,
decode(Base_Vw.Eng_Id,null,'No Data',to_char(event_id)),
decode(Base_Vw.Eng_Id,null,'No Data',to_char(related_service_id)),
decode(Base_Vw.Eng_Id,null,'No Data',to_char(start_date)),
decode(Base_Vw.Eng_Id,null,'No Data',to_char(end_date)),
decode(Base_Vw.Eng_Id,null,'No Data',notes),
decode(Base_Vw.Eng_Id,null,'No Data',null),
decode(Base_Vw.Eng_Id,null,'No Data',null)
from Base_Vw
right outer Join Current_Engagement Ce
On Base_Vw.Eng_Id = Ce.Eng_Id
Where Event_Active = 1
and related_service_id is not null
Union All
Select distinct 4,ce.eng_id,
decode(Base_Vw.Eng_Id,null,'No Data',to_char(event_id)),
decode(Base_Vw.Eng_Id,null,'No Data',to_char(start_date)),
decode(Base_Vw.Eng_Id,null,'No Data',to_char(end_date)),
decode(Base_Vw.Eng_Id,null,'No Data',notes),
decode(Base_Vw.Eng_Id,null,'No Data',null),
decode(Base_Vw.Eng_Id,null,'No Data',null),
decode(Base_Vw.Eng_Id,null,'No Data',null)
From Base_Vw
right outer Join Current_Engagement Ce
On Base_Vw.Eng_Id = Ce.Eng_Id
Where Event_Active = 1
and related_service_id is null
order by eng_id,dummy_rn,col1
;The result is
COL1 COL2 COL3 COL4 COL5 COL6 COL7
1.Defendant ID First Name Last Name Court Name Ethnicity Date Joined Date Terminated
2 John Doe BBB Asian 01/10/12
2.Service ID Service Description Start Date End Date
3 Treatment 01/10/12 15/10/12
6 Treatment 16/10/12
3.Event ID Related Service ID Start Date End date Notes
5 2 03/10/12
4.Event ID Start Date End date Notes
4 02/10/12
8 12/10/12
1.Defendant ID First Name Last Name Court Name Ethnicity Date Joined Date Terminated
1 Joe Bloggs AAA European 22/09/12
2.Service ID Service Description Start Date End Date
4 Housing
3.Event ID Related Service ID Start Date End date Notes
7 4 23/09/12
4.Event ID Start Date End date Notes
6 22/09/12 23/09/12
1.Defendant ID First Name Last Name Court Name Ethnicity Date Joined Date Terminated
3 Minnie Mouse BBB Latin America 05/10/12
2.Service ID Service Description Start Date End Date
3.Event ID Related Service ID Start Date End date Notes
4.Event ID Start Date End date Notes
23 rows selected Is it possible in SQL to display it like this
COL1 COL2 COL3 COL4 COL5 COL6 COL7
1.Defendant ID First Name Last Name Court Name Ethnicity Date Joined Date Terminated
2 John Doe BBB Asian 01/10/12
2.Service ID Service Description Start Date End Date
3 Treatment 01/10/12 15/10/12
6 Treatment 16/10/12
3.Event ID Related Service ID Start Date End date Notes
5 2 03/10/12
4.Event ID Start Date End date Notes
4 02/10/12
8 12/10/12
1.Defendant ID First Name Last Name Court Name Ethnicity Date Joined Date Terminated
1 Joe Bloggs AAA European 22/09/12
2.Service ID Service Description Start Date End Date
4 Housing
3.Event ID Related Service ID Start Date End date Notes
7 4 23/09/12
4.Event ID Start Date End date Notes
6 22/09/12 23/09/12
1.Defendant ID First Name Last Name Court Name Ethnicity Date Joined Date Terminated
3 Minnie Mouse BBB Latin America 05/10/12
2.Service ID Service Description Start Date End Date
No Service Found
3.Event ID Related Service ID Start Date End date Notes
No Event Found
4.Event ID Start Date End date Notes
No Event FoundOr just a 'No data found' would do. I am thinking about create a dummy table which contains only one row with text "There is no data found". And so the outer join with the result, but I still cannot work out how to integrate with the condition in your select statement.
I really appreciate your help. -
SQL Reporting Services install
I've installed 2 SCOM 2012 management servers. I now need to install SQL reporting services. Can I install this on a seperate server (not the management server or the SQL server where the database will be)?
I asked the SQL team if i could install SQL reporting services on the SQL servers where all the databases are held and they don't want this done so need to install on a seperate box but can't find any notes what says this is possibleHi,
SCOM reporting server role should be installed on a SQL server where SQL reporting services is installed.
Please also refer to the article below:
How to Install the Operations Manager Reporting Server
https://technet.microsoft.com/en-us/library/hh298611.aspx
Regards,
Yan Li
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
[Interface] - Passing variety parameters/input to PL/SQL report
Hi,
I've the PL/SQL report which can allow passing in the parameter, i use '&'.
the report is given to the end user who do not have the IDE for PL/SQL. the machanism of the report is generated into the spool file and import into excel format.
now i am wondering how to create a tool using SQL or PL/SQL to allow the end user to choose the parameter(s) dynamically and passing into the PL/SQL to generate the report based on the input selected.
the parameters like below:
package code :
week no :
year :
department :
all the above parameters, the data would be selected from the existing lookup table. the user is allow to select more than 1 input for specified parameter for instance i want to spool report for week 1 until week 5.
pls advise any solution on this topic. thankshi scoot,
thank for reply.
yep, i'm using sql*plus and also sql navigator 4.0 .
the user don't have the software to interact. i'm thinking of build an simple interface using VB and passing in the parameter then initiate the sql*plus to run the program in background mode.
but if you have any other solution which not need to use other software to wirte such program , pls let me know immediately. thank -
SQL Report--NEED to display HYPERLINK
Hi. I need to display a hyperlink for one of the columns in a SQL Report. Here are my columns url, name, type.
I want the name column to be hyperlinks to the corresponding entry in the url column.
Here's the sql that I was trying to get to work based on what someone else helped me with:
select type, ''| |name| |''web
from interop.links
Here is the results when I run the report:
<#''.LABEL#>
<#''.FIELD#>
<#''.FIELD#>
<#''.FIELD#>
<#''.FIELD#>
<#''.FIELD#> ...etc, etc.
Does anyone have suggestions for what I am doing wrong or another solution? I really need to figure out how to do this. Thanks!
Michelle
nullHi,
Here is what I understand from your question.
You have 3 columns
URL
NAME
TYPE
Say you have url=> www[dot]oracle[dot]com
name=>Uncle Larry is always right
you want name to have a href which points to
the value in column url
so you need
select url as the_url,''| |name| |'' as the_name,type from the table
null -
How to compare two tables data...need sql report or utility to find differe
Hi,
We have a requirement where we are asked to find data differences between two tables and one of the tables reside on remote database. The database version is same ( 10g ) and datatypes for the tables are similar.
The client is looking for a sql report or kind of utility to display the data differences for each column ( if possible count differences ) with some meaningful error messages.
Could anyone let me know the best possible way of doing it..?
Thanks
HitarthHi,
I found something for tables comparison but getting one error...can you check this please and let me know what is wrong
Here is the function:
CREATE OR REPLACE FUNCTION compare_query_results (
p_query1 IN VARCHAR2
, p_query2 IN VARCHAR2
, p_raise_error_if_not_equal IN BOOLEAN DEFAULT FALSE
, p_raise_error_if_no_rows IN BOOLEAN DEFAULT FALSE
RETURN NUMBER
IS
-- Constants
c_query_results_equal CONSTANT PLS_INTEGER := 0;
c_query_results_not_equal CONSTANT PLS_INTEGER := 1;
oracr CONSTANT VARCHAR2 (1) := CHR (10);
-- Variable Declaration
v_sql_stmt VARCHAR2 (32767);
v_record_count PLS_INTEGER;
v_return_code PLS_INTEGER;
v_record DUAL.dummy%TYPE;
v_result_set_has_rows BOOLEAN;
-- Ref Cursors
v_cursor sys_refcursor;
-- Custom Defined-Exceptions
result_sets_do_not_match EXCEPTION;
query_returns_no_rows EXCEPTION;
BEGIN
-- Get the count of differing records between p_query1 and p_query2
dbms_output.put_line('Start-1');
v_sql_stmt :=
' (SELECT /*+ materialize */'
|| SUBSTR (p_query1, INSTR (UPPER (p_query1)
, 'SELECT'
, 1
, 1
) + 6)
|| ')
, (SELECT /*+ materialize */'
|| SUBSTR (p_query2, INSTR (UPPER (p_query2)
, 'SELECT'
, 1
, 1
) + 6)
|| ')
SELECT ''X''
FROM (
(SELECT * FROM test1 MINUS SELECT * FROM test2)
UNION ALL
(SELECT * FROM test2 MINUS SELECT * FROM test1)
dbms_output.put_line('Start-2');
OPEN v_cursor
FOR v_sql_stmt;
dbms_output.put_line('Start-3');
FETCH v_cursor
INTO v_record;
dbms_output.put_line('Start-4');
v_result_set_has_rows := v_cursor%FOUND;
dbms_output.put_line('Start-5');
CLOSE v_cursor;
dbms_output.put_line('Start-6');
-- If there are rows - the result sets do NOT match...
IF v_result_set_has_rows
THEN
v_return_code := c_query_results_not_equal;
IF p_raise_error_if_not_equal
THEN
RAISE result_sets_do_not_match;
END IF;
-- If there are no rows - the result sets do match...
ELSIF NOT v_result_set_has_rows
THEN
IF p_raise_error_if_no_rows
THEN
-- Check to make sure that the queries contain rows if desired...
v_sql_stmt := 'SELECT ''X''
FROM (' || oracr || p_query1 || oracr || ')';
OPEN v_cursor
FOR v_sql_stmt;
FETCH v_cursor
INTO v_record;
IF v_cursor%NOTFOUND
THEN
CLOSE v_cursor;
RAISE query_returns_no_rows;
END IF;
CLOSE v_cursor;
END IF;
v_return_code := c_query_results_equal;
END IF;
RETURN v_return_code;
EXCEPTION
WHEN result_sets_do_not_match
THEN
raise_application_error (-20101, 'The Queries'' result sets do NOT match. Error returned
as requested.');
WHEN query_returns_no_rows
THEN
raise_application_error (-20102, 'The Queries'' result sets match, however they contain no
rows. Error returned as requested.');
WHEN OTHERS
THEN
-- Raise the error
raise_application_error (-20103
, 'There is a syntax or semantical error in one or both queries
preventing comparison.'
|| oracr
|| 'Error Stack :'
|| oracr
|| DBMS_UTILITY.format_error_stack ()
|| oracr
|| 'Error_Backtrace:'
|| oracr
|| DBMS_UTILITY.format_error_backtrace ());
END compare_query_results;
I have created two tables ( test1 and test2 ) with few columns and with the same datatypes and executed the above function...I am getting error as folliowing:
DECLARE
ERROR at line 1:
ORA-20103: There is a syntax or semantical error in one or both queries
preventing comparison.
Error Stack :
ORA-00900: invalid SQL statement
Error_Backtrace:
ORA-06512: at "ORAOWNER.COMPARE_QUERY_RESULTS", line 53
ORA-06512: at "ORAOWNER.COMPARE_QUERY_RESULTS", line 121
ORA-06512: at line 12
Could someone please help me fixing this error..It would be really appreciated
Thanks
Hitarth -
Currently, my SharePoint 2013 Farm has Workflows 2013 and SQL Report Services installed on app servers, along with other applications. Workflows 2013 isn't working correctly (installed prior to my coming on board with the organization), I'm assuming it
is a configuration issue, but rather than re-configure, I've read that is recommended to be a standalone server. It was also recommended by a MSFT rep that our report services have its own independent server. Currently, Report Services is also installed on
an app server that runs other applications on the farm.
Has anyone had any experience with installing Workflows 2013 and/or SQL Report Services on independent vs. existing application servers?
Additionally, my existing application servers have 24 GB of RAM (I believe the recommendation for SharePoint production environments is 12 GB), should I plan for the potentially new servers (Workflows and Report Services) to also have 24 GB of RAM? Not really
sure if it will be needed if they have dedicated tasks.
Thanks for any input you can provide!It entirely depends on load. WFM will work just fine installed on servers in the SharePoint farm. SSRS preferably should go on the end-user facing servers for better performance.
The questions you're asking are all "it depends" :)
Trevor Seward
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
Use XML as data input for Crystal Report for Eclipse
Hi,
I am completely new to crystal report and please kindly forgive me if I ask some stupid questions.
Actually, I have searched the forum for the topic and found some related threads, but I still want to
have some responses from crystal report experts on this issue.
Our developer tool is IBM RAD 7.0 and it has crystal reports tools installed in it. I want to use
crystal report to solve one of our business solutions. I have the following questions about the
feasbility of this solution:
(1). I need to specify data at runtime during report generation. I think using fixed data source
(for example, SQL query or Stored Procedure) may not fit our needs. I think if crystal report
can accept XML as input to generate reports at runtime, then it will be perfect. Can CR
use XML as data source as input?
(2). Actually, one of our business requirements is to generate a letter. Can CR do a report
layout such that a letter format can be achieved? If yes, would you let me know the
report layout name?
(3). We need to export the report into PDF format, I know CR can do PDF output. But can
CR be controlled to export this into bytes stream? Or the PDF must be saved into a
physical file?
(4) If I need to learn more about CR, which book will you recommend?
Thanks in advance for your advice,
RaymondThanks for the help Ted
Works like a charm now.
Or atleast my very very simple XML report works.
Now I just need to play around and see what I can do and what I cant.
I just want to make sure I understand how this works.
1) I start of with a XML file (or URL or other data source as explained in your BLOG)
2) I then have to create blank report which will have its data source set to my XML file.
This report (rpt file) will always have its data source set to the original XML location
Can this be dynamically changed, or does a new rpt file need to be created each time
(or atleast I will have to re-run "CreateXMLInlineSchemaReport" from your BLOG)
3) I can now use this rpt file as I would any other rpt file but its data source will be the original XML file
- If I update or change the XML file, the report will dynamically reflect these changes.
4) To change the data source, I need to recreate a new rpt file as per point 2. Which will now be blank.
5) Filtering.... if I want to filter the XML data do I use normal parameters. If I want to filter the data before
I pull it do I need to change anything. In otherwords if I have a XML file with 1000 records, but I only want say
5 of them, how do I only pull those 5 without first pulling the whole 1000 records. Hope that makes sense.
As I said I am very new to this so some things still fly over my head, but I do play around abit so hopefully
will find what I am looking for.
Cheers
Darren
PS any other links to info on creating and running reports of XML data sources would be greatly appriciated -
Byte Array from SQL Reporting Service
I am calling the Render method of the Microsoft SQL Reporting
Service's ReportExecution web service. It returns a Byte array in
the lastResult object. I am having the hardest time figuring out a
way to convert that byte array into something I can use in Flex.
The byte array, once converted into a more user friendly format,
will contain the rendered version of a SQL Report in whatever
format I have specified...in this case it is XML. Any input or
suggestions would be appreciated.This is a little late, I know. but I just spent the day
struggling with this very issue. Hopefully this can help someone
else in the future. Here's my solution...
on MX:Operation -- result="fillXML()"
then
private function fillXML(): void {
var x:XML = new
XML(wsProps.GetDatasetData.lastResult.toString());
...do what you need with your xml...
I use an XMLList node of the result as the source property
for an XMLListCollection bound to a datagrid. Let me know if you
need more help to get it working. It works like a charm now that I
figured that out. I don't know if it's a slimy hack, or not, but it
gets the job done. -
Pass Page 0 TextBox item value to populate SQL Report on another page.
Hi,
I have created one textbox and one Template Based Button on page 0.
And i have coded (On Button Display Attributes)
I want to pass Page 0 TextBox value into the SQL Report on Page100.
For this i planed to pass the value entered on Page 0 (TextBox) by coping the entered value into clipboard and assign this value to a hidden textbox(P100_SEARCH), which is on page 100. so that i can pass this value to the SQL Report.
I have coded (On Button Display Attributes) in Page 0.
onclick="javascript:window.clipboardData.setData('Text', document.getElementById('P0_SEARCH').value);redirect('f?p=229:100:&APP_SESSION.::NO:::');"
So its copying the entered value into clipboard and redirecting to page 100.
But here i am facing the problem
how to assign the save clipboard value into Hidden TextBox(P100_SEARCH) on page 100, so that data is
populated on page100 according to the enterd value from page 0.
Please help me . Its urgent.
Thanks
--PMHi,
I think it is the button templates that are causing the problem as they a normally designed to submit the page and you need to do a redirect.
I would suggest doing the following:
1 - Go to Shared Components, Templates
2 - Click Create
3 - Select Button
4 - Select "As a Copy of an Existing Template"
5 - Click Next until you get to a list of existing button templates
6 - Change the name of the "Copy of ..." for the template that you are using (to something like "Button for javascript") and select Yes in Copy?
7 - Click Copy Button Template
8 - When it has been created, you are returned to the templates list - click the edit link for your new button
9 - Update the "Template" setting. How you change this depends on your Theme and the Button Template you are using. But, as an example, in Theme 19 and using the Button button template, change:
<input onclick="#LINK#" class="t19Button" value="#LABEL#" type="button" />to:
<input #BUTTON_ATTRIBUTES# class="t19Button" value="#LABEL#" type="button" />So, the onclick="#LINK#" setting is removed and the #BUTTON_ATTRIBUTES# one is added in instead.
Now, go back to Page 0 and change your button to use this new template.
Change the Button Attributes setting to:
href="javascript:void(0);" onclick="javascript:redirect('f?p=&APP_ID.:100:&SESSION.::NO::P100_SEARCH:' + $v('P0_SEARCH'));"and Apply Changes
Now try your page again
Andy -
How to Convert MM/DD/YYYY to YYYY/MM/DD in SQL Reporting Services
i am having difficulty of converting a parameter field, called @startdate, on sql reporting services report to YYYY/MM/DD format. the parameter @Startdate was set to Data/Time. @Startdate is 6/1/2014 12:00:00 and I want to convert it
to 2014/06/01. I want to compare @Startdate with a column in database called Begindate which is in format of YYYY/MM/DD hh:mm:ss. I tried the followings
select * from Atable where cast(Atable.Begindate as date) >= cast(@Startdate as date)
select * from Atable where cast(Atable.Begindate as date >= cast(convert(datetime, @Startdate) as date)
SQL Reporting Services only gives me Text, Boolean, Date/Time, Integer and Float.
Regards,Hi Elmucho,
Sorry for the delay. I tested with the sample data you provided, however everything works well in-house. Could you please creste a new report and check the result. Here are the steps I performed:
1. Create a table and insert the following data:
Name (varchar(50)) Begindate (datetime, not null)
Lastdate (datetime, not null)
bob
2008-01-01 08:08:08.000 2010-10-10
10:10:10.000
alice
2010-10-10 10:10:10.00 2011-11-11
11:11:11.000
smith
2011-11-11 11:11:11.00 2012-12-12
12:12:12.000
2. Open SQL Server Data Tools, create the data source and add the dataset with the below query:
SELECT Name, Begindate, Lastdate
FROM [tablename ]
WHERE (CAST(Begindate AS date) >= CAST(@Startdate AS date)) AND (CAST(Lastdate AS date) <= CAST(@Enddate AS date))
3. Then, click execute button, it prompts for inputting the parameter value.
@Startdate
6/1/2008
@Enddate
5/1/2014
Enter the date and press OK.
4. Here is the result in the query designer:
Insert a table and fields. Save the report and preview:
Thanks.
Tracy Cai
TechNet Community Support -
Upgrade 2010 to 2013 with SQL Reporting Services
I'm getting ready to upgrade to 2013.
When I run the Test-SPContentDatabase I get:
Category : MissingWebPart
Error : True
UpgradeBlocking : False
Message : WebPart class [ab6d9dad-e23c-ce4f-ff98-f6575a1ccf4c] (class [
Microsoft.ReportingServices.SharePoint.UI.WebParts.ReportView
erWebPart] from assembly
[Microsoft.ReportingServices.SharePoint.UI.WebParts,
Version=10.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91]) is referenced [24] times
in the database [is-sharepoint], but is not installed on the
current farm. Please install any feature/solution which
contains this web part.
Remedy : One or more web parts are referenced in the database
[is-sharepoint], but are not installed on the current farm.
Please install any feature or solution which contains these
web parts.
Locations :
Category : MissingAssembly
Error : True
UpgradeBlocking : False
Message : Assembly
[Microsoft.ReportingServices.SharePoint.UI.ServerPages,
Version=10.50.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91] is referenced in the
database [is-sharepoint], but is not installed on the
current farm. Please install any feature/solution which
contains this assembly.
Remedy : One or more assemblies are referenced in the database
[is-sharepoint], but are not installed on the current farm.
Please install any feature or solution which contains these
assemblies.
Locations :
Category : Configuration
Error : False
UpgradeBlocking : False
Message : The [is.photomask.com] web application is configured with
claims authentication mode however the content database you
are trying to attach is intended to be used against a
windows classic authentication mode.
Remedy : There is an inconsistency between the authentication mode of
target web application and the source web application.
Ensure that the authentication mode setting in upgraded web
application is the same as what you had in previous
SharePoint 2010 web application. Refer to the link
"http://go.microsoft.com/fwlink/?LinkId=236865" for more
information.
Locations :
The first two have to do with reporting services. I'm trying to workout how to go about getting these errors to go away. I don't want to remove SQL reporting or migrate a broken site and fix it later. FYI it does migrate but reporting services
is of course broken.
So what I was wanting to do was to upgrade SQL Reporting Services for SharePoint 2010 from 2008 SQL to 2014 SQL first. This would be in the hopes that it would make the migration to SharePoint 2013 work as the assemblies would change to the proper
version.
Can anyone elaborate on my upgrade path?
I'm still looking up the "Claims Based" authentication thing. I've found an article on how to migrate it so not a big deal. I do wonder however if this is tied to the issue I saw with default.aspx and home.aspx being denied to all users
after I did migrate a content db.
David JenkinsHi David,
The following sections describe the basic steps needed to upgrade or migrate from 2008 versions of Reporting Services SharePoint mode to 2014 version.
SQL Server 2008 R2 to SQL Server 2014
Starting environment: SQL Server 2008 R2, SharePoint 2010.
Ending environment: SQL Server 2014, SharePoint 2010.
In-place upgrade is supported and there is no down time for your SharePoint environment.
Install the SQL Server 2014 version of the Reporting Services add-in for SharePoint on each web front-end in the farm. You can install the add-in by using the SQL Server 2014 installation wizard or by downloading the add-in.
Run SQL Server 2014 installation to upgrade SharePoint mode for each “report server”. The SQL Server installation wizard will install the Reporting Services Service and create a new Service application.
If you also want the ending environment to run SharePoint 2013, you need to complete a database-attach upgrade of the SharePoint 2010 to SharePoint 2013.
For more scenarios information, please refer to:
http://msdn.microsoft.com/en-us/library/ms143747.aspx#bkmk_sharePoint_scenarios
Per the supported combinations of SharePoint and Reported Services Components, I’d recommend you firstly upgrade Reporting Services to 2014, then upgrade SharePoint to 2013.
For more information:
http://msdn.microsoft.com/en-us/library/gg492257.aspx
The link below is the reference for migrating a Reporting Services:
http://msdn.microsoft.com/en-us/library/hh759331.aspx
Regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected] .
Rebecca Tu
TechNet Community Support -
Need Help XML Publisher Report
Hi Friends
I need to generate a report in xml publisher responsibility .
I have create and designed the RTF file using word , And i have genetared an XML file(template )
I have some doubt please clarify by doubts
In RTF template i have some 4columns
For EXample i Give some column name
Invoice Number , Invoice Line Number ,Tax Type ,Tax Code Name etc....
In my RTF I have done like this
I have created two 2 row and 4column
In the 1st row i have all the 4 column heading
In the 2nd row i have done like this
Developer tab> Design mode > In the legacy tool i have selected text Form field
Once i double click the text form field in the default text i have Given C1 Then in the Add help text button i have given <?C_INVOICE_NUMBER?> like this i have done for alls the columns
My RTF design is completed
Now i need load the XML is it?
In the XMl data query i have placed my sql statement
Here my doubt starts
wether all the column in the RTF should be in the XML sql statement ha?
2)In the top of my RTF i need to add date and page No how to add that ?
Thanks In advance
ATHi Friend
Iam saying this is my XML file
<LIST_G_TAX_NAME>
<G_TAX_NAME>
<C_SORT_TAX_NAME>USE TAX</C_SORT_TAX_NAME>
<C_TAX_NAME>Use Tax</C_TAX_NAME>
<C_TAX_RATE>8.25</C_TAX_RATE>
<C_TAX_TYPE>USE</C_TAX_TYPE>
<C_PERIOD_NAME>OCT-11</C_PERIOD_NAME>
<LIST_G_VENDOR>
<G_VENDOR>
<C_SORT_VENDOR_NAME/>
<C_SORT_SITE_CODE/>
<C_VENDOR_ID>851</C_VENDOR_ID>
<C_VENDOR_NAME>ORACLE CORPORATION</C_VENDOR_NAME>
<C_SITE_CODE>CHICAGO</C_SITE_CODE>
<LIST_G_INVOICE>
<G_INVOICE>
<C_INVOICE_DATE>17-OCT-11</C_INVOICE_DATE>
<C_SORT_INVOICE_NUMBER>1308</C_SORT_INVOICE_NUMBER>
<C_INVOICE_ID>350889</C_INVOICE_ID>
<C_INVOICE_NUMBER>1308</C_INVOICE_NUMBER>
<C_INVOICE_LINE_NUMBER>1</C_INVOICE_LINE_NUMBER>
<C_PO_NUMBER>256388</C_PO_NUMBER>
<C_DESCRIPTION>TEST</C_DESCRIPTION>
<C_GL_DATE>17-OCT-11</C_GL_DATE>
<C_INVOICE_LINE_AMOUNT>15</C_INVOICE_LINE_AMOUNT>
<C_CHARGE_ACCOUNT>412.00.6410.7831.1076.1001.00.000.0000</C_CHARGE_ACCOUNT>
<C_LIABILITY_ACCOUNT>412.00.0000.2152.1208.1001.00.000.0000</C_LIABILITY_ACCOUNT>
<C_BATCH_NAME>101711</C_BATCH_NAME>
<C_SITE_CODE2>CHICAGO</C_SITE_CODE2>
<C_INVOICE_AMOUNT>15</C_INVOICE_AMOUNT>
<LIST_G_DIST>
<G_DIST>
<C_INVOICE_TAX_ID>10061</C_INVOICE_TAX_ID>
<C_LINE_TYPE>ITEM</C_LINE_TYPE>
</G_DIST>
</LIST_G_DIST>
<C_TAXABLE_AMOUNT>15</C_TAXABLE_AMOUNT>
<C_TAX_AMOUNT>1.24</C_TAX_AMOUNT>
<C_INVOICE_AMOUNT_DISP> 15.00 </C_INVOICE_AMOUNT_DISP>
<C_TAXABLE_AMOUNT_DISP> 15.00 </C_TAXABLE_AMOUNT_DISP>
<C_TAX_AMOUNT_DISP> 1.24 </C_TAX_AMOUNT_DISP>
</G_INVOICE>
</LIST_G_INVOICE>
<C_INVOICE_SITE_SUM>124.9</C_INVOICE_SITE_SUM>
<C_INVOICE_SITE_SUM_DISP> 124.90 </C_INVOICE_SITE_SUM_DISP>
<C_TAX_SITE_SUM>5.4</C_TAX_SITE_SUM>
<C_TAX_SITE_SUM_DISP> 5.40 </C_TAX_SITE_SUM_DISP>
<C_TAXABLE_SITE_SUM>65.66</C_TAXABLE_SITE_SUM>
<C_TAXABLE_SITE_SUM_DISP> 65.66 </C_TAXABLE_SITE_SUM_DISP>
</G_VENDOR>
</LIST_G_VENDOR>
<C_OLD_VENDOR_ID>0</C_OLD_VENDOR_ID>
<C_INVOICE_SUM>124.9</C_INVOICE_SUM>
<C_INVOICE_SUM_DISP> 124.90 </C_INVOICE_SUM_DISP>
<C_TAX_SUM>5.4</C_TAX_SUM>
<C_TAX_SUM_DISP> 5.40 </C_TAX_SUM_DISP>
<C_TAXABLE_SUM>65.66</C_TAXABLE_SUM>
<C_TAXABLE_SUM_DISP> 65.66 </C_TAXABLE_SUM_DISP>
</G_TAX_NAME>
</LIST_G_TAX_NAME>
And if i need all the column to be displayed in my report
1)Invoice Number
2)Invoice Line Number
3)Tax Type
4)Tax Code Name
5)Tax Rate Percent
6)Supplier Name
7)Description
8)Gl Date
9)Invoive Line Amount
10)Taxable Line Amount
11)Tax Liability
12)Po Number
13)Charge Account
14)Liability Account
Which tag do i need to use fro grouping
For ex
Instead of this <?for-each:G_TAX_NAME?> <?end for-each?>
which one i need to use
Please help
Thanks
AT -
SQL report in 9.2.1 is very slow compared to 7.3
Hi,
I have an sql report which takes only 5 minutes (oracle version 7.3) is taking almost double the time(one or two user accessing the system) with oracle version 9.2.1.
This report sums the total amount grouped by date field using two tables. Data is exported from 7.3 and imported to 9.2. Indexes are same and the explain plan gives the same resultand runs on unix tru64. Other PL sql and proc programs performance is good compared to version 7.3
Any idea why the statement is slow.
Thanks
sreekumarIt seems using F9 is the same as Ctrl+Enter, it just repeats the execution. I tried running "select count(*) from <table>" using a basic connection against a remote 11.2 DB, where the <table> had anywhere from 20K to 60K rows, on both 2.1.0.63 and 3.0.02.31. Regardless of the version, or table size, or repeated execution, all executions ran from 0.062 to 1.4 seconds. Sometimes successive executions run faster, sometimes not. Depends on what the database server and the network are doing.
The <table> cases all happened to have indexes, so Autotrace showed the DB doing an index fast full scan. Even with dropping the index on the 60K table and forcing a table full access, the count(*) came back in under 0.25 sec, so the table needs to be bigger for lack of index to make a difference.
Possibly the database version could be a factor, I haven't tested on 9i or 10g, but then that wouldn't really make much sense for simple counting. You are no doubt aware of the impact that file system or DB buffer caching could have on this type of test. Here is a post from Ask Tom on the same:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:311990400346061304 -
SQL report link to another report
Hello,
I am using Apex 4 and trying to link an sql report with another report. If I were able to use an interactive report I could easily link that to another page, but that would require me to have a primary key. The problem is that I need to link a few tables. So two questions:
1.) Can I link these via an HTML link to my other page? I would have a HTML link in my report that would link via URL parameter passing. So can I use HTML in a report?
2.) What is the syntax for a parameter passing via URL? Here is my link that would be:
a href= f?p=107:40:&APP_SESSION::::P40_NAME:MARK: Are there any other ways to accomplish this?
Thanks,
Mark
Edited by: LondonMark on 23-May-2011 04:18
Edited by: LondonMark on 23-May-2011 04:20I am using Apex 4 and trying to link an sql report with another report. If I were able to use an interactive report I could easily link that to another page
It's easy in standard reports< /a>. (Ignore the "Interactive Report" typo in step 1.)
1.) Can I link these via an HTML link to my other page? I would have a HTML link in my report that would link via URL parameter passing. So can I use HTML in a report?You can, but it's better practice to keep data retrieval and HTML structure separate when possible—in this case by using declarative Column Links.
2.) What is the syntax for a parameter passing via URL?This is also covered in the documentation.
Here is my link that would be: a href= f?p=107:40:&APP_SESSION::::P40_NAME:MARK:
{quote}
That looks to have the order of the parameters correct, but it's missing some syntax:<a href="f?p=107:40:&APP_SESSION.::::P40_NAME:MARK">...</a>
The static text exact substitution method of referencing the value of an APEX item requires a terminating dot ("."): <tt>&APP_SESSION.</tt>
Maybe you are looking for
-
not sure if it can be done in the Crystal report, but still want a help i have one column could show once or multiple times, and i need to count how many records show once, and how many records show multiple time, for example Column1 Column2 win
-
Preview does not work....
I am experiencing 3 strange problems with my iMac. #1) Preview no longer works. When I try and view a JPG or run Preview directly I get an error that says "The application Preview can't be opened." -600. I have copied preview from my second iMac and
-
Filtering/Dropping IPv6 on IPv4-only Devices?
Hi All - Got an interesting requirement that (for something seemingly simple) has been remarkably challenging to locate a solution for... Having a problem with random IPv6 traffic showing up on the enterprise LAN from time to time and freaking out ce
-
No Icon appears in apps when downloading Adobe Air onto Windows 8 computer.
No way to access program. No Icon shows up in apps. Using a Windows 8 computer.
-
Nested aggregate measure definitions are currently not supported
Hi, I created a logical column which is based upon an existing logical column. The column has the formula SUM(existing_logical_column) and I get the following error when I tried to check in the changes "Nested aggregate measure definitions are curren