Sorting records dynamically in REF cursor, based upon a dynamic field
Hi,
I have a REF CURSOR built by using row type, table type and PIPELINE function. I have opened the ref cursor now. I would like to update a field called 'RANK' based upon 'RATIO' field in the REF CURSOR. i.e order the records in the ref cursor by RATIO field and then update the RANK as 1, 2, 3, 4, ....
Aim: I want to update a field in the REF CURSOR based upon another numeric field.
Please help me.
OPEN sales FOR
SELECT RANK, ratio
FROM TABLE (fngetfundholdingsale (in_primarykey, in_flag));
loop
fetch sales into sale1;
exit when sales%notfound;
--I want to update sale1.rank based upon ratio
end loop;
Thanks
Ashok
Try to use NDS (Native Dynamic SQL):
l_order := 'ratio';
OPEN sales FOR
'SELECT rank' ||
' FROM TABLE (fngetfundholdingsale (:in_primarykey, :in_flag))' ||
' ORDER BY ' || l_order
USING in_primarykey, in_flag;Regards,
Zlatko
Similar Messages
-
How to create dynamic ed flash charts based on user selected fields in Orac
Hi all,
Can any of the experts please tellme "how to create dynamic ed flash charts based on user selected fields in Oracle apex".
Thanks
ManishHello,
Lots of different ways to do this, I blogged about one way (using a Pipelined function) here -
http://jes.blogs.shellprompt.net/2006/05/25/generic-charting-in-application-express/
Other options include using a PL/SQL function returning the string to use as the dynamic query etc.
Hope this helps,
John.
Blog: http://jes.blogs.shellprompt.net
Work: http://www.apex-evangelists.com
Author of Pro Application Express: http://tinyurl.com/3gu7cd
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone! -
Assigning a query dynamically to a cursor based on IF ELSE condotion
hello guys,
we are facing a problem while creating a procedure.
The procedure has been recreated in ORACLE from SQL SERVER 2005.
the problem is that in SQL server we can assign a query dynamically to a cursor so that it will be called at execution time.But this is not the case in oracle, i.e in Oracle its not allowed to assign a query to a cursor dynamically(OR IS IT...!!!)
the code is
vr_SQL varchar2(400);
declare
cursor ord_cur ; <-----cursor declaration
begin
If v_pIsScrutiny = 0 then +<--------------second condition+
vr_SQL:='Select NVL(ServiceID,0) ServiceID,OrdQty,+<-------query assignment to a variable+
NVL(DrugID,0) DrugID,NVL(ServiceAmount,0) Rate,OrdDtlID
from Orderdtl inner join ordermst on Orderdtl.OrdID = ordermst.OrdID
Where Orderdtl.OrdID in (Select OrdID From Ordermst Where OrdVisitID = vr_visitid
and TO_CHAR(ordermst.OrdDate,''DD-MON-YYYY'')
Between TO_CHAR(vr_pActivationDate,''DD-MON-YYYY'')
and TO_CHAR(vr_pExpiryDate,''DD-MON-YYYY'')
) And NVL(Orderdtl.Cancelled,0) = 0 And NVL(Orderdtl.PackageID,0) = 0
and NVL(Orderdtl.DrugID,0) = 0;';
Else +<--------------first condition+
Update OrderDtl Set PackageID = 0 , AllocationID = 0 , ConsumptionID = 0
Where OrdID in (Select OrdID From Ordermst Where OrdVisitID = vr_visitid)
And AllocationID = v_pHCPAllocationID;
vr_SQL:= 'Select NVL(ServiceID,0) ServiceID, +<-------query assignment to a variable+
OrdQty,NVL(DrugID,0) DrugID,NVL(ServiceAmount,0)
Rate,OrdDtlID
from Orderdtl inner join ordermst on Orderdtl.OrdID = ordermst.OrdID
Where Orderdtl.OrdID in (Select OrdID From Ordermst Where OrdVisitID = vr_visitid
and TO_CHAR(ordermst.OrdDate,''DD-MON-YYYY'')
Between TO_CHAR(vr_pActivationDate,''DD-MON-YYYY'')
and TO_CHAR(vr_pExpiryDate,''DD-MON-YYYY'')
) And NVL(Orderdtl.Cancelled,0) = 0 And NVL(Orderdtl.PackageID,0) = 0;';
end if;
ord_cur is vr_SQL; +<----------query assigned to a cursor variable+
ord_rec ord_cur%ROWTYPE;
if not ord_cur%ISOPEN then
open ord_cur;
end if;
loop
fetch ord_cur into ord_rec;
exit when ord_cur%NOTFOUND;So currently we are stuck with this problem.
Any solution would be of great help..
thank you841363 wrote:
hello guys,
we are facing a problem while creating a procedure.
The procedure has been recreated in ORACLE from SQL SERVER 2005.
the problem is that in SQL server we can assign a query dynamically to a cursor so that it will be called at execution time.But this is not the case in oracle, i.e in Oracle its not allowed to assign a query to a cursor dynamically(OR IS IT...!!!)The problem is that you are thinking in SQL Server terms and Oracle just isn't SQL Server.
You need to consider using ref cursors for such things (sys_refcursor) e.g.
SQL> CREATE OR REPLACE PACKAGE reftest IS
2 PROCEDURE test(P_no in number, cur_o OUT sys_refcursor);
3 end;
4 /
Package created.
SQL>
SQL> CREATE OR REPLACE PACKAGE body reftest as
2 PROCEDURE test(P_no in number, cur_o OUT sys_refcursor) as
3 myexc exception;
4 BEGIN
5 if P_no = 1 then
6 open cur_o for select empno, ename from emp;
7 elsif p_no =2 then
8 open cur_o for select deptno, dname from dept;
9 else
10 RAISE myexc;
11 END IF;
12 exception
13 when myexc then
14 raise_application_error(20991,'input must be 1 or 2');
15 end ;
16 end reftest;
17 /
Package body created.
SQL> var x refcursor;
SQL> exec reftest.test(1,:x);
PL/SQL procedure successfully completed.
SQL> print x;
EMPNO ENAME
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
14 rows selected.
SQL> exec reftest.test(2,:x);
PL/SQL procedure successfully completed.
SQL> print x;
DEPTNO DNAME
10 ACCOUNTING
20 RESEARCH
30 SALES
40 OPERATIONS
SQL> -
Hello,
I would like to know if the following is possible:
I'm getting data from different sources in a ref cursor. Is it possible to sort this ref cursor on a specific column in the ref cursor? If so, how?
Thanks
KarunaNote that this is a duplicate post of this thread
sort data in ref cursor
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Ref cursor based on join or nested select is empty
Hi ,
We have a Stored procedure which returns 27 ref cursors.
We are populating this data into a suitable data set using OracleDataAdapter (.fill).
Refcursors that the data they hold is from a join or nested select are result empty.
The other refcursors are fine.
If running the stored procedure in the database (from another SP for instance) all refcursors are full of data.
Can someone direct me for a solution or even working work around ?
ThanksHi Again ,
No, The cursors are not any of group by with some aggregations of any sort. Just plain and simple joins or nested queries (Select... from ... where ... in (select ...). Some of the data is taken from temporary tables.
For the last question i am using the production ODP with the last oraMTS.
This problem is really stopping us from going to production in early march ....
A possible work around we thought about (but cost dearly ...) is to fill the data from the tables into a temporary one and then base the cursor on a query on this table. This workaround can last only a few weeks at the customer.
Regards -
Hi,
Can any one kindly tell me how to get the number of records fetched into a REF CURSOR.
ThanksI'll tell you what I'm doing, but I don't like it. After I open the query, I run a count query using the same where and join clauses. The IO cost should be low because the records were accessed in the last statement, but the CPU will still cost you. As an alternative, you could declare a varray of your rowtype and select into that using a BULK COLLECT clause then you could get the count of the varray. I have not tried that yet, but if I ever get the time I will.
The first option looks like this:
OPEN p_Cursor FOR
SELECT MyField1, MyField2
FROM MYTable
INNER JOIN MyTable2 ON ...
WHERE ...
SELECT COUNT(*) INTO p_RowCount
FROM MYTable
INNER JOIN MyTable2 ON ...
WHERE ...
If you find a better way, please post it. -
How return parameter ref Cursor from procedure using dynamic SQL?
I sorry, but i very need help.
I using Oracle 8.0.6
I need to return parameter of type ref Cursor from procedure.
create or replace package PlanExp is
type cursortype is ref cursor;
procedure ShowPlan (cursorparam out
cursortype.............);
end PlanExp;
create or replace package body PlanExp is
procedure ShowPlan (cursorparam out cursortype,
.............) Is
sql_str varchar2(1000);
sql_str_select varchar2(100);
sql_str_from varchar2(100);
sql_str_where varchar2(500);
Return_Code integer;
Num_Rows integer;
cur_id_sel integer;
tSum_Plan DBMS_SQL.NUMBER_TABLE;
tSum_Plan_Ch DBMS_SQL.NUMBER_TABLE;
tSum_Plan_Day DBMS_SQL.NUMBER_TABLE;
begin
/* calculating string variables ........... /*
sql_str := 'select ' || sql_str_select ||
'from ' || sql_str_from ||
'where ' || sql_str_where ||
'group by ' || sql_str_select;
cur_id_sel := dbms_sql.open_cursor;
dbms_sql.parse(cur_id_sel, sql_str, dbms_sql.native);
dbms_sql.define_array(cur_id_sel, 1, tSum_Plan, 20, 1);
dbms_sql.define_array(cur_id_sel, 2, tSum_Plan_Ch, 20, 1);
dbms_sql.define_array(cur_id_sel, 3, tSum_Plan_Day, 20, 1);
Return_Code := dbms_sql.execute(cur_id_sel);
delete from TEMP_SHOWPLAN;
Loop
Num_Rows := dbms_sql.Fetch_Rows(cur_id_sel);
dbms_sql.column_value(cur_id_sel, 1, tSum_Plan);
dbms_sql.column_value(cur_id_sel, 2, tSum_Plan_Ch);
dbms_sql.column_value(cur_id_sel, 3, tSum_Plan_Day);
if Num_Rows = 0 then
exit;
end if;
Exit When Num_Rows < 20;
End Loop;
dbms_sql.close_cursor(cur_id_sel);
end;
end PlanExp;
How return cursor (cursorparam) from 3 dbms_sql.column_value-s ?I am using Oracle 8.1.7, so I don't know if this will work in
8.0.6 or not:
SQL> CREATE TABLE test
2 (col1 NUMBER,
3 col2 NUMBER,
4 col3 NUMBER)
5 /
Table created.
SQL> INSERT INTO test
2 VALUES (1,1,1)
3 /
1 row created.
SQL> INSERT INTO test
2 VALUES (2,2,2)
3 /
1 row created.
SQL> INSERT INTO test
2 VALUES (3,3,3)
3 /
1 row created.
SQL> CREATE TABLE temp_showplan
2 (tSum_Plan NUMBER,
3 tSum_Plan_Ch NUMBER,
4 tSum_Plan_Day NUMBER)
5 /
Table created.
SQL> EDIT planexp
CREATE OR REPLACE PACKAGE PlanExp
IS
TYPE CursorType IS REF CURSOR;
PROCEDURE ShowPlan
(cursorparam IN OUT CursorType,
sql_str_select IN VARCHAR2,
sql_str_from IN VARCHAR2,
sql_str_where IN VARCHAR2);
END PlanExp;
CREATE OR REPLACE PACKAGE BODY PlanExp
IS
PROCEDURE ShowPlan
(cursorparam IN OUT CursorType,
sql_str_select IN VARCHAR2,
sql_str_from IN VARCHAR2,
sql_str_where IN VARCHAR2)
IS
sql_str VARCHAR2 (1000);
cur_id_sel INTEGER;
return_code INTEGER;
BEGIN
DELETE FROM temp_showplan;
sql_str := 'INSERT INTO temp_showplan '
|| ' SELECT ' || sql_str_select
|| ' FROM ' || sql_str_from
|| ' WHERE ' || sql_str_where;
cur_id_sel := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE (cur_id_sel, sql_str, DBMS_SQL.NATIVE);
return_code := DBMS_SQL.EXECUTE (cur_id_sel);
DBMS_SQL.CLOSE_CURSOR (cur_id_sel);
OPEN cursorparam FOR SELECT * FROM temp_showplan;
END ShowPlan;
END PlanExp;
SQL> START planexp
Package created.
Package body created.
SQL> VARIABLE g_ref REFCURSOR
SQL> EXEC PlanExp.ShowPlan (:g_ref, 'col1, col2,
col3', 'test', ' 1 = 1 ')
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
TSUM_PLAN TSUM_PLAN_CH TSUM_PLAN_DAY
1 1 1
2 2 2
3 3 3 -
Cannot create dynamic page with cursor based on linked table
I get the following error when i try to create a dynamic portal page that uses a pl/sql cursor:
ORA-06550: line 1, column 24:
PL/SQL: ORA-00980: synonym translation is no longer valid
ORA-06550: line 1, column 24:
PL/SQL: SQL Statement ignored (WWV-11230)
Failed to parse as REPORTS - DECLARE CURSOR C1 IS SELECT * FROM
[email protected]; BEGIN FOR R1 IN C1 LOOP HTP.P(','||'<BR>');
END LOOP; END; (WWV-08300)
Dynamic page:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
<BODY>
<H2>Example of A Dynamic Page</H2>
<ORACLE>
declare
cursor c1 is
select * from [email protected];
begin
for r1 in c1 loop
htp.p('hello<br>');
end loop;
end;
</ORACLE>
</BODY>
</HTML>
When i use the sql query from the cursor in the page below, i get no errors:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
<BODY>
<H2>Example of A Dynamic Page</H2>
<ORACLE>select * from [email protected]</ORACLE>
</BODY>
</HTML>
I tried a dynamic page with a cursor on session_roles and had no problems. I assume that there is an issue with the database link or the privileges. The queries seem to get executed under portal_public;
Oracle Portal Version: 9.0.4.0.99I get the following error when i try to create a dynamic portal page that uses a pl/sql cursor:
ORA-06550: line 1, column 24:
PL/SQL: ORA-00980: synonym translation is no longer valid
ORA-06550: line 1, column 24:
PL/SQL: SQL Statement ignored (WWV-11230)
Failed to parse as REPORTS - DECLARE CURSOR C1 IS SELECT * FROM
[email protected]; BEGIN FOR R1 IN C1 LOOP HTP.P(','||'<BR>');
END LOOP; END; (WWV-08300)
Dynamic page:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
<BODY>
<H2>Example of A Dynamic Page</H2>
<ORACLE>
declare
cursor c1 is
select * from [email protected];
begin
for r1 in c1 loop
htp.p('hello<br>');
end loop;
end;
</ORACLE>
</BODY>
</HTML>
When i use the sql query from the cursor in the page below, i get no errors:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
<BODY>
<H2>Example of A Dynamic Page</H2>
<ORACLE>select * from [email protected]</ORACLE>
</BODY>
</HTML>
I tried a dynamic page with a cursor on session_roles and had no problems. I assume that there is an issue with the database link or the privileges. The queries seem to get executed under portal_public;
Oracle Portal Version: 9.0.4.0.99 -
How can I dynamically reference a sheet based upon the contents of a cell
I'm using Numbers to store specifications for various products. Each sheet stores specifications in a standard manner (i.e. same table and cell names) and the sheet is named according to the name of the product.
On another sheet I've got a dropdown list containing the names of the product tabs. I'd like to dynamically pull data for a particular product when it's sheet is selected in the dropdown list by using the dropdown cell in a reference like:
=B1::STC::A4, where B1 is the dropdown list and STC::A4 is the product specification table and cell reference.
When I use this, the B1 reference fails.
Any suggestions would be greatly appreciated.
Thanks.Amos,
you will have to use the indirect function to convert the string you are creating into a valid reference.
Note: The Sheet names, Table names and cell references must all match exacty.
If the sheets are named "B1", "C1" and "D1" and the popup menu is in the cell A1 and contains the strings:
B1
C1
D1
The table name is "STC"
then you can create a valid reference like this:
= indirect(A1&"::STC::A4")
if the table name were also dynamic and were stored in cell A2 you could create the reference like this:
= indirect(A1&"::"&A2&"::A4") -
I have a 1300 page PDF document with about 600 of those pages having a specific page date. I need to now extract the pages with that specific date and put them into new separate pdf sequentially.
I'd prefer not doing it manually. Any suggestions?What do you mean by "page date"? Is it a piece of text on the page with the date? If so, it might be possible to do using a javascript. If you're interested, I can create such a script for you. Contact me by email for more info.
-
DYnamic Screen -Display data Based On the First Field
hello Helping Minds..
I have Two Fields In MODULEPOOL SCREEN.
1--- BUKRS
2--- BELNR ..... Both From BKPF table.
My requirement is When i select a CompanyCode ( BUKRS ) In d first field,all the DocumentNO ( BELNR ) related to that CompCOde Shd be displayed in the 2nd field,
For Ex- If i choose BUKRS = 1000,
and Then clicked the Belnr field, All d DocumentNO for BUKRS 1000 will be populated in d Dropdown list..
BUKRS = 1000,
then BELNR = 0100000000 ,
0100000001 in d dopdown.
<<don't cross post/Duplicate else thread will be locked or deleted>>
Thnks in advance To D helping Minds
Edited by: Vijay Babu Dudla on Apr 25, 2009 4:57 AMProcess on value-request.
filed Bukrs module f4_bukrs.
field belnr module f4_belnr.
*module f4bukrs input.*_
if belnr is not initial.
select belnr bukrs from bkpf whre belnr = belnr.
else.
select belnr bukrs from bkpf whre belnr = belnr.
endif. "" Hey both these Condition lead to same thing...den Whts d use??
Firstly Belnr will be always Intial. cos it will be populated after we select the BUKRS. , Here am confused?
if t_bkpf is not initial.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST' " No idea Abt dis FUncn module, pls explain
endif.
end module.
module f4_belnr input.
if bukrs is not initial.
select belnr bukrs from bkpf where bukrs = bukrs.
else.
select belnr bukrs from bkpf whre belnr = belnr.
endif.
if t_bkpf is not initial. "" What is t_bkpf and y its used
call fm to CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
endif.
end module. -
REF CURSOR? FUNCTION RETURN VALUE BASED ON DYN QUERY
Hi to all,
i need to write a function that do the following (but have to work...):
Note: what i really don't remember is how can i have a valid cursor based using
a dynamic field taken from the input value PAR_NAME.
Hope that my problem is clear reading the NOT WORKING CODE below.
thanx a lot
CREATE OR REPLACE
FUNCTION FNC_RET_FLD_VAL(ID_CNT NUMBER, PAR_NAME VARCHAR2) RETURN VARCHAR2 AS
RETVAL VARCHAR2(300);
CURSOR FVAL IS
SELECT PAR_NAME FROM TBCONTATTI WHERE NORECORD=ID_CNT;
BEGIN
FOR REC IN FVAL LOOP
RETVAL:=REC.PAR_NAME;
END LOOP;
RETURN RETVAL;
END FNC_RET_FLD_VAL;Like this ?
SQL> create function get_data(colname varchar2, empno number)
2 return varchar2
3 is
4 ret varchar2(4000);
5 begin
6 begin
7 execute immediate 'select ' || colname || ' from emp where empno = :1' into ret using empno;
8 exception
9 when no_data_found then
10 ret := null;
11 end;
12 return ret;
13 end;
14 /
Function created.
SQL> select get_data('ename',7369) from dual;
GET_DATA('ENAME',7369)
SMITH
SQL> select get_data('job',7369) from dual;
GET_DATA('JOB',7369)
CLERK
SQL> select get_data('job',-1) from dual;
GET_DATA('JOB',-1)
Rgds. -
Security risk of ref cursor & dynamic sql
Hi guys,
I am using Ref Cursor to execute a dynamic sql in my stored procedure. Inputs to the dynamic SQL are passed in as parameters. My code fragments:
parameters:
CREATE PROCEDURE mm_select(
aaa IN VARCHAR2,
bbb IN VARCHAR2 )
in the code:
sqlstmt := 'SELECT * FROM dbaivoc.mm ' ||
'WHERE b in (' || role_id_list || ') ' ||
'AND c = '|| application_fn_id_list ;
OPEN RC1 FOR sqlstmt;
My question is, is it possible for anyone to pass in a malicious SQL like drop table xxx into the parameter list eg. exec mm_select(1,'1; drop table aa;')
I've tried but it doesn't seem to work. I'm just asking for confirmation. Thanks for any help!
rgds,
masI don't see in your small pieces of code what the input parameters aaa and bbb are used for.
If your statement is always
sqlstmt := 'select ....'
then I don't see how this can be changed to 'drop table ...'.
It would be something different if you have something like this in your procedure:
execute immediate bbb; -
Dynamic XSLT source code generation based upon internal table
Hi,
Is there anyway to generate dynamic XSLT source code based upon final structure of output internal table and call dynamic generated XSLT in program?
CALL TRANSFORMATION z_transformation
PARAMETERS
p_shared_string = lo_shared_str_nodeset
SOURCE XML g_sheet_data
RESULT lt_data = i_data[].
Source code example of XSLT transformation -
<xsl:template match="/">
<asx:abap version="1.0">
<asx:values>
<LT_DATA> "Internal table
<xsl:for-each select="ss:worksheet/ss:sheetData/ss:row">
<xsl:if test="position() > 1">
<item>
<FIELD1>
<xsl:variable name="cell_id" select="concat('A', position())"/>
<xsl:variable name="v_index" select="ss:c[@r=$cell_id][@t='s']/ss:v"/>
<xsl:if test="$v_index">
<xsl:value-of select="$V_SHARED_STRING/sst/si[$v_index + 1]/t"/>
</xsl:if>
<xsl:if test="not($v_index)">
<xsl:value-of select="ss:c[@r=$cell_id]/ss:v"/>
</xsl:if>
</FIELD1>
</item>
</xsl:if>
</xsl:for-each>
</LT_DATA> "internal table
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>In addition,
We are converting binary data of excel from application server into internal table but currently we created two XSLT transformation to achieve this one for deleting name space and other for converting data into internal table format.
We want to make our source code for future use also,Is there anyway to generate XSLT source code dynamically?Above mentioned code is snippet of data extracting which we are doing but this transformation is hard coded.
Any help is appreciated.
BR,
Praveen -
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
Maybe you are looking for
-
I have a a mini-DVI to component/s-video adapter on my Macbook. I connect to a projector using the s-video cable. I did not expect this to be as clear a picture as direct VGA connection but it is much worse than I expected. The projector picture is n
-
The requested object does not exist. (Exception from HRESULT: 0x80010114)
Hello, I have a 3 node cluster that is setup as active, active, passive. Two of the nodes report the following error when trying to connect to the cluster: One of the active nodes is successfully able to connect the "Cluster" while the other two are
-
"software update" "An error occurred while checking for updates"
When I click on "Software Update", an error results, "An error occurred while checking for updates". It is definitely connected to the internet. I was gifted a G5 and I installed a new hard drive and loaded the OS, OS X 10.3.5. That version of Saf
-
Combining iTunes Data When Merging XP Profiles
Hello friends, I'm doing some work on a friend's computer, and they want me to do some things that I've never done. I don't want to screw anything up, so I'd like a little guidance if possible. One of the things they want me to do is turn two profile
-
hi, I installed visual studio 2010 in my windows 8.1 system.during the installation sql server 2008 r2 features were installed.so which version of sql server i need to install(2008 or 2008 r2)? regards, harsha.