6i report ref cursor exception no_data_found
I have a simple report with one ref cursor query on a database packaged procedure.
The Data Model function has an exception handler for no_data_found.
The exception sets a local variable in a program unit spec.
A field with a message based on a place holder column does not return.
I am trying to give some message to the user & am not having luck.
Ideas?
Thank you.
You can create a text field with the text "No data found".
This field gets a format trigger
if <your condition for no data found> then
return true;
else
return false;
end;
Similar Messages
-
Ref cursor help in Reports/pl sql
Hello , i am new to this , please help!
From oracle forms, we have a table and one of the columns from that table returns rows and the result are like ( select name, messaging_id, listing_id from dynamic_message group_query) ..I am trying to join this table with other tables based on a group type, based on if it returns 'D' or 'S' to other groups in report.
I am getting the following error when I uncomment the open cursor statemnt
PLS-00455: cursor 'TEMP_GRP_REC_REFCUR' cannot be used in dynamic
SQL OPEN statement
This is what i have so faar:
create or replace PACKAGE grp IS
TYPE grp_rec IS RECORD
(listing_id varchar2(16 ),
messaging_id varchar2(16 ),
name varchar2(256 ) ,
group_number Number);
TYPE grp_rec_refcur is REF CURSOR RETURN grp_rec;
function grprefc(P_group_number NUMBER, P_group_type CHAR) return grp_rec_refcur;
END;
CREATE OR REPLACE PACKAGE BODY grp IS
function grprefc(p_group_number Number )
return grp_rec_refcur
IS
temp_grp_rec_refcur grp.grp_rec_refcur;
v_stmt_str VARCHAR2(2000) := NULL;
v_cov_name listing.name%TYPE := NULL;
v_cov_mid listing.messaging_id%TYPE := NULL;
v_cov_lid listing.listing_id%TYPE := NULL;
v_grpnum message_group.group_number%TYPE := NULL;
BEGIN
v_stmt_str:='SELECT dmgq.resolved_query
INTO v_stmt_str
FROM dynamic_message_group_query dmgq
WHERE dmgq.group_number = p_group_number';
OPEN temp_grp_rec_refcur FOR v_stmt_str;
LOOP
FETCH temp_grp_rec_refcur INTO v_cov_lid , v_cov_mid ,v_cov_name, v_grpnum ;
EXIT WHEN temp_grp_rec_refcur %NOTFOUND;
END Loop;
RETURN temp_grp_rec_refcur;
END;
END;
show errors;
if there are any examples done by someone in reoprts or if you can help me solve the above, i would higghly appreciate it .
Thanks and Good Day!Maybe something like my second example "Dynamic Table in the Second Query with Oracle Reports"
- ref cursor or "simple" query Q1, which has a column "group_type", linked to a ref cursor query Q2.
Ref cursor query Q2 - pseudo code for function:
CREATE OR REPLACE PACKAGE BODY grp IS
FUNCTION A_join_B_or_A_join_C_join_D
(p_group_type CHAR(1), p_group_number NUMBER)
RETURN dynamic_refcur
IS
l_refcur dynamic_refcur;
l_stmt_str VARCHAR2(2000) := NULL;
BEGIN
IF p_group_type = 'S' THEN
-- join A and B
OPEN l_refcur FOR
SELECT ...
FROM A, B
WHERE A.x = B.y;
ELSE -- p_group_type = 'D'
SELECT resolved_query
INTO l_stmt_str
FROM dynamic_message_group_query
WHERE group_number = p_group_number;
-- join A, C and D (= dynamically created SELECT)
OPEN l_refcur FOR
'SELECT ...
FROM A, C, (' || l_stmt_str || ') D
WHERE A.x = C.y
AND A.z = D.t';
END IF;
RETURN l_refcur;
END;
END; Regards,
Zlatko -
How to fetch NO DATA FOUND exception in Ref Cursor.
In my procedure ref cursor is out parameter with returns dataset. in my proceudre
its like...
OPEN pPymtCur FOR
select.....
when I call this procedure from report to get dataset it causes NO DATA FOUND exception.
How to fetch this exception in my oracle procedure so I can get some other data.
Any Idea to do this?
Edited by: Meghna on 17-Jun-2009 22:28Mass25 wrote:
Correct me if I am wrong.
So if I do something as follows in my stored proc, I do not have to check for NO_DATA_FOUND?
OPEN my_CuRSR FOR
SELECT DISTINCT blah blah blahmy_cursr is what I am returning as OUT param in my SP.Correct. At the point you open the cursor, oracle has not attempted any 'fetch' against the data so it won't know if there is any data or no data. that only occurs when a fetch is attempted.
Take a read of this:
[PL/SQL 101 : Understanding Ref Cursors|http://forums.oracle.com/forums/thread.jspa?threadID=886365&tstart=0] -
Hi all.. I have a stored procedure that needs to return a records to Crystal Report.
I'm using an outpur parameter of type cursor.
In the proc, I am selecting the data from a table based on the input criteria and inserting into a GTT table,
if so, retrieve and store in the table and generate and throw output to CR.
if it is not returning any data i should raise exception and throw the related message to CR.
But in my proc even though it wont insert data into table b going inot next statements where it should not go.
create or replace procedure a(a1 varchar2,ref_cur out pkg1.cru)
as
cnt number;
begin
insert into b
(select * from a where a.col=a1);
commit;
open ref_cur for
select a.col from a;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR (-20001, SQLERRM);
WHEN NO_DATA_FOUND THEN
open ref_cur for
select 'No Data Found' col from dual;
end;
1.please suggest wherer to raise exception when "select * from a where a.col=a1" doesn't return any value.
2. Can ref cursor be used in exception block.
if i use condition like
after the insert statement
select count(*) into cnt from b;
if cnt=0 then
raise NO_DATA_FOUND;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR (-20001, SQLERRM);
WHEN NO_DATA_FOUND THEN
open ref_cur for
select 'No Data Found' col from dual;
please suggest any other way to handle
Thanks in advanceFirst and foremost some fundamental things:
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR (-20001, SQLERRM);
WHEN NO_DATA_FOUND THEN
open ref_cur for
select 'No Data Found' col from dual;
end;1. You can not declare WHEN OTHERS before any other EXCEPTION. You can not compile this. Here you have declared WHEN OTHERS first then NO_DATA_FOUND and it is erroneous.
2. This is not the way you want to handle the WHEN OTHERS exception.
WHEN OTHERS_
http://tkyte.blogspot.com/2008/06/when-others-then-null-redux.html
http://tkyte.blogspot.com/2007/03/dreaded-others-then-null-strikes-again.html
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/toc.htm -
Report using ref cursor or dynamic Sql
Hi,
I never create a report using a ref cursor or a dynamic sql. Could any one help me to solve the below issue.
I have 2 tables.
1. Student_Record
2. Student_csv_help
Student_Record the main table where the data is stored.
Student_csv_help will contain the all the column names of the Student_record.
CREATE TABLE Student_CSV_HELP
ENTRY_ID NUMBER,
RAW_NAME VARCHAR2(40 BYTE),
DESC_NAME VARCHAR2(1000 BYTE),
IN_OUTPUT_LIST VARCHAR2(1 BYTE)
SET DEFINE OFF;
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(1, 'S_ID', 'Student ID', 'Y');
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(2, 'S_Name', 'Student Name', 'Y');
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(3, 'S_Join_date', 'Joining Date', 'Y');
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(4, 'S_Address', 'Address', 'Y');
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(5, 'S_Fee', 'Tution Fee', 'N');
commit;
CREATE TABLE Student_record
S_ID NUMBER,
S_Name VARCHAR2(100 BYTE),
S_Join_date date,
S_Address VARCHAR2(360 BYTE),
S_Fee Number
Insert into Student_record
(S_ID, S_Name, S_Join_date, S_Address,S_Fee)
Values
(101, 'john', TO_DATE('12/17/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94777', 2000);
Insert into Student_record
(S_ID, S_Name, S_Join_date, S_Address,S_Fee)
Values
(102, 'arif', TO_DATE('12/18/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94444', 3000);
Insert into Student_record
(S_ID, S_Name, S_Join_date, S_Address,S_Fee)
Values
(103, 'raj', TO_DATE('12/19/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94555', 2500);
Insert into Student_record
(S_ID, S_Name, S_Join_date, S_Address,S_Fee)
Values
(104, 'singh', TO_DATE('12/20/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94666', 2000);
Commit;
Now my requirement is:
I have a form with Student_record data block. When i Click on print Button on this form. It will open another window which has Student_CSV_HELP.DESC_NAME and a check box before this.
The window look like as below:
check_box DESC_NAME+
X S_ID+
-- S_Name+
X S_Join_date+
X S_Address+
-- S_Fee+
X means check box checked.+
-- means check box Unchecked.+
After i selected these check boxes i will send 2 parameters to the report server
1. a string parameter to the report server which has the value 'S_ID,S_Join_date,S_Address' (p_column_name := 'S_ID,S_Join_date,S_Address');
2. the s_id value from the student_record block (p_S_id := '101');
Now my requirement is when i click on run. I need a report like as below:
Student ID : 101+
Joining Date : 12/17/2009 08:00:00+
Address : CA-94777+
This is nothing but the ref cursor should run like as below:
Select S_id from student_record block S_id = :p_S_id;
Select S_Join_date from student_record block S_id = :p_S_id;
Select S_Address from student_record block S_id = :p_S_id;
So, according to my understanding i have to select the columns at the run time. I dont have much knowledge in creating reports using ref cursor or dynamic sql.
So please help me to solve this issue.
Thanks in advance.Plain sql should satisfy your need. Try ....
Select S_id, S_Join_date, S_Address
from student_record
where S_id = :p_S_id -
Dynamic Ref Cursor report in 6i
Hello,
I apologise that this question is so similar to many in this forum, but I haven't found a solution to my problem yet.
I've created a ref cursor query because I need to include a variable p_orgs in my WHERE clause, like so:
where e.org_id in ('||p_orgs||')
I've constructed the report as mentioned on this page:
www.dulcian.com
FAQs - SQL & PL/SQL FAQs - FAQ ID# 5:
"How can you use 'dynamic' ref cursors in Oracle Reports 3.0 / 6i?"
(Thanks to Zlatko Sirotic for the information).
I get a compile error when compiling the package body that holds my ref cursor open statement:
Error 103 Encountered the symbol ''select'' when expecting one of the following:
Select
Is there any way around this problem?
If I was to upgrade to Reports 9i would it work?
Many thanks,
HazelHello,
Just a remark : you don't need to use a Ref Cursor if you just want to use a "dynamic where clause".
You can use a lexical reference :
You can find examples at :
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwwhthow/whatare/dmobj/sq_a_lexical_references.htm
(This page is about Reports 10.1.2 but Lexical references are identical in Reports 6i and Reports 10.1.2)
Regards -
How to open a Ref cursor in Oracle Reports
I have a stored procedure that returns a ref cursor as an output parameter. I want to call this stored procedure in Oracle Reports After Form trigger. I am having trouble with the syntax of the output parameter. Event_record is the name of the cursor.
After Form Trigger
pkg_DEAL_WHITESHEET_CONCERTS.prc_Event_Information(:p_field_6,event_record);
Error: Event_record must be declaredRe-Write the procedure as Package Spec and Body. Declare the REFCursor in the Package Spec. Probably that helps.
-
Cursors are not closed when using Ref Cursor Query in a report ORA-01000
Dear Experts
Oracel database 11g,
developer suite 10.1.2.0.2,
application server 10.1.2.0.2,
Windows xp platform
For a long time, I'm hitting ORA-01000
I have a 2 group report (master and detail) using Ref Cusor query, when this report is run, I found that it opens several cursors (should be only one cursor) for the detail query although it should not, I found that the number of these cursors is equal to the number of master records.
Moreover, after the report is finished, these cursors are not closed, and they are increasing cumulatively each time I run the report, and finally the maximum number of open cursors is exceeded, and thus I get ORA-01000.
I increased the open cursors parameter for the database to an unbeleivable value 30000, but of course it will be exceeded during the session because the cursors are increasing cumulatively.
I Found that this problem is solved when using only one master Ref Cursor Query and create a breake group, the problem is solved also if we use SQL Query instead of Ref Query for the master and detail queries, but for some considerations, I should not use neither breake group nor SQL Query, I have to use REF Cursor queries.
Is this an oracle bug , and how can I overcome ?
Thanks
Edited by: Mostafa Abolaynain on May 6, 2012 9:58 AMThank you Inol for your answer, However
Ref Cursor give me felxibility to control the query, for example see the following query :
function QR_1RefCurDS return DEF_CURSORS.JOURHEAD_REFCUR is
temp_JOURHEAD DEF_CURSORS.JOURHEAD_refcur;
v_from_date DATE;
v_to_date DATE;
V_SERIAL_TYPE number;
begin
SELECT SERIAL_TYPE INTO V_SERIAL_TYPE
FROM ACC_VOUCHER_TYPES
where voucher_type='J'
and IDENT_NO=:IDENT
AND COMP_NO=TO_NUMBER(:COMPANY_NO);
IF :no_date=1 then
IF V_SERIAL_TYPE =1 THEN
open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
FROM JOURHEAD
WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
AND IDENT=:IDENT
AND ((TO_NUMBER(VOCH_NO)=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
OR (TO_NUMBER(VOCH_NO) BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
OR (TO_NUMBER(VOCH_NO)<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))
ORDER BY TO_NUMBER(VOCH_NO);
ELSE
open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
FROM JOURHEAD
WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
AND IDENT=:IDENT
AND ((VOCH_NO=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
OR (VOCH_NO BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
OR (VOCH_NO<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))
ORDER BY VOCH_NO;
END IF;
ELSE
v_from_date:=to_DATE(:from_date);
v_to_date:=to_DATE(:to_date);
IF V_SERIAL_TYPE =1 THEN
open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
FROM JOURHEAD
WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
AND IDENT=:IDENT
AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
OR (:from_date is null and :to_date is null ))
ORDER BY VOCH_DATE,TO_NUMBER(VOCH_NO);
ELSE
open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
FROM JOURHEAD
WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
AND IDENT=:IDENT
AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
OR (:from_date is null and :to_date is null ))
ORDER BY VOCH_DATE,VOCH_NO;
END IF;
END IF;
return temp_JOURHEAD;
end; -
REF Cursor in Reports 3.0.5.8
I have developed a report (REPORTS 3.0.5.8)based on REF Cursor
Query. I Created a local Package and called the function in the
package in the QR_1RefCurDS function. I am able to get the
results when I tried to run from my machine.
The report was compiled, saved and generated and copied the REP
file on to a different machine on the N/W.
But when I tried to access the same report over the network, it
fails giving the following error:
REP-1401: 'beforereport': Fatal PL/SQL error occured.
ORA-06508: PL/SQL: could not find the program unit being called.
Runtime Engine and REP file reside on a single machine and I
access the report in the following format:
//Computer Name/Oracle_Home/Bin/R30RUN32.EXE //Computer
Name/D/ReportName.Rep userid/password@SID
I have been unsuccessful after trying to move the package to the
database(I get a Virtual memory error ! !)
Is there any other way to accomplish the same task(dynamic
changing of the SQL statements) ?? Is LEXICAL Parameters is the
only answer apart from the REF Cursor which does not work ?????
Database:
Oracle Server Release 7.3.4.3.0
Oracle PL/SQL V2.3.4.3.0 Production Release
Reports 3.0.5.8:
Oracle Server Release 7.3.4.0.0
Oracle PL/SQL V2.3.4.0.0 Production Release
Does this make a difference ????
Thanks a bunch...try recompiling the pll <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by kumaran:
I am getting the following error when I try to run a report after upgrading from reports 3.0.5.8 to 3.0.5.12.2 on UNIX.
I am able to successfully generate the rep file.
but I am not able to run it. the report references a library(pll file) and this library is in the reports30_path
ORA-06508: PL/SQL: could not find program unit being called
any suggestions would be greately appreciated
Thanks<HR></BLOCKQUOTE>
null -
Reports On Ref Cursor - Patch download and Installation issue
I have made a dummy report based on ref cursor.
Code
DB
==
create or replace PACKAGE my_cursors IS
type emp_rc_strong is ref cursor return emp%rowtype;
type emp_rc_weak is ref cursor;
function fn_RefCur(p_deptno number) return my_cursors.emp_rc_strong;
END;
create or replace PACKAGE body my_cursors IS
function fn_RefCur(p_deptno number) return my_cursors.emp_rc_strong is
emp_data_strong my_cursors.emp_rc_strong;
emp_data_weak my_cursors.emp_rc_weak;
begin
open emp_data_weak for 'select * from emp where deptno = :1' using p_deptno;
emp_data_strong := emp_data_weak;
return emp_data_strong;
end;
Report Builder
=========
Inside ref_cursor query object
function QR_1RefCurDS return my_cursors.emp_rc_strong is
emp_data_weak my_cursors.emp_rc_weak;
begin
emp_data_strong := my_cursors.fn_RefCur(:p_deptno);
return emp_data_strong;
end;
While running it's giving following error
REP-0065: Virtual Memory System Error
REP-0200: Cannot allocate enough memory cavaa 22
So, when I searched on net, I found
Cause
This is a known Oracle Reports bug for MS Windows Platform.
Bug 5584001 DYNAMIC REF CURSORS DON'T WORK IN VERSION 10.1.2.0.2 REPORTS BUILDER
Solution
To implement the solution, two one-off patches should be applied to
Oracle Reports %ORACLE_HOME% Please execute the following steps:
1. Download the following two one-off patches from Metalink:
One-off Patch 4505133
One-off Patch 5634746
But since I am a home user, so how I can download these patches and test.You can't without metalink access.
-
How to write REF-CURSOR Query in Oracle Reports
Hello Guys!!
I have a form in which you can select regions/divisions/locations etc by the use of check boxes. And the selected values will be inserted into a table, and based on the selected values of the table the report is run.
The issue I have is with the query inside the Oracle reports(attached to this file).
The query works fine until the last two EXISTS conditions.
IF a region exists In the table report_param then it works fine but if there are no divisions in it , then the query returns no values, which is not correct.
Someone has advised me to use a ref-cursor query inside reports tool, which I am not aware off. So, anykind of suggestions or advises are welcome. Please let me know about it as it is very urgent issue for me. Anykind of help would be greatly
appreciated.
Thanks,
Vishal
-------------------------------------------------------Query in Oracle Reports---------------------------------------------------------
select c.key_segment, p.supplier_id,
decode(:in_col_nm, 'BRAND',nvl(p.product_brand,'<Unknown Brand>'), 'PLN',nvl(p.product_legal_name,'<Unknown Legal Name>')) COL_NM,
sum(a.ext_price) sales_dols,
sum(comp_allow_pkg.get_comp_allow_stddiv(a.control_loc_id, a.product_id, a.sold_to_customer_id,
a.doc_dt, a.ext_price, a.units)) cust_reb_dols,
sum(a.units) units,
sum(a.ext_cost) cost_dols
from sales a, key_segment_plns c, product p, rep_wrtr_dw_cust h
where a.doc_dt between :in_start_dt and :in_end_dt
and a.customer_oc = h.control_loc_id
and a.sold_to_customer_id = h.sold_to_cust_id
and a.ship_to_customer_id = h.ship_to_cust_id
and ((:in_dg_cd = 'B' and h.dealer_grower_cd in ('D','G')) or h.dealer_grower_cd = :in_dg_cd)
and a.product_id = p.product_id
and p.product_gl_class_cd = 'CHEM'
and p.product_legal_name = c.product_legal_name
and c.key_segment in ('GLYPHOSATE','PLANT HEALTH/RUST FUNGICIDES','PYRETHROIDS','STROBI FUNGICIDES')--&IN_KEY_SEGMENTS
-- and (:in_oc = 'ALL' or (a.control_loc_id in (select control_loc from control_loc_comb_ocs where control_loc_comb = :in_oc)))
-- SALES DATA FILTERS TO MATCH ACCUM_SALES_DG_MV
and a.sale_type_cd in ('02','08')
and a.document_type_cd in ('I','C','D')
and (substr(a.product_id,-1) in ('0','1') OR nvl(upper(trim(p.product_brand)),'X') = 'TECH FEE')
and a.units <> 0
and a.unit_cost <> 0
and a.unit_price <> 0
-- NEW FILTERS ADDED 9/11/07: LOCATION(BRANCH), BUSINESS TYPE, RSM/ASM/REP
and ((:in_loc = 'ALL') or (nvl(a.warehouse_id,'<blank>') in (SELECT param_value
FROM report_param
WHERE report_id = :IN_REPORT_ID
AND session_id= :IN_SESSION_ID
AND USER_ID = :IN_USER_ID
AND param_name='LOCATION_TYPE')))
and ((:in_uhs_ag = 'ALL') or (:in_uhs_ag = 'NA' and p.product_uhs_ag != 'A') or (p.product_uhs_ag = :in_uhs_ag))
and ((:in_sales_rep = 'ALL') or (nvl(a.territory_id,'<blank>') in (SELECT param_value
FROM report_param
WHERE report_id = :IN_REPORT_ID
AND session_id= :IN_SESSION_ID
AND USER_ID = :IN_USER_ID
AND param_name='SALES_REP_TYPE')))
and EXISTS
(SELECT '1'
FROM locations l, report_param rp
WHERE rp.report_id = :IN_REPORT_ID
AND rp.session_id= :IN_SESSION_ID
AND rp.user_id = :IN_USER_ID
AND rp.param_value = l.region
AND rp.param_name = 'REGION_TYPE'
AND a.warehouse_id = L.ARS_LOCATION)
and EXISTS
(SELECT '1'
FROM locations l, report_param rp
WHERE rp.report_id = :IN_REPORT_ID
AND rp.session_id= :IN_SESSION_ID
AND rp.user_id = :IN_USER_ID
AND rp.param_value = l.region
AND rp.param_name = 'DIVISION_TYPE'
AND a.warehouse_id = L.ARS_LOCATION)
group by c.key_segment, P.supplier_id,
decode(:in_col_nm, 'BRAND',nvl(p.product_brand,'<Unknown Brand>'), 'PLN',nvl(p.product_legal_name,'<Unknown Legal Name>'))Hi,
I need your help to create a report using Ref-Cursor. please see the below thread
Report using ref cursor or dynamic Sql -
Reports 3.0, Ref Cursor from stored procedure
I have a problem trying to use Ref Cursor as datasource (i.e.
Ref Cursor Query) in Reports 3.0
I have created a stored package with a function which returns
Ref Cursor.
That function just opens the cursor and returns it to the
calling module.
Reports recognizes returned cursor - it creates a group for that
query, with all columns, than I built
a layout model - everything is OK on that stage.
During the execution of that report (from previewer or using
Reports Runtime) I got an error message like that:
REP-0065 Virtual Memory System Error
REP-0200 Cannot allocate enough memory cavaa22
Error's description does not correspond the reality :) - there
is enough virtual & physical memory according to
Task Manager information.
So, that does not work when this package is stored one.
When I create the package on the client side - in Reports -
everything works just fine.
Cursor is opened with a very simple query, selecting records
from the very simple table having only one record.
There is no code written which closes that cursor or fetches the
records.
Client platform: WinNT 4.0 SP3
Oracle Reports: 3.0.5.8.0
Oracle Server: Oracle8 8.0.5.0.0 (and I tried also on Oracle7
7.3.4.3.0)
Thanx.
nullSara,
GTT (Global Temporary Tables) in Oracle work a different way compared to SQL Server and Informix. There you can create temporary tables on the fly and drop them on the fly.
Here you should (note, you don't have to, but, best practice says that you should) create the table using the syntax...
create global temporary table.....
Once you create it, even though it looks like persistent table, it's not. It will have it's own individual data PER SESSION . You have two types of GTTs:
ON COMMIT PRESERVE ROWS and ON COMMIT DELETE ROWS (they work in slightly different way).
Look up GTTs here:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm#sthref2213
HTH,
Rahul -
Dynamic queries in report builder 6i ( ref cursor query )
Hi everyone,
My requirement is that I want to create a report where the query is dynamic. The dynamic part will be known at runtime as it is being passed via a parameter. My query looks like this :
select * from emp where sal :p1 :p2
Possible values for :p1 are - '>', '<', '>=', '<=', '=', '!='
Possible values for :p2 are - any value entered by the user
I tried creating a query in report builder based on a ref cursor. But it does not allow me to create the query for the ref cursor dynamically. That means I have to hardcode the query in the program.
I tried using place holder columns without success.
Can someone please help me ?
Regards,
AlHi,
You can use lexical paramters in the sql query
x - char - parameter
select * from emp &x
you need to pass the value for x in the parameter as
'where sal < 1234'.
Note : Lexical variable should be of char datatype.
This is an alternative to the ref cursors.
This works. Hope this is clear. -
Converting cursor to ref cursor in Report builder pl/sql
Hi,
I am trying to use dynamic sql in My report 's pl/sql code.
I can not use execute Immediate statement since this feature is not suppoerted at client side and i am doing the coding In my local mchine and running the report loaclly.......???
Another way to use dynamic sql is by using dbms_sql package.
Using dbms_sql to run a sql will give me a normal cursor as an output.
Since in report builder pl/sql only ref cursor is allowed as a return type from a function........the problem i m facing is conversion of the cursor to ref cursor......
in oracle 11g we have a built in function in dbms_sql package that can be used for the conversion....
i m using oracle 10 g where the above mentioned feature is not available............
Please give some way to resolve this issue............!!!!!!!!!!!!
Thanks in Advance.....!!!!!!!
AbhishantYou may use some stored procedures that will take full advantage of dynamic SQL. Make a stored proc that inserts rows in a global temporary table. You will call that stored proc in the afterpform trigger. And you will have the report querry select from the temporary table populated by the stored proc.
I did some things like that.
HTH -
Hi All
we are planning to create a D2K report using
ref cursor the problem for me is that i want to know
whether it is feasible for creating a report which
contains around 5 complicated queries and number of
formula columns etc.can you please give me points
how to go about or if it is not feasible can you
give me the reasons for that.Hello,
Ref Cursor queries are useful in sharing queries across reports, and exploiting commonality between them. You can segregate your individual queries into ref cursors and combine them in your data model. You can also create formula columns based on data fetched by the ref cursor, since Reports treats any data fetched from the data source in a generic manner.
Please take a look at the 'Building a Paper Report with Ref Cursors' section of the 'Building Reports' manual on OTN at http://otn.oracle.com/products/reports/htdocs/getstart/docs/B10310_01/orbr_refcur.htm#1009556 for further details on building and using ref cursor reports.
Thanks,
The Oracle Reports Team.
Maybe you are looking for
-
Transfering Adobe Acrobat 9 Pro to a new hard drive
I had to change hard drives and now need to re-install all my application programs. I was able to download Acrobat 9 Pro, but my licensed copy has now turned in to a 30 day trial and I don't know how to get a permanent licensed version. When I call
-
Rollovers work in iweb - but not online
I have created a website in iweb with several hyperlinks just by highlighting a line of text and making it a link. The normal,rollover and visited colors work fine in iweb. However, once I go online to see my page the rollover color does not show whe
-
Trouble rebooting, PRAM didn't work nor fire wire
I have tried rebooting using the PRAM method and connecting a fire wire from my laptop to my desktop with no luck. when I push the button in back, I get the Apple logo and the gear keeps spinning. anything else I can do? thx deb
-
Hi, I have designed a layout in WAD which has periods in the columns. When i move from page 1 to 2 of the template the last 4 columns of the first page are rolling over the second and the same is happening from page 2 to 3 and so on. Are there any se
-
File Content Conversion - Header
Hi, I need to produce an pipe delimited file. The only problem is that that column fields would need to be differentiated with an hypen. A typical file format is NAME ADDRESS AGE ONE 134,DSTREET 27 TWO 222,SSTREET 28 How do i specify the two lines o