Ref Cursor is supported by their SUMMIT?

Version 3.2 of the apex
ORacle 10G

Hi Ashalon,

I don't have access to this book, so it is difficult to answer for what he says, but the PIPELINED function should return a type of collection (nested table or varray) - that would be a table of 'something '. That "something" could be a type of object defined by you (if the REF CURSOR data structure are correlated to a specific table) or simply a line-type I made for simplicity. Yes, my example is a nested table type.

If I can make a suggestion - play with the concepts of packaging your routines back REF CURSOR in PIPELINED functions using just the SQL or SQL command window * more before trying to integrate them into an ApEx application. Less variable to deal with at the same time.

Hope this helps,
John

If you find this information useful, please do not forget to mark the 'useful' or 'correct' post so that others benefit as well.

Tags: Database

Similar Questions

  • How to perform procedures with REF CURSOR & PLSQL settings table in SQL Dev?

    I have 3 SQL Developer. I create a procedure with a set of tables/PL/SQL as an input parameter and a SYS_REFCURSOR as output parameter.

    When I press the green arrow (Run button) block the dialog box run PL/SQL PL/SQL has no place at the PL/SQL table with records of entry and also to see the output of the SYS_REFCURSOR.

    I get the error ORA-06550 and many other errors when I run the present.

    How to do this please?

    In the debug code, lose the ABS. Prefix the SYS_REFCURSOR QC_SQL_DEVELOPER_TEST.
    Also, do not use same name of your settings on your bind variable (so e.g.: OUT_REF_CURSOR).
    REF CURSOR is supported output types, so you will get the output of their share in the output tab.
    However the output system does not recognize your own types as your PL/SQL table. You need to write an exit procedure yourself, indexing correctly, using the DBMS_OUTPUT.

    Have fun
    K.

  • Report regions - use of the Ref Cursor?

    APEX 4.2

    See http://mikesmithers.wordpress.com/2012/02/22/getting-apex-to-play-with-ref-cursors

    The above article is older than 2 years. The techniques shown in the link above still valid today if we want to create a report region in the APEX are based on a function that returns a Ref Cursor? Are there improvements in this area for the next APEX 5.0 and/or database Oracle 12 c?

    Thank you

    HELEN wrote:

    APEX 4.2

    See http://mikesmithers.wordpress.com/2012/02/22/getting-apex-to-play-with-ref-cursors

    The above article is older than 2 years. The techniques shown in the link above still valid today if we want to create a report region in the APEX are based on a function that returns a Ref Cursor?

    If the function returns the ref cursor is the only point of access that you have data then Yes, it probably is. If you have direct access to the underlying database objects and the function does not have something very complicated, then you are probably better off creating your own body of the function returning SQL query data source.

    Everything about the dynamics of ref Cursor now I divided in 2 layers, with a function for generating the dynamic SQL and another for bind parameters open the ref cursor. APEX apps can then reuse the functions of SQL query in function body return SQL query data sources (if you take a bit of care to keep the bind variable names vaguely APEX-point-friendly).

    Are there improvements in this area for the next APEX 5.0 and/or database Oracle 12 c?

    See this for the technical background on why APEX is not yet support ref Cursor and this for more information of the Oracle team on the possibility of future support. Obviously, he did not he in 4.1. I suspect that data REF CURSOR region sources depended on a minimum requirement of DB of the 11.1.0.6 (where was introduced support for the conversion of the REF CURSOR in the cursors DBMS_SQL). As minimum DB for APEX 5.0 version is 11.1.0.7, it would be a possible feature for 5.0, but it is not classified as one.

  • Create a REF CURSOR as an array of display/temp

    Hello world

    I had to upgrade a number of Crystal Reports Using REF CURSOR as part of an ERP upgrade project. The new version of the ERP application supports more use of the REF CURSOR and only supports the use of views/tables.

    I don't see how I can rewrite the REF CURSOR (which are defined in the PL/SQL procedures), in the form of VIEWS / TEMP TABLES with a single call. That is to say when the user runs the report.

    Can anyone suggest a method of conversion of the REF CURSOR in view/Temp Table without the two steps, the steps to populate a temporary table and then, i.e. 1 - 2 - query the table in the report. ??? -I was looking at a Pipelining as an option but again could reach with only two stages, pre filling before running the report.

    Any advice would be greatly received.

    Kind regards

    David.

    I found a solution by creating a FUNCTION with a PIPELINED return cursor, and then create a temporary table in the result set. Not really ideal was to use a Pragma AUTONOMOUS_TRANSACTION, but will work for me.

    Thank you

    David.

  • using plsql table and ref cursor in oracle's 10 g

    Hi all
    Can someone give me an example of a scenario where we need to create a form manually based on a stored database procedure.
    And in this process, I created a pl/sql table and a Ref cursor at the database level.

    CREATE OR REPLACE PACKAGE SCOTT. TYPE BONUS_PKG IS bonus_rec
    IS (RECORD
    EmpNo bonus_EMP.empno%TYPE,
    Ename bonus_EMP.ename%TYPE,
    employment bonus_EMP.job%TYPE,
    SAL bonus_EMP.sal%TYPE,
    Comm bonus_EMP.comm%TYPE);

    TYPE b_cursor IS REF CURSOR RETURN bonus_rec;
    TYPE bontab IS TABLE OF bonus_rec INDEX DIRECTORY.

    PROCEDURE bonus_refcur (bonus_data IN OUT b_cursor);
    PROCEDURE bonus_query (bonus_data IN OUT bontab);
    END bonus_pkg;


    CREATE OR REPLACE PACKAGE BODY SCOTT. BONUS_PKG IS
    PROCEDURE bonus_query (bonus_data IN OUT bontab) IS
    II NUMBER;
    CURSOR bonselect IS
    SELECT empno, ename, job, sal, comm bonus_EMP ORDER BY empno;
    BEGIN
    OPEN bonselect.
    II: = 1;
    LOOP
    Look FOR bonselect IN
    .EmpNo bonus_data (ii),
    .ename bonus_data (ii),
    .job bonus_data (ii),
    .Sal bonus_data (ii),
    .comm bonus_data (ii);
    EXIT WHEN bonselect % NOTFOUND;
    II: = ii + 1;
    END LOOP;
    END bonus_query;

    PROCEDURE bonus_refcur (bonus_data IN OUT b_cursor) IS
    BEGIN
    Bonus_data OPEN to SELECT empno, ename, job, sal, comm bonus_EMP ORDER BY empno;
    END bonus_refcur;

    END bonus_pkg;

    I want to fill in the data in the forms manually is not using Forms data block Wizard and by program.

    Please answer...

    Can someone give me an example of a scenario where we need to create a form manually based on a stored database procedure.

    In general, you will use a block of proceedings based when you have a collection of data from several tables presented in a form and your username must be able to update the information displayed.

    In your sample code, looks like you are using Oracle Support document "Melting a block on a Stored Procedure - examples of Code [ID 66887.1]". If this is the case, continue to follow the document - it guides you through all the steps. There is no need to manually configure things that the data block Wizard will work for you!

    I want to fill in the data in the forms manually is not using Forms data block Wizard and by program.

    Why? Let the wizard block configuration data of your block based on a procedure for you. There is no need to manually browse the data! I did what you're trying, and it's more work needed. Leave forms to do the work for you. :)

    If you absolutely have to do things manually, I recommend that you use the PROCEDURE bonus_query (bonus_data IN OUT bontab) instead of bonus_refcur (bonus_data IN OUT b_cursor) . Then, in your code create a variable of type BONTAB, and then call the bonus_query procedure. Then, it's a simple case of a loop in the table of records returned by the bonus_query procedure. For example:

    DECLARE
       t_bonus    bonus_pkb.bontab;
    BEGIN
       bonus_pkg.bonus_query(t_bonus);
    
       FOR i in 1 .. t_bonus.count LOOP
          :YOUR_BLOCK.EMPLOYEE_NUMBER := t_bonus(i).empno;
          :YOUR_BLOCK.EMPLOYEE_NAME := t_bonus(i).ename;
          :YOUR_BLOCK.EMPLOYEE_JOB := t_bonus(i).job;
          :YOUR_BLOCK.EMPLOYEE_SALARY := t_bonus(i).sal;
          :YOUR_BLOCK.EMPLOYEE_COMMISSION := t_bonus(i).comm;
       END LOOP;
    END;
    

    This code example shows the basics, but as is the sample code - you will need to adapt to your situation.

    Also, I highly recommend that you look at the article inol listed. It is a very thorough debate on the REF CURSOR. If you have set up using a procedure based on the data source - it is more effective to spend the record table to your form that it must pass a ref cursor Using a ref cursor, you might as well just using a standard called cursor and loops on your named cursor. The effect is the same (a line returned at the same time creating lots of network traffic). Using the table of records is more efficient because the data set is returned if the network traffic is reduced.

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

  • Retrieve the Ref cursor data

    Hello

    Here is the plsql code, I try to extract the data from the refcursor

    Declare
    number of l_ecg_id_in;
    number of l_error_code_out;
    l_cur_out sys_refcursor;
    Begin

    l_ecg_id_in: = 1249551;

    -Call the procedure
    pkg_dispatch.sp_getecgreport (p_ecg_id_in = > l_ecg_id_in,)
    p_cur_out = > l_cur_out, / / p_cur_out is back refcursor datat
    p_error_code_out = > l_error_code_out);


    Now my requirement is data retrieves in l_cur_out have too many columns, the columns are mentioned below.
    HUMAN RESOURCES
    PR
    DR
    BATTERY
    ETC.

    I want to just HR to be extacted in a variable or a collection of type

    We can extract a particular of ref cursor column, please suggest me



    End;

    Sudhir_Bangalore wrote:

    Now my requirement is data retrieves in l_cur_out have too many columns, the columns are mentioned below.
    HUMAN RESOURCES
    PR
    DR
    BATTERY
    ETC.

    I want to just HR to be extacted in a variable or a collection of type

    Then, you use the wrong cursor and you performance degradation because the cursor returns data that is not required.

    We can extract a particular of ref cursor column, please suggest me

    You can not.

    Workaround would be to copy the handle of the cursor ref to a handle to the cursor DBMS_SQL and then use cursor DBMS_SQL to treat the projection of SQL. But it would be an ugly hack.

    The right approach would be to correctly use the SQL cursors in PL/SQL. And no, ref Cursor in PL/SQL (created by code PL/SQL to PL/SQL code) is almost always the WRONG choice.

    There are better native cursor data types in PL/SQL in particular supported cursors created by PL/SQL and PL/SQL.

    REF CURSOR is provided mainly as the cursors created by PL/SQL for an external client. There are very few reasons to create Ref cursors to use PL/SQL code.

  • Recovery of the records by using the Ref Cursor or indexes per Table (which is better)

    Hi all

    I am interested to know if there is a performance (or other) advantages to return a result set from an Oracle stored procedure for a client application (for example, in Java) by using a Ref Cursor or Index by Table, respectively. Most of the people I met who know Java seem to use a Ref Cursor but did not say why this method is preferable. I'm not too familiar with Java and do not have the opportunity to test the difference between either method, but I am very interested in the other user forum about this view, gauging

    Kind regards

    Kevin.

    KevinFitz wrote:
    Hi zerathul,

    Thanks for the quick and helpful response. A REF CURSOR would be the best solution if the same set of results (content and number of records returned) should be dealt with by the application of the 'customer '. I'm guessing that maybe in this situation 'theoretical' that there might be less network traffic to return the set of results through an associative array,

    Kind regards

    Kevin.

    Yes, it would always be the best solution, because an associative array would mean collecting all the data in memory of expensive PGA on the database server before they pass any return on the network, while a fair Ref cursor is to feed the data over the network (maybe a little extra load, but you were unlikely to notice). Also the client application would treat a ref as of rows returned cursor data recovery and could treat them upon their arrival, an associative array is a collection of data which will then be entirely spent before any treatment could be done and then the treatment should go through the entire table to do.

    REF CURSOR will also provide other information such as the error codes etc regarding SQL if necessary. If you get an error when filling a table on the side of the database, it is not so easy to recover this error to the client.

    REF CURSOR is designed for this purpose. Use them.

  • REF CURSOR in DB

    Hello

    I have a procedure in the scheme, saying, 'a' DB 'A' that returns a REF CURSOR. I run the procedure of a 'b' in 'B' DB schema However, it gives me an error "end of file...". '. Is it because only Oracle does not support REF CURSOR to be sent to the DB? If so, are there alternatives to achieve the result expected in b@B?

    Thanks in advance

    Is it because only Oracle does not support REF CURSOR to be sent to the DB?

    Yes:

    »
    A cursor variable is allowed in a RPC Server-server only if the remote database is not a database of accessible Oracle via a procedural bridge.
    «

  • Call a procedure stored via JDBC with a REF CURSOR * input variable.

    Hello

    S/n of my client has provided me with a stored procedure that I need to call to get information about products prices. Something along the lines of:

    some_package.getPrices (products IN OUT csr_type);

    where csr_type represents a REF CURSOR. This cursor has a product ID column and a price column. The plan is to move the cursor with the populated product id column and have the routine decorate the slider with the prices.

    The setting in this plan is that it seems that it is not possible to go from JDBC REF CURSOR in . However, I'm not sure, since I can only find throw comments on various forums (e.g. http://www.orafaq.com/forum/t/35088/0/), without any reference. If I go back to the client and tell them that their idea will not work, I prefer to be able to point them to a documentation somewhere

    So I guess my questions are:

    1. it is indeed impossible to pass a REF CURSOR type as a variable input on JDBC to a stored procedure?

    2. is there information I can do about my client?

    3. am I on the right track thinking I need to go down the path of an array of objects?

    Thank you very much to anyone who can help
    Peter Svehla.

    Hi Peter,.

    I see it, missed that you actually want to pass in a list of products. Don't think that you can do this with the current procedure. A slider is just a pointer to a result set.
    How the result set is created and what it looks like, is determined when the cursor is opened.

    What does this procedure with the cursor? -It does not have some OPEN TO ; inside?

    Or, perhaps, you are supposed to send in an open cursor (does not much sense to me)?

    Concerning
    Peter

  • REP-0737: must be a function of return type 'ref cursor.

    Hi all

    I have create a ref cursor query in reports 10 g. But it is giving error REP-0737: must be a function of return type 'ref cursor.

    Here is my code

    function QR_1RefCurDS return sys_refcursor is
    
     My_Cur Sys_Refcursor;
    begin
      Open My_Cur for select * from scott.emp order by deptno;
      return My_Cur
    end;
    

    fate of the screen.

    Ref_Cursor_in_reports10g.jpg

    Oracle Forms/Reports has a complete PL/SQL engine and (only) the SQL parser.

    However, the engine of forms/States PL / SQL and SQL Analyzer are at a level that was in the Oracle 8.0 database.

    So, in the forms/States functions/procedures and forms/States triggers, you can not use SQL commands that did not exist in the 8.0 database.

    The predefined SYS_REFCURSOR type is introduced in Oracle 9i.

    Use this:

    PACKAGE test_rc IS

    TYPE of rc_type IS REF CURSOR RETURN emp % ROWTYPE;

    END;

    FUNCTION RETURN QR_1RefCurDS Test_rc.rc_type IS

    test_rc.rc_type RC;

    BEGIN

    OPEN the RC to SELECT * FROM emp;

    RETURN rc;

    END;

    Kind regards

    Zlatko

  • Ref Cursor remote procedure fails

    Remote database server Oracle 9iR2 1

    Local database server Oracle 10 g 2 2

    Remote procedure:

    CREATE OR REPLACE PROCEDURE p_get_results (   i_query   IN   VARCHAR2
                                                , o_refc    OUT  sys_refcursor
                                              )
    AS
    BEGIN
        IF ( i_query IS NULL )
        THEN
             RAISE_APPLICATION_ERROR(-20001,'The paramter i_query cannot be null') ;
        END IF ;
    
    
        OPEN o_refc FOR i_query ;
        
        EXCEPTION
            WHEN   others   THEN
                 RAISE ;
    END p_get_results ;
    /
    
    

    Local PL/SQL block

    SQL> var i_query varchar2(100)
    SQL> var o_refc refcursor
    SQL> exec :i_query := 'select count(*) from oo_attrs'
    
    
    SQL> exec p_get_results@demo_oo2 (:i_query,:o_refc)
    
    
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01001: invalid cursor
    
    

    Check the link works and request db:

    SQL> select count(*) from oo_attrs@demo_oo2;
    
      COUNT(*)
    ----------
           225
    

    Am I missing something here?

    Am I missing something here?

    Yes - you cannot use REF CURSOR over links to db.

  • Ref cursor error message

    Hello expert;

    I have a function that returns a ref cursor, but the function may not return anything. I would like to know what is the best way to manage the error message

    ORA-06503: PL/SQL: function returned no value - slider Ref

    .. Please see below.

    function f_de return latest_cur is
    my_l_cur l_cur;
    
    begin
    open my_l_cur for
    select max(dateadded) as dateadded
    from tbl_test;
    end;
    

    I was wondering what is the best way to manage. I know I could use a count, and if the number is greater than 0, manipulate, but I was looking for the best way to manage it.

    user13328581 wrote:

    Hello expert;

    I have a function that returns a ref cursor, but the function may not return anything. I would like to know what is the best way to manage the error message

    ORA-06503: PL/SQL: function returned no value - slider Ref

    .. Please see below.

    1. latest_cur the f_de function return is
    2. my_l_cur l_cur;
    3. Start
    4. Open the my_l_cur for
    5. Select max (dateadded) as dateadded
    6. of tbl_test;
    7. end;

    I was wondering what is the best way to manage. I know I could use a count, and if the number is greater than 0, manipulate, but I was looking for the best way to manage it.

    by definition a FUNCTION returns a value, but your code isn't working; Therefore, the error is thrown.

    RETURN MY_L_CUR;

    the top line should take place before the END; statement.

  • Apex and accept Ref Cursor?

    Apex and accept Ref Cursor?

    Apex and accept objects?

    can someone help me please.

    Hi Nani4850,

    Nani4850 wrote:

    Apex and accept Ref Cursor?

    Apex and accept objects?

    The language of business for APEX is PL/SQL, so yes you can use REF CURSOR and pass objects to you packaged functions/procedures.

    How does this relate to Oracle APEX?

    Please explain what you plan to use a REF CURSOR in the APEX.

    Kind regards

    Kiran

  • Ref Cursor

    Hi guys,.

    You can develop the ref cursor please. I'm new to the plsql...

    Hi Alex,

    Introduction to the REF CURSOR

    With the help of REF CURSOR s is one of the most powerful, flexible and scalable means to return the query results to an Oracle database to a client application.

    A REF CURSOR is a PL/SQL data type whose value is the memory address of a workspace of query on the database. In essence, a REF CURSOR is a pointer or a handle to a game on the database of results. REF CURSOR s are represented by the OracleRefCursor class ODP.NET.

    REFCURSORs have the following characteristics:

    • A REF CURSOR refers to a memory on the database address. Therefore, the client must be connected to the database during the lifetime of the REF CURSOR to access.
    • A REF CURSOR involves a round-trip of additional database. While the REF CURSOR is returned to the customer, the actual data is not returned until the customer open it REF CURSOR and requests the data. Note that the data are not be retrieved until the user tries to read it.
    • A REF CURSOR is not editable. The result set represented by the REF CURSOR is read-only. You cannot update the database using a REF CURSOR .
    • A REF CURSOR is not back with scroll. The data represented by the REF CURSOR is only accessible in a way before and in series. You cannot position a record pointer inside the REF CURSOR to point to records in the result set.
    • A REF CURSOR is a PL/SQL data type. You create and return a REF CURSOR within a block of PL/SQL code.

    See this link which explained on cursor by Zerathul ref: PL/SQL 101: understanding Ref Cursor

    Kind regards

    Jitendra

  • I know the example of Ref Cursor

    I tried to learn the Ref cursor, I can't find simple example. can anyone of you please tell me a Ref Cursor?

    Okies, I'll try that...

    Thank you very much.

Maybe you are looking for