Urgent-Using Ref Cursors with

Posted on 2007-07-24
Last Modified: 2013-12-18
i have an 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?
Question by:samir25
    LVL 47

    Expert Comment

    LVL 1

    Author Comment

    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.

    LVL 27

    Expert Comment

    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)
    open arg3 for
    select serialno, time, id, xml_data
    from tablename
    where status= arg1 and serialno= arg2;

    LVL 47

    Expert Comment

    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.
    LVL 14

    Accepted Solution

    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
    LVL 1

    Author Comment

    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
    LVL 47

    Expert Comment

    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 ...

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
    Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now