[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Urgent-Using Ref Cursors with ODP.net

Posted on 2007-07-24
7
Medium Priority
?
878 Views
Last Modified: 2013-12-18
hi
i have an asp.net page and the data i want to show in the grid i want to get from oracle. i can do that my creating logic on the page. but i wanted to separate the business logic to the database which will be faster also(than simply creating query on a webpage)

the query that i have in asp side is
select serialno, time, id, xml_data from tablename where status="error" and serialno="23455".

this record returns to me 200 rows. basically stored procedure will have have 2 IN parameters in their defination and I am not able to understand the OUT parameter. ALso I read on net if i use ref cursors then i can pass the address rather.

can someone suggest me on this?
0
Comment
Question by:samir25
7 Comments
 
LVL 1

Author Comment

by:samir25
ID: 19554561
http://www.oracle.com/technology/pub/articles/mastering_dotnet_oracle/williams_refcursors.html
i was reading this above article.
what is the impact of this characteristics
A ref cursor is not backward-scrollable. The data represented by the ref cursor is accessed in a forward-only, serial manner. You cannot position a record pointer inside the ref cursor to point to random records in the result set.

CAN I NOT DO SORTING/PAGING ON GRID then?
0
 
LVL 27

Expert Comment

by:sujith80
ID: 19554565
Your procedure could take the form:
And in the client application you can fetch from this ref cursor(arg3).

procedure <procedure name>(arg1 varchar2, arg2 varchar2, arg3 OUT sys_refcursor)
as
begin
open arg3 for
select serialno, time, id, xml_data
from tablename
where status= arg1 and serialno= arg2;
end;
/

0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 48

Expert Comment

by:schwertner
ID: 19554624
You have to place the data in the grid.
Scrolling and pointing random row is
function of the grid, not of the select statement
and the procedure you use. It only deliveres the
data, nothing else.
You have to place the delivered data in
a scrolbar GUI, e.g. Oracle Forms or .asp page

Alternativelly you can also read page by page.
If you need the SELECT statement go to Oracle
magazine and read article from Tom Kyte how
to select page after page.
0
 
LVL 13

Accepted Solution

by:
anand_2000v earned 2000 total points
ID: 19555248
alternate to ref cursor:
create a table type.
do a bulk collect into the table type
return it via the procedure
access it in .net using an array type object
0
 
LVL 1

Author Comment

by:samir25
ID: 19561400
i have used table type...wihtout fully knowing its concepts.i havent tried ref cursors so probably will try that out. just for clarification. table type concept is also pointers? bec i can pull data. the only reason why i want to opt for ref cursor is that i move to logic in my db and use pointers so that its faster
0
 
LVL 48

Expert Comment

by:schwertner
ID: 19563207
Cursors have no navigation.
Cursors can not paginate without additional eforts (writing appropriate SQL).

Normally these functionalities are delivered by the front end GUI. A good example is Oracle Forms, but every GUI nowadays is able to do this.

Instead jumping in complex Oracle functionalities pay attention to your GUI ...
0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question