REF Cursor to be called via Reports 6i to display data
Hello Sir/Madam,
I'm new to REF Cursor, so I would appriciate your help..
My requirements are to display records higher then nine records for a given facilityID from the REGSTATVLVS table sorted by vlv_nbr (field)
So far, I have Icreated a package and when I execute this package it is prompting
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'LSTVLV_REFCUR'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Note: I can display the data using "rownum", but that is not allowing me to sort it by valve#..
Sorry for redundancy for redency
CREATE OR REPLACE package GFS_ADMIN.vlvlst is
type v_cursor is REF CURSOR return REGSTATVLVS%rowtype;
PROCEDURE lstvlv_refcur(vlvno OUT v_cursor);
end;
CREATE OR REPLACE package body vlvlst is
PROCEDURE lstvlv_refcur(vlvno OUT v_cursor) IS
vlv_num varchar2(1000);
cursor vlv_cur is
select vlv_nbr
from REGSTATVLVS r
where r.fclty_seq_nbr = 83
order by vlv_nbr;
vlv_rcd vlv_cur%rowtype;
begin
if not vlv_cur%isopen then
open vlv_cur;
end if;
<<i_loop>> for i in 1..40 loop
fetch vlv_cur into vlv_rcd;
EXIT WHEN vlv_cur%NOTFOUND;
if ( i <= 9 ) then
vlv_num := vlv_rcd.vlv_nbr;
dbms_output.put_line(vlv_num);
-- dbms_output.put_line(vlv_rcd.vlv_nbr);
end if;
end loop;
end;
end;
variable v1 varchar2(6);
set serveroutput on
set autoprint on
execute vlvlst.lstvlv_refcur(:v1);
Regards,
Vani
Hello InoL,
REF Cursor is working better if it is a Navigator, Toad or SQLPlus.. but it is prompting all sort of errors when it is used within Reports 6i.. Here is what i was trying to achieve..
The purpose of "REF Cursor" is to retrieve multiple parameter values .. ( at least that is what GOOGLE results were about REF Cursor )..
At the same time, a function does not return more then one value and I'm not sure if Reports will allow to use a stored procedure. So, I started to use REF Cursor
"lstvlv_refcur(vlvno OUT v_cursor )" I'm trying to retrieve as I mentioned 9 valve records to one report and remaining valve records to 2nd report, which I'm calling it via SRW reports built-in package..
Here is the latest and greatest code on my REF Cursor..
1) created "global temporary table" one time..
2) within Reports added this package ( as a program unit )
package vlvlst_chk is
type vlvlst_rcd is RECORD
( fctly_seq_nbr number,
vlv_nbr varchar2(6));
type vlvno_refcur is REF CURSOR return vlvlst_rcd;
end;
3) then added a function called QR_1RefCurDS ( as a program unit )
function QR_1RefCurDS return vlvlst_chk.vlvno_refcur is
hld_vlvlst vlvlst_chk.vlvno_refcur;
fctno INTEGER;
vno varchar2(6);
begin
delete from fct_vlv_hold;
commit;
delete from fct_vlv_hold2;
commit;
open hld_vlvlst for
select r.fclty_seq_nbr,r.vlv_nbr
from REGSTATVLVS r
where r.fclty_seq_nbr = :p_2
order by vlv_nbr;
for i in 1..40 loop
fetch hld_vlvlst into fctno, vno;
exit when hld_vlvlst%notfound;
if i <= 9 then
insert into fct_vlv_hold
values(fctno, vno);
commit;
-- return hld_vlvlst;
elsif (i>9 and i<= 40) then
insert into fct_vlv_hold2
values(fctno, vno);
commit;
-- return hld_vlvlst;
else
return hld_vlvlst;
end if;
end loop;
close hld_vlvlst;
return hld_vlvlst;
end;
Here: prompts "REP-0065/REP-0200" error, but writes records to temp tables..
Question is why is it prompting this error?
Edited by: user11141511 on Jan 24, 2012 1:25 PM
Edited by: user11141511 on Jan 24, 2012 1:27 PM
Similar Messages
-
I have a crystal XI report that when run will not display data; if the report should be six pages that is the number of pages that will be generated. The problem is that the pages show up as blank. If the blank pages are exported the exported file will contain data, if the report is sent to a printer the report will contain data, but no data is ever displayed on the screen. This report has been loaded on 15 other computer and runs perfectly. Any help would be greatly appreciated. By the way if this user logs in remotely and runs this report it will display data.
A few ideas;
1) Make sure you are working with [SP 6|https://smpdl.sap-ag.de/~sapidp/012002523100015859952009E/crxir2win_sp6.exe].
You are on SP 2...
[SP6 msm|https://smpdl.sap-ag.de/~sapidp/012002523100000634032010E/crxir2sp6_rdc_mm.zip]
2) Try different resolutions
3) Try to see if there is an updated video driver
4) Make sure there is a default printer driver installed.
5) Run [Modules|https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip] see if there are any differences in dlls loading on a box that works and the one that does not (CR and non CR dlls).
Ludek
Edited by: Ludek Uher on Feb 22, 2010 10:32 AM -
Function Module Call Via CMOD Logic for Master Data Enhancement
Hi Friends Please help me to resolve this, would really be very kind of all of you.
Requirement. I want to Enhance the field ZFACTREG from VIBDBE table in my datasource 0busentity_attr extract structure l_s_REIS_BUSENTITY_ATTR, I want to create the logic in CMOD exit_saplrsap_002 to call my function module for enhancement of master data. Please help me Step by Step
Thanks
Poonam Roy
<b>Step #1</b>
I put this code which gives me error in CMOD like this
ERROR : Das formale Argument 'OTHERS' muss am Schluss der Ausnahmeliste stehen.
ABAP Code#1 IN exit_saplrsap_002
DATA: l_d_fmname(30) TYPE c.
CONCATENATE 'Z_DS_' i_datasource(25) INTO l_d_fmname.
TRY.
CALL FUNCTION l_d_fmname
EXPORTING
I_DATASOURCE = I_DATASOURCE
I_UPDMODE = I_UPDMODE
TABLES
I_T_SELECT = I_T_SELECT
I_T_FIELDS = I_T_FIELDS
I_T_DATA = I_T_DATA
C_T_MESSAGES = C_T_MESSAGES
EXCEPTIONS
RSAP_CUSTOMER_EXIT_ERROR = 1
OTHERS = 2
IF FOUND.
IF SY-SUBRC <> 0.
RASIE RSAP_CUSTOMER_EXIT_ERROR.
END IF
CATCH CX_SY_DYN_CALL_ILLEGAL_FUNC.
ENDTRY.
<b>Step#2</b>
I simple created the Function module Z_DS_BUSINESS
and put the code in source code which gives me error . what should i put in other tabs like"Import", Export", Tables" i kept blank
ABAP CODE give me error : The Dictionary structure or table "FIELD-SYMBOLS" is either not active. i have to remove include in the FM. WHY SO??
FUNCTION Z_DS_BUSINENSS
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_DATASOURCE) TYPE RSAOT_OLTPSOURCE
*" VALUE(I_CHABASNM) TYPE SBIWA_S_INTERFACE-CHABASNM
*" VALUE(I_UPDMODE) TYPE SBIWA_S_INTERFACE-UPDMODE
*" TABLES
*" I_T_SELECT TYPE SBIWA_T_SELECT
*" I_T_FIELDS TYPE SBIWA_T_FIELDS
*" I_T_DATA
*" C_T_MESSAGES STRUCTURE BALMI OPTIONAL
*" EXCEPTIONS
*" RSAP_CUSTOMER_EXIT_ERROR
INCLUDE ZXRSAU02.
WRITE: / 'INSIDE THE Z_DS_MEASUREMENTS PROGRAM'.
TABLES: REIS_BUSENTITY_ATTR,
VIBDBE,
field-symbols:.<fs_REIS_BUSENTITY_ATTR> like REIS_BUSENTITY_ATTR.
DATA: BEGIN OF i_c_t_data OCCURS 0.
include structure REIS_BUSENTITY_ATTR.
DATA END OF i_c_t_data.
DATA: i_c_t_data_copy like i_c_t_data OCCURS 0 WITH HEADER LINE,
begin of i_vibdbe occurs 0,
INTRENO like vibdbe-INTRENO,
ZFACTREG like vibdbe-ZFACTREG,
end of i_vibdbe.
i_c_t_data_copy[] = i_c_t_data[] = c_t_data[].
sort i_c_t_data_copy by vibdbe.
Select INTRENO
into table i_VIBDBE from VIBDBE
for all entries in i_c_t_data_copy
where INTRENO = i_c_t_data_copy- INTRENO.
if sy-subrc = 0.
sort i_VIBDBE by INTRENO.
loop at i_c_t_data assigning <fs_REIS_BUSENTITY_ATTR>.
clear: i_VIBDBE.
read table i_VIBDBE with key INTRENO = <fs_REIS_BUSENTITY_ATTR>-INTRENO
BINARY SEARCH
transporting ZFACTREG .
if sy-subrc = 0.
<fs_REIS_BUSENTITY_ATTR>-ZZFACTORY = i_vibebe-ZFACTREG
endif.
null(I leave office until Monday morning, Europe time)
in include from customer-exit ZXRSAU01, etc.
CASE I_DATASOURCE.
WHEN '0CUSTOMER_ATTR'.
PERFORM 0customer_attr changing i_t_data...
ENDCASE.
In each perform, doing what you wrote ; select (needed fields) from complementary-database-table into an internal table with a for all entries. sort the table. LOOP and MODIFY on i_t_data.
In some case i had to insert lines of i_t_data to an internal table of DS_structure when entering subroutine and back at exit. (on 4.6C PI 2003 if i remember)
Some optimization done when reading small tables (T001 society and the same, these are filled once and not for each packet of data.
Your idea of creating different FM is of interest, but the cost of passing i_t_data between two programs (two function groups) may overcome the gain of performance. In a job only one DataSource is processed so only one routine is actually called.
Regards. -
Report does not display data in Oracle Applications
I created a custom report and registered the same under Oracle Order Entry. The report uses 1 parameter and whereas everything is registered in Oracle apps. correctly, the report draws a blank upon completion. The only visible thing is the header part.
This report though works fine if run directly from Reports Designer.
Anybody know what specific setting (if required) needs to be made in Oracle Applications? Further in order that you can know the picture, whatever is enclosed in the Repeating Frame does not show up in App. but as pointed earlier works just fine from Reports Designer.
Any help would be greatly appreciated.I am using a browser (FireFox v2) based InfoView so I guess it is the DHTML viewer.
On the server it is java (Tomcat). The report uses a custom driver (crdb_ado).
Currently all the servers (RAS, page, cache etc) are running under LocalSystem account. I don't understand what a domain account is, is it administrator?
The interesting part is, I was able to upload and run 8 other reports before I experienced this problem. Have I hit some limit?
I appreciate your help. Please share any other ideas/insights on this issue.
Regards -
Report Does Not Display Data from Non-BCS Cube
Hi,
I have the following scenario.
I have a MultiProvider with two real-time cubes. Cube A is used to store Actual data and Cube B is used to store Budget data.
Cube A is used by BCS, so the real-time load behavior is set to "Real-Time Data Target Can Be Planned; Data Loading Not Alllowed".
Cube B is not used by BCS, so data is being loaded using BW InfoPackages, with real-time behavior set to "Re-Time Data Target Can Be Loaded With Data; Planning Not Allowed"
My BCS has two Consolidation Group hierarchy. One is for Legal reporting and another one is for Business Segment reporting. So, if I have a Consolidation Unit, COMPANY1, it would belong both hierarchies, e.g. LEGAL1 and BSEG1.
In my query, I have no problem displaying Actual data when I specified Reporting Mode (0BCS_REPMOD) = Standard. (S). However, Budget data does not get displayed. FYI, I have uploaded data twice for each record i.e. LEGAL1 and BSEG1 in the Cons Group (0SEM_CGCOMP) characteristic.
Any idea on how can I get the budget data displayed?
Thanks.Hi,
Have you Identified Characteristics and Selected Key Figures:
http://help.sap.com/erp2005_ehp_04/helpdata/EN/cf/bc734190ba137de10000000a155106/frameset.htm
Without proper construction of multiprovider you'll not be able to see both cubes. -
Published report is not displaying data
I created a new report in Crystal Report XI. In designer view itu2019s running fine but when I published through Central Management Console, Itu2019s not showing any data. So could you please tell me where the problem is? Or what should I do?
check whether someone has set the
PERSONALIZATION OF VARIABLE on.
REFRESH the query.
In the pop-up screen check PERSONALIZATION OF VARIABLE.
This is the small face on the left hand side of the variable. Maybe this is set to a constant value in case of tha date variable.
click on the face icon to find it out.
MG. -
Can xcelsius use crystal report instance to display data?
HI experts,
Here we use live office with crystal reports to feed data to xcelsius flash. We schedule the crystal reports every day, and want to use data of the crystal report instance when user open a xcelsius flash.
Can this be realized ?
thanks a lot !Hi Sam,
You can do this. Go to Live office and goto to the "Properties for all objects" and select the refresh tab.
Select the option as "Latest Instance" for refresh option and then save the Excel sheet and re-import into Xcelsius.
This would refresh the data from the latest instance of Crystal report.
Thanks,
Amit. -
How to give ref cursor in VB procedure call
This is my Oracle Sp
CREATE OR REPLACE PROCEDURE CRD_DMAN.infy_usp_trades_by_broker_bkr
** Procedure name: CRD_DMAN.USP_TRADES_BY_BROKER
** Author's name: Infosys
** Date written: 04/11/07
** Description: Compliance Trade by Borker
** Maintenance history:
** Date Chg req# Name Remarks
** 04/11/07 Infosys Created
p_ordercursor IN OUT infy_pkg_compliance_transact.cur_compliancetrade,
p_startdate IN VARCHAR,
p_enddate IN VARCHAR,
p_fundcode IN cs_fund_config.parent_acct_cd%TYPE,
p_clientcode IN ts_order_alloc.acct_cd%TYPE,
p_brokercode IN ts_order_alloc.exec_broker%TYPE,
p_reportname IN report_log.report_name%TYPE,
p_callingapplication IN report_log.calling_application%TYPE,
p_callinguser IN report_log.calling_user%TYPE
IS
--Declaring Local Variables
v_owner VARCHAR2 (30);
v_startdate VARCHAR2 (10);
v_enddate VARCHAR2 (10);
v_rowcount NUMBER:=0;
v_logrec base_util_pkg.crd_log_record;
exp_error EXCEPTION;
v_fundcodevalue NUMBER;
BEGIN
BEGIN
/*checking if the start date and end date are null and
assigning the sysdate accordingly*/
IF (TRIM(p_startdate) IS NULL )
THEN
v_startdate := TO_CHAR (SYSDATE, 'mm/dd/yy');
ELSE
v_startdate := p_startdate;
END IF;
IF (TRIM(p_enddate) IS NULL )
THEN
v_enddate := TO_CHAR (SYSDATE, 'mm/dd/yy');
ELSE
v_enddate := p_enddate;
END IF;
/*checking if fund code is null and assigning value accordingly*/
IF TRIM (p_fundcode) IS NULL
THEN
v_fundcodevalue := 0;
ELSE
v_fundcodevalue := 1;
END IF;
/*checking if the reportname or calling user or calling
application name*/
IF (p_reportname IS NULL OR p_callinguser IS NULL
OR p_callingapplication IS NULL)
THEN
RAISE exp_error;
END IF;
END;
--opening and fetching the data into cursor
v_logrec.start_time := SYSDATE;
BEGIN
OPEN p_ordercursor
FOR
SELECT
oa.exec_broker EXEC_BROKER_CODE,
b.bkr_name EXEC_BROKER_NAME,
oa.acct_cd CLIENT_CODE,
f.acct_name CLIENT_NAME,
CASE WHEN (Exists (SELECT 1
FROM cs_fund_broker fb
WHERE rel_typ_cd IN('P','M')
AND oa.exec_broker=fb.BKR_CD
AND oa.acct_cd =fb.acct_cd))
THEN 'Y'
ELSE 'N' END DIRECTED_BROKER,
COUNT ( distinct o.order_id) COUNT_TICKNUM,
MAX (o.trade_date) TRADE_DATE,
SUM (oa.exec_amt) BASE_COST,
SUM (oa.commision_amt) TOTAL_COMMISSION,
(SELECT ab.bkr_typ_cd FROM au_broker ab
WHERE ab.au_change_date =(SELECT TO_TIMESTAMP(MAX(ab.au_change_date))
FROM au_broker ab WHERE b.bkr_typ_cd != ab.bkr_typ_cd AND b.bkr_cd = ab.bkr_cd))
BROKER_HISTORY
FROM
ts_order o
JOIN ts_order_alloc oa ON (o.order_id = oa.order_id)
JOIN cs_broker b ON(oa.exec_broker = b.bkr_cd)
JOIN cs_fund f ON(oa.acct_cd = f.acct_cd)
WHERE
o.status = 'ACCT'
AND oa.exec_broker = CASE WHEN TRIM (p_brokercode) IS NULL
THEN oa.exec_broker
ELSE TRIM(p_brokercode) END
AND oa.acct_cd = CASE WHEN TRIM(p_clientcode) IS NULL
THEN oa.acct_cd
ELSE TRIM(p_clientcode) END
AND ((0 = v_fundcodevalue) OR EXISTS (SELECT 1 FROM crd.cs_fund_config cf
WHERE cf.parent_acct_cd =TRIM (p_fundcode)
AND oa.acct_cd = cf.child_acct_cd))
AND o.trade_date BETWEEN TO_DATE (v_startdate, 'mm/dd/yy')
AND TO_DATE (v_enddate, 'mm/dd/yy')
GROUP BY oa.exec_broker, b.bkr_name ,oa.acct_cd ,f.acct_name,oa.directed_broker,b.bkr_typ_cd,b.bkr_cd;
END;
BEGIN
SELECT
owner
INTO
v_owner
FROM
all_objects
WHERE
object_name = 'INFY_USP_TRADES_BY_BROKER_BKR';
v_logrec.end_time := SYSDATE;
v_logrec.user_code := v_owner;
v_logrec.input_param_values := 'INFY_USP_TRADES_BY_BROKER_BKR,'
|| v_startdate
|| ','
|| v_enddate
|| ','
|| p_fundcode
|| ','
|| p_clientcode
|| ','
|| p_brokercode;
v_logrec.report_name := p_reportname;
v_logrec.object_name := 'INFY_USP_TRADES_BY_BROKER_BKR';
v_logrec.rows_returned := v_rowcount;
v_logrec.calling_application := p_callingapplication;
v_logrec.calling_user := p_callinguser;
END;
BEGIN
--calling the procedure to insert values into the report_log table
COMMIT;
SET TRANSACTION READ WRITE;
base_util_pkg.crd_base_util_proc (v_logrec);
SET TRANSACTION READ ONLY;
END;
EXCEPTION
WHEN exp_error
THEN
DBMS_OUTPUT.put_line ('ERROR');
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('ERROR OCCURED' || SQLCODE);
DBMS_OUTPUT.put_line (SQLERRM);
END infy_usp_trades_by_broker_bkr;
END OF CRD_DMAN.USP_TRADES_BY_BROKER
This is my Pakage from where i am using ref cursor
CREATE OR REPLACE PACKAGE CRD_DMAN.infy_pkg_compliance_transact
AS
** Package name : CRD.INFY_PKG_COMPLIANCE_TRANSACTIONS
** Author's name : Infosys
** Date written : 06/11/07
** Project/System : CRD
** Description : Compliance Trades By Borker Package
** Maintenance history:
** Date Chg req# Name Remarks
** 06/11/07 CRD Infosys Created
--Defining The ComplianceTrade Record DataType
TYPE rec_compliancetrade IS RECORD (
exec_broker_code crd.ts_order_alloc.exec_broker%TYPE,
exec_broker_name crd.cs_broker.bkr_name%TYPE,
client_code crd.ts_order_alloc.acct_cd%TYPE,
client_name crd.cs_fund.acct_name%TYPE,
directed_broker crd.ts_order_alloc.directed_broker%TYPE,
count_ticknum crd.ts_order.order_id%TYPE,
trade_date crd.ts_order.trade_date%TYPE,
base_cost crd.ts_order_alloc.cur_base_mkt_val%TYPE,
total_commission crd.ts_order_alloc.commision_amt%TYPE,
broker_history crd.au_broker.bkr_typ_cd%TYPE
--Declaring a variable of rec_auditdata data type
TYPE cur_compliancetrade IS REF CURSOR
RETURN rec_compliancetrade;
END infy_pkg_compliance_transact;
END OF CRD.INFY_PKG_COMPLIANCE_TRANSACTIONS
How to call this SP from VB code with ref cursor parameter?I'm fairly sure that's not possible, since there's nothing in the ODBC spec to allow for ref cursors. The driver has built in support to check for ref cursors that are returned via a stored procedure call, but there's nothing built into the driver to pass one IN. Since a ref cursor can't be constructed on the client side, you'd have to have some sort of structure that allowed you to reference the ref cursor directly in order to be able to pass one back to the database.
Since you're using VB.NET anyway, the better solution is probably just to use ODP.NET instead, which DOES allow you to reference a ref cursor directly, and there are samples that install with ODP.NET that show you how to do that.
Greg -
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. -
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; -
Need Urgent Help Reports 6i : Ref Cursor
Hi,
I am creating required SQL for report in my Java program. I want to pass this SQL stmt to my Oracle Report.
For that , I am storing the SQL stmt in Oracle table and then I want to use that stmt with few additions to fetch data . Is there any good method other than Ref Cursor to do this? Somehow Ref cursor is not working in Reports 6i. Or may be I don't know how to use it.
Any help will be appreciated !!
VMJLexical parameters seem to be much more appropriate tool for this task. You can create entire query as single lexical parameter, and script it in the After Parameter Form trigger any way you need. Just make sure to supply some dummy query as initial value for the lexical parameter, so that the report could create proper data structure.
-
Dynamic sql and ref cursors URGENT!!
Hi,
I'm using a long to build a dynamic sql statement. This is limited by about 32k. This is too short for my statement.
The query results in a ref cursor.
Does anyone have an idea to create larger statement or to couple ref cursors, so I can execute the statement a couple of times and as an result I still have one ref cursor.
Example:
/* Determine if project is main project, then select all subprojects */
for i in isMainProject loop
if i.belongstoprojectno is null then
for i in ProjectSubNumbers loop
if ProjectSubNumbers%rowcount=1 then
SqlStatement := InitialStatement || i.projectno;
else
SqlStatement := SqlStatement || PartialStatement || i.projectno;
end if;
end loop;
else
for i in ProjectNumber loop
if ProjectNumber%rowcount=1 then
SqlStatement := InitialStatement || i.projectno;
else
SqlStatement := SqlStatement || PartialStatement || i.projectno;
end if;
end loop;
end if;
end loop;
/* Open ref cursor */
open sql_output for SqlStatement;
Thanks in advance,
Jeroen Muis
KCI Datasystems BV
mailto:[email protected]Example for 'dynamic' ref cursor - dynamic WHERE
(note that Reports need 'static' ref cursor type
for building Report Layout):
1. Stored package
CREATE OR REPLACE PACKAGE report_dynamic IS
TYPE type_ref_cur_sta IS REF CURSOR RETURN dept%ROWTYPE; -- for Report Layout only
TYPE type_ref_cur_dyn IS REF CURSOR;
FUNCTION func_dyn (p_where VARCHAR2) RETURN type_ref_cur_dyn;
END;
CREATE OR REPLACE PACKAGE BODY report_dynamic IS
FUNCTION func_dyn (p_where VARCHAR2) RETURN type_ref_cur_dyn IS
ref_cur_dyn type_ref_cur_dyn;
BEGIN
OPEN ref_cur_dyn FOR
'SELECT * FROM dept WHERE ' | | NVL (p_where, '1 = 1');
RETURN ref_cur_dyn;
END;
END;
2. Query PL/SQL in Reports
function QR_1RefCurQuery return report_dynamic.type_ref_cur_sta is
begin
return report_dynamic.func_dyn (:p_where);
end;
Regards
Zlatko Sirotic
null -
Ref.Cursor Problem - URGENT
Hi Friends,
For my report ( calc.rdf ) ,
I am passing two input parameters P_Client_ID, P_Plan_ID.
In .rdf, I had a ref.cursor for selecting records based on
two input parameters values.
case1:
P_client_ID = 'SRINI'
P_Plan_ID = '3232'
My report is generating the output for plan 3232.
case2:
P_client_ID = 'SRINI'
P_Plan_ID = NULL
My report is generating the output for all plans.
case3:
P_client_ID = 'SRINI'
P_Plan_ID = '3232,3257,3259'
My report is not generating any output here.
Only blanck page i am getting.
How can i pass multiple plans to ref.cursor at a time ?
Note:
I now, we cannot make Lexical references in a PL/SQL statement.
Any other way to solve this problem ?
Thanks for Help,
sriniI think that you work with 'static' ref cursor.
From Oracle 8.1.5, we can use 'dynamic' ref cursors.
With 'dynamic' ref cursor we can avoid the use of lexical parameters in Reports 3.0 / 6i.
With 'static' ref cursor this is not possible in all cases.
For example, if we need dynamic WHERE, we practically can't use 'static' ref cursor.
Example for 'dynamic' ref cursor (dynamic WHERE)
1. Stored package
CREATE OR REPLACE PACKAGE report_dynamic IS
TYPE type_ref_cur_sta IS REF CURSOR RETURN dept%ROWTYPE; -- for Report Layout only
TYPE type_ref_cur_dyn IS REF CURSOR;
FUNCTION func_dyn (p_where VARCHAR2) RETURN type_ref_cur_dyn;
END;
CREATE OR REPLACE PACKAGE BODY report_dynamic IS
FUNCTION func_dyn (p_where VARCHAR2) RETURN type_ref_cur_dyn IS
l_ref_cur_dyn type_ref_cur_dyn;
BEGIN
OPEN l_ref_cur_dyn FOR
'SELECT * FROM dept WHERE ' || NVL (p_where, '1 = 1');
RETURN l_ref_cur_dyn;
END;
END;
2.2 Query PL/SQL in Reports
function QR_1RefCurQuery return report_dynamic.type_ref_cur_sta is
begin
return report_dynamic.func_dyn (:p_where);
end;
Note that Oracle Reports 3.0 / 6i needs 'static' ref cursor type for building Report Layout.
So, in package specification we must have both ref cursor types, static for Report Layout
and dynamic for ref cursor query.
Regards
Zlatko Sirotic -
Something Interesting about Ref Cursor
Hi All,
An extract from Standard package
type "<REF_CURSOR_1>" is ref cursor;
function '=' (LEFT "<REF_CURSOR_1>", RIGHT "<REF_CURSOR_1>")
return BOOLEAN;
pragma BUILTIN('=', 1, 1, 1);
pragma FIPSFLAG('=', 1450);
function '!=' (LEFT "<REF_CURSOR_1>", RIGHT "<REF_CURSOR_1>")
return BOOLEAN;
pragma BUILTIN('!=', 1, 1, 1);
pragma FIPSFLAG('!=', 1450);
function '=ANY' (LEFT "<REF_CURSOR_1>", RIGHT "<REF_CURSOR_1>")
return BOOLEAN;
function '!=ANY' (LEFT "<REF_CURSOR_1>", RIGHT "<REF_CURSOR_1>")
return BOOLEAN;
function '=ALL' (LEFT "<REF_CURSOR_1>", RIGHT "<REF_CURSOR_1>")
return BOOLEAN;
function '!=ALL' (LEFT "<REF_CURSOR_1>", RIGHT "<REF_CURSOR_1>")
return BOOLEAN;
function '=SOME' (LEFT "<REF_CURSOR_1>", RIGHT "<REF_CURSOR_1>")
return BOOLEAN;
function '!=SOME' (LEFT "<REF_CURSOR_1>", RIGHT "<REF_CURSOR_1>")
return BOOLEAN;
function DECODE (expr "<REF_CURSOR_1>", pat "<REF_CURSOR_1>",
res "<REF_CURSOR_1>")
return "<REF_CURSOR_1>";
pragma BUILTIN('DECODE', 1, 1, 1);
function 'IS NULL' (B "<REF_CURSOR_1>") return BOOLEAN;
pragma BUILTIN('IS NULL', 0, 3, 0);
pragma FIPSFLAG('IS NULL', 1450);
function 'IS NOT NULL' (B "<REF_CURSOR_1>") return BOOLEAN;
pragma FIPSFLAG('IS NOT NULL', 1450);
function NVL (B1 "<REF_CURSOR_1>", B2 "<REF_CURSOR_1>")
return "<REF_CURSOR_1>";
pragma FIPSFLAG('NVL', 1450);
By Observing above piece of code, <REF_CURSOR_1> is defined as ref cursor,
And many function prototypes specified to support this type of parameter,
But if we try to call these functions with ref cursor variable as parameter oracle internal error is displayed .
Pls add your observations ...
Thanks
Raj GangaYou missed out what is (in my opinion) the interesting part of the STANDARD package, the comment above that declaration:
-- The following data types are generics, used specially within package
-- STANDARD and some other Oracle packages. They are protected against
-- other use; sorry. True generic types are not yet part of the language.
type "<ADT_1>" as object (dummy char(1));
type "<RECORD_1>" is record (dummy char(1));
type "<TUPLE_1>" as object (dummy char(1));
type "<VARRAY_1>" is varray (1) of char(1);
type "<V2_TABLE_1>" is table of char(1) index by binary_integer;
type "<TABLE_1>" is table of char(1);
type "<COLLECTION_1>" is table of char(1);
type "<REF_CURSOR_1>" is ref cursor;The fact that these pseudo-generics are only for internal use is not surprising; STANDARD is an odd package (can you write a packaged function that you can call without prefixing it with the package name? no, but STANDARD can). What intrigues me is the hint that at some point in the future PL/SQL will support generics. Java's about to get 'em (JDK 1.5 aka Tiger). If PL/SQL has them as well I really will have to teach myself Aspect Orientated Program.
Cheers, APC -
Calling a report from an existing form
hi all,
i am new to this forms and reports. i have created a report which gives information about an employee. and name it as activity report. i am using reports Report Builder 10.1.2.0.2. i have also created a form. my purpose is " i will enter the employee id, a starting and ending dates as input to the form. these values r to be passed to the query of the reports and the report has to extract the records of that employee between the start and end dates." how can i achieve this. i am entirely new to this reports and forms. please give me a clear reply so that i can call my report and pass that dates and id to my report. and also please explain me how to call a report from a form and make it to run. please make me clear where to write the code whether in forms or rports.
thank you.Hi,
Check this sample Code..
DECLARE
pl_id ParamList;
pl_name VARCHAR2(10) := 'repdata';
BEGIN
pl_id := Get_Parameter_List(pl_name);
IF Id_Null(pl_id) THEN
pl_id := Create_Parameter_List(pl_name);
Add_Parameter(pl_id, 'P_STARTDATE', TEXT_PARAMETER,:BLK_CTRL.P_TODATE);
Add_Parameter(pl_id, 'P_ENDDATE', TEXT_PARAMETER, :BLK_CTRL.P_CURRENCY);
Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
ELSE
Destroy_Parameter_List( pl_id );
END IF
RUN_PRODUCT(REPORTS, 'D:\MMRROLDL.RDF' ,SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id ,NULL);
END;
Maybe you are looking for
-
How to get the output format options of SAP QUERY
Hi Gurus, I want to get the output options available for sapquery program.means when you execute the program "AQZZ/SAPQUERY/FDF1============" you will get output options like sap alv,display as table,wordprocessing etc. i am not able to unsderstand
-
After iOS 4, 3G service no longer works on my 3G
I, too, have had horrible thinhs happen to my 3G after the iOS4 "upgrade." I've tolerated most, but now 3G service is not working. Anyone have 3G no longer working on their 3G? Any fixes work for you?
-
Save a data as a PDF in forms in Acrobat
Hi All, I am trying to create a form to be filled out. but instead of it being emailed, I just want the recipent to complete it and save it as a PDF. Can this be done preferrably by Acrobat Reader and if not Acrobat. I have tried it many times and it
-
White screen at reset. Won't start up with install disk.
White Screen persists on restart. Folder with ? appears after a few minutes. Tried safe start - nothing. Tried RAM reset (option, cmd, p, r) - nothing. Tried to restart with C key to use install disk, C drive powers and spins for awhile - nothing. Th
-
FINSTA inbound idocs - "Error during insert in table FEBKO"
Can anyone tell me , y this error comes? I am using File to IDOC scenario. I need to update bank statement. It can be given in multiple pages. I need to update depending upon the date as well as its page number. Sometimes I get this error. Can anyone