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.

Tags: Oracle Development

Similar Questions

  • 2 running, 1 inside and 1 sql external, dynamic queries using loops and ref Cursor

    Hi all

    I'm under Oracle 10.2.0.2. I'm currently building dynamic sql using external and internal queries ref Cursor. Queries make use of user selected lists of ID, which is stored in a table in memory at run time. My example is as follows. From a list of book_publication_id on a web page, the user selects several books. The same user selects then several maps from a list of map_publication_id on the same web page. A book contains several maps and some of these cards will appear in more than one book (aka many many relationships).

    This should then ask the following output to a new web page:
    Outer loop:  Display book details for book_publication_id 230
      Inner loop:  Display 1st map details for map_publication_id 340
      Inner loop:  Display 2nd map details for map_publication_id 346
      Inner loop:  Display 3rd map details for map_publication_id 350
    Outer loop:  Display book details for book_publication_id 240
      Inner loop:  Display 1st map details for map_publication_id 346
      Inner loop:  Display 2nd map details for map_publication_id 375
    Outer loop:  Display book details for id 255
    and so on.
    In the example above, the outer loop displays the details of the book for book_publication_id 230 and the inner loop displays all the users selected the maps in book_publication_id 230. Then, it moves on the details of the book for book_publication_id 240 and done the same thing again. Similar in some ways to how break would work in SQL * Plus, even if the table is built like an HTML, the book details must be on a separate line for the card details. However I don't know how I would want it to work.

    So far, using loops, I could not show all the details of card for each different book_publication_id, after the details of the book for only 1 book_publication_id are displayed each time. If a loop in a loop. I hope that makes sense. I think this is my internal request that it be built differently. My code for this part of the program, which is currently wrong, is as follows:
    --Global variable section contains:
    var_user_chosen_map_list_ids VARCHAR2(32767);
    var_details VARCHAR2(32767);
    ......
    PROCEDURE PROCMAPSEARCH (par_user_chosen_map_list_ids PKG_ARR_MAPS.ARR_MAP_LIST)
    IS
    BEGIN
    FOR rec_user_chosen_map_list_ids IN 1 .. par_user_chosen_map_list_ids.count
    LOOP
       var_user_chosen_map_list_ids := var_user_chosen_map_list_ids || 
       '''' || 
       par_user_chosen_map_list_ids(rec_user_chosen_map_list_ids) || 
       ''',' ;
    END LOOP;
     var_user_chosen_map_list_ids := substr(var_user_chosen_map_list_ids,
                                            1, 
                                            length(var_user_chosen_map_list_ids)-1);
    var_details := FUNCMAPDATAFIND (var_user_chosen_map_list_ids);
    htp.print(var_details);
    END PROCMAPSEARCH;
    FUNCTION FUNCMAPDETAILS (par_user_chosen_map_list_ids IN VARCHAR2(32767)
    RETURN VARCHAR2
    AS
    TYPE cur_type_map IS REF CURSOR;
    cur_book_search cur_type_map;
    var_book_date NUMBER(4);
    var_book_title VARCHAR2(32767);
    cur_map_search cur_type_map;
    var_map_date NUMBER(4);
    var_map_title VARCHAR2(32767);
    begin:
    OPEN cur_book_search FOR
    'SELECT BI.book_date,
            BT.book_title
     FROM   BOOK_INFO BI,
            BOOK_TITLE BT,
            TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_book_list_ids || ')) BL_1
     WHERE BI.book_title_id = BT.book_title_id
     AND BI.book_publication_id = BL_1.column_value';
    OPEN cur_map_search FOR
    'SELECT MI.map_date,
           MT.map_title
    FROM map_info MI,
         map_title MT,
         TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_book_list_ids || ')) BL_2
         TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_map_list_ids || ')) ML
    WHERE MI.map_title_id = MT.map_title_id
    AND BI.book_publication_id = BL_2.column_value
    AND BI.book_publication_id = MI.pub_publication_id
    AND MI.map_publication_id = ML.column_value';
    LOOP
    LOOP
    FETCH cur_map_compare INTO
    var_book_date,
    var_book_title;
    var_details
    var_details := var_details || 'Book date: '||
                        var_book_date ||
                        'Book title: ' ||
                        var_book_title;
    FETCH cur_map_compare INTO
    var_map_date,
    var_map_title;
    var_details := var_details || 'Map date: '||
                        var_map_date ||
                        'Map title: ' ||
                        var_map_title
    EXIT WHEN cur_book_compare%NOTFOUND;
    END LOOP;
    EXIT WHEN cur_map_compare%NOTFOUND;
    END LOOP;
    RETURN var_details;
    END FUNCMAPDETAILS;
    If anyone has any ideas or suggestions, I would be grateful. It is an extension of my previous code, I posted a question recently. As I am working and learning a step at a time, I left this idea in my previous question, that I had to make sure I knew that first.

    Kind regards

    Tim

    Using dynamic SQL

    declare
      dd sys_refcursor;
      ee sys_refcursor;
      d dept%rowtype ;
      e emp%rowtype ;
    begin
    open dd for 'select * from dept' ;
    loop
    fetch dd into d ;
    exit when dd%notfound ;
    dbms_output.put_line('Department:'||d.dname);
      open ee for 'select * from emp where deptno='||d.deptno ;
      loop
      fetch ee into e ;
      exit when ee%notfound ;
      dbms_output.put_line('..Employee:'||e.empno||':'||e.ename);
      end loop;
    end loop ;
    end ;
    /
    Department:ACCOUNTING
    ..Employee:7782:CLARK
    ..Employee:7839:KING
    ..Employee:7934:MILLER
    Department:RESEARCH
    ..Employee:7369:SMITH
    ..Employee:7566:JONES
    ..Employee:7788:SCOTT
    ..Employee:7876:ADAMS
    ..Employee:7902:FORD
    Department:SALES
    ..Employee:7499:ALLEN
    ..Employee:7521:WARD
    ..Employee:7654:MARTIN
    ..Employee:7698:BLAKE
    ..Employee:7844:TURNER
    ..Employee:7900:JAMES
    Department:OPERATIONS
    
    PL/SQL procedure successfully completed.
    

    HTH

    SS

  • Pipelined table vs ref cursor in a function return

    Hi gurus,

    Everybody has discovered that a (subject) is faster on the other? Data will be primarily consumed from an external application (.net). What are the benefits? I can't decide if that use is

    Thank you very much.

    user12868294 wrote:
    Hi gurus,

    Everybody has discovered that a (subject) is faster on the other? Data will be primarily consumed from an external application (.net). What are the benefits? I can't decide if that use is

    Thank you very much.

    They are two different things.

    A pipeline table acts as an array, but you must always choose in it and so if your consumption that in .net, you would still use a Ref Cursor I guess to query this table in pipeline (I guess .net is not query the tables directly, but must use some sort of slider Ref?)

    Tables in pipeline can be fast, but it depends on what you need to. Is there a reason why you really need a feature in pipeline? If this is not the case, just use a normal query with a Ref Cursor, so your .net application only retrieves the data properly.

  • sys_refcursor and Ref Cursor

    Hello

    I found this diffrence between ref and sys_refcursor slider.

    If you specify return_type, then the variables of type and slider REF CURSOR of this type are strong; If not,
    they are weak.
    The variables SYS_REFCURSOR and slider of this type are weak.

    my situation is that I must write a procedure stored so many reports entery pages. little enter pages use typed data groups and can't.

    so please tel me what is the best in terms of performance and maintainability above three conditions?

    Yours sincerely

    944768 wrote:

    my situation is that I must write a procedure stored so many reports entery pages. little enter pages use typed data groups and can't.

    Called stored procedures what and where?

    If, with a layer of app such as Java or .net, then they do not distinguish between weak and strong ref Cursor - because it is a concept of PL/SQL.

    And by using a ref cursor type in PL/SQL is intended to provide a mechanism to pass the handle of real cursor SQL cursor created in this session, the client (for example Java or .net). Nothing more. So, why even care that PL/SQL? a weak or strong Ref to the application layer slider

    so please tel me what is the best in terms of performance and maintainability above three conditions?

    I find always frustrating that there is this concept that some methods to create cursors, results in faster and better than other methods, the sliders. It is a concept of bs. All SQLs are analyzed as a SQL cursors. Each. Unique. One. By the SAME CBO.

    If the client code (Java, PL/SQL or other) you write for this SQL cursor DOES NOT change the source SQL.

    This therefore does not cause the CBO now compile a different SQL execution plan for her. The CBO does not care if your code uses a strong Ref Cursor or a weak Ref Cursor, or a slider DBMS_SQL, an explicit cursor, or whatever. Those are concepts of customer. And do not change the execution plan of cursor SQL on the server. Or its planned performance/cost.

    Yes, your client code (Java, PL/SQL, etc.) can use the SQL cursor on the server-side evil - and this can affect performance.

    But waiting for a weak Ref cursor will somehow cause a faster cursor or slower for the same SQL statement, that a strong Ref cursor is not understanding what SQL cursor is, and how the customer interacts with its data types, the classes of customers and its customer interfaces with this SQL cursor.

  • Authentication using the table and the existing database

    Very new to APEX here. In authentication methods and was curious to know if it is possible to link the Apex on an existing Oracle database and the table to get information for user name and password. Trying to use the employe_id and last 4 of their social.

    Any ideas or things I can read up to get a general idea?

    JosephPortello wrote:
    fac586, thank you. I didn't even know what I had done.

    Yet one thing that happens now after I corrected my incorrect syntax.

    CREATE OR REPLACE FUNCTION EmployeeIDAuth (
    p_username IN VARCHAR2,
    p_password IN VARCHAR2
    )
    RETURN BOOLEAN
    IS
    form l_count NUMBER;
    BEGIN
    SELECT COUNT(*) into l_count from table@db WHERE employee_no=p_username AND bdate=p_password;
    IF l_count > 0 THEN
    RETURN TRUE;
    ELSE
    RETURN FALSE;
    END IF;
    END; 
    

    Now returns an error of:

    Error on line 15: PLS-00103: encountered the symbol "end-of-file" when expects it one of the following values:

    not end up dominant static of final instantiable order pragma
    manufacturer membership card
    1. CREATE OR REPLACE FUNCTION EmployeeIDAuth)
    2 p_username IN VARCHAR2,
    3 p_password IN VARCHAR2

    Any other ideas?

    Remove the false token form.

  • I get "failed to set the refresh attribute COMMIT for the materialized view" when I try to create a MV using a table and another MV

    Experts,

    I'm trying to create a YOUNG refreshable ON COMMIT MV (xyz) using a table (circuit) and quickly updateable on validation MV (abc), but get an error:

    SQL error: ORA-12054: cannot set the attribute ON COMMIT refresh for the materialized view

    12054 00000 - "cannot set the refresh attribute COMMIT for the materialized view.

    * Cause: The materialized view did not meet the requirements for update to

    moment of validation.

    * Action: Specify only valid options.

    1] MV abc
    = MV abc defined as below =.

    CREATE MATERIALIZED view abc_MV

    Immediate CONSTRUCTION

    REFRESH QUICKLY YOU COMMIT using constraints of trust

    WITH ROWID AS SELECT n.*,.

    n.ROWID noderowid

    node n

    where n.nodetype in (1610000069,1610007267);


    -Above works OK and MV connect you on table node is created successfully

    =====================================================

    [ 2] Circuit Board

    ======================================================

    CREATE MATERIALIZED VIEW LOG ON Cramer.Circuit WITH SEQUENCE, ROWID ( ) -all columns of table ofcircut parentheses

    INCLUDING THE NEW VALUES;

    -More top works OK and MV connect you on table circuit is created successfully

    ======================================================



    [3] trying to create MV xyz

    ======================================================

    CREATE MATERIALIZED VIEW LOG ON cramer.abc_MV WITH SEQUENCE, ROWID ( ) -all columns of abc_MV brackets

    INCLUDING THE NEW VALUES;

    -Above works OK and log on ABC MV MV gets created successfully

    -Problematic step below

    Xyz_MV CREATE MATERIALIZED VIEW

    IMMEDIATE CONSTRUCTION

    REFRESH QUICKLY YOU COMMIT using constraints of trust

    AS

    SELECT c., c.rowid circuit_rowid, n.rowid tr_rowid

    the circuit c, abc_mv n

    where circuit2startnode = n.nodeid

    and c.rpplanId = n.rpplanId;
    ==========================================================

    Clues on how to solve this problem and make quickly updatable ON Commit MV xyz

    Thanks in advance.

    Chanchal,

    If you can read my original post carefully you may have noticed that all these restrictions will not apply in my case.

    All,

    In any case I found the solution to my problem.

    There are a few additional restrictions for materialized views multilayer

    Additional Restrictions for master materialized views

    The following types of materialized views may not be masters of editable materialized views:

    • ROWIDmaterialized views
    • Complex materialized views
    • Read-only materialized views

    I've updated the underlying MV abc below and everything worked like a charm

    CREATE MATERIALIZED view abc_MV

    Immediate CONSTRUCTION

    REFRESH QUICKLY YOU COMMIT using constraints of trust

    IN SELECT

    n.*, n.rowid noderowid, nt.rowid nodetyperowid

    the node n, nodetype_m nt

    where n.node2nodetype = nt.nodetypeid

    and nt.nodetypeid in (1610000069,1610007267);

    Note: To ADD a join without which I was getting error below (although had primary key on the table of the node)

    SQL error: ORA-23415: materialized view log for "NODE" does not save the primary key

    23415 00000 - "view the log for materialized \"%s\".\"%s\"does not save the primary key.

    * Cause: A primary key materialized view is refreshed quickly, but the

    The materialized view log does not record the primary key information.

    * Action: Use CREATING MATERIALIZED VIEW LOG... Command to add a PRIMARY KEY to

    start recording of the primary key information in the materialized view

    Newspaper.

  • Use of tables and style sheet

    Hi all

    I am strungling using tables in RoboHelp HTML 7, to generate webhelp.
    What I'm trying to accomplish is the use of tables in HR, and have put in the form defined in a style sheet. The html code generated by RH should be nice and clean. If possible, I don't want to go into the HTML code, I prefer the use of the design editor.

    I have the following text into a new file in RoboHelp table Gallery:

    Quote:

    < table >
    < caption > CAPTIONTITLE < / legend >
    < style COL = "" width: 5%; ">"
    < style COL = "" width: 40%; ">"
    < thead >
    < tr > < th > < /th > < th > < /th > < /tr >
    < / thead >
    < tbody >
    < tr > < td > < table > < td > < table > < /tr >
    < tr > < td > < table > < td > < table > < /tr >
    < tr > < td > < table > < td > < table > < /tr >
    < tr > < td > < table > < td > < table > < /tr >
    < / tbody >
    < /table >
  • Benefits of using a table or a view in Oracle

    Hi friends,
    I have a question about the difference between tables and views.

    Greetings

    Girish Sharma wrote:
    Differences between the view and the table:

    A view does not disk space. A fact table.
    A view stores data. A fact table.
    A view cannot be indexed. A table can.

    Yes... but then, someone is bound to point out that views can be materialized in persistent data objects. ++*

    * Looks like we now also lost smileys here... Jives does not introduce any new features, it eliminates existing. Hooray for Jives...

  • I use win 7 and the cursor jumps all over the page when you type

    When you type using windows 7 I find that the cursor jumps around

    It also also increases that you typed!

    Would appreciate, if possible, a simple fix step by step if there is a.

    Juice now this msg has lost about 2 sentences? and I don't know where they are! ??

    Hello

    Laptop?

    Check with the manufacturer of system support, documentation in line, or forums as there
    probably are shortcut keys that enable and disable the touchpad functions.

    Parameters for TouchPad located in the control panel - mouse (there may be several tabs with)
    Entries of TouchPad) and some have a utility that loads in the Notification area near clock on
    at the bottom right. There "may" be the sensitivity settings.

    ==========================================

    If necessary: (make sure that you have restarted at least once, if the above did not work) try to update
    the driver for the TouchPad.

    Panel of configuration-Device Manager - mice and pointing devices - Double click on touch pad
    -Pilot Tab - click on Update Driver (which is may not make anything like MS is far behind certifying)
    (drivers), now right CLICK on the touchpad and UNINSTALL.

    Then go to the USB and UNINSTALL ALL controllers except the category itself (all in).
    RESET

    This will refresh the driver for the TouchPad and battery USB. This does not prevent the touchpad
    of work.

    The similar procedure on XP, Windows 7 and Vista is the same, except that we need to clear
    the device if it is present.
    http://support.Microsoft.com/kb/310575

    Then go to the system manufacturer's website and get the latest touchpad drivers.

    Download - SAVE - go to where you put it-click on - RUN AS ADMIN.

    =================================

    This utility also allows to control the TouchPad:

    TouchFreeze
    http://code.Google.com/p/TouchFreeze/

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • problems with IE7 in the use of tables and onLoad

    Thank you in advance for any help. I have a table that is used to store the names of. Files to load into another SWF. SWF video. When I call the "onLoad" method, it works in all browsers except IE7? See the example below:

    prod_a = new Array;
    prod_a [0] = 12; number of products in the table. Currently, this feature is not used...
    prod_a [1] = "product1.swf";
    prod_a [2] = "product2.swf";
    prod_a [3] = "product3.swf";
    prod_a [4] = "product4.swf";
    prod_a [5] = "product5.swf";

    onLoad = Function)
    {
    Description();
    moveScroller();
    loader_mc.loadMovie(prod_a[1]);
    }

    When the file opens, it loads the '2' slot flash file in the table in the "loader_mc" EXCEPT IT DO WORKS NOT IN IE 7? any ideas or help would be great! IE7 handles the different "onLoad"? I made a mistake?

    Thank you Sly one, but that's not the problem I currentl having a Java work around for this. I tried a few different solutions to the problem "click to activate". I found that none of them made a difference.

    I resorted to a solution of 'disorder' but effective. -items I've been hainvg problems with were dynamically loading the text and images. I had the problem by placing the images and the text which was to load 'onLoad', in the boxes as _mc objects. in this way the images were already there and didn't need to be loaded.

    The only two problems with this is
    (A) Firefox and Safari users (including other) screen "Refresh" the image loading. and
    (B) the size of the file was more than 35 KB.

    Thanks for the help everyone, the final is good enough for Government work...
    -DIG

  • HI I WANT TO USE THREE TABLES AND I WANT THIS OUTPUT THE MESSAGE BELOW...   PLEASE HELP ME OUT

    USER_CONSTRAINT-> > CONSTRAINT_TYPE TABLE_NAME, CONSTRAINT_NAME, WANT

    USER_TAB_COLUMNS-> > WANT DATA_TYPE

    USER_CONS_COLUMNS-> > want TO COLUMN_NAME, POSITION

    AND OUT WILL BE LIKE THIS

    EXIT;

    TABLE_NAME COLUMN_NAME, CONSTRAINT_NAME, CONSTRAINT_TYPE POSITION DATA_TYPE

    EMP                  EMPNO                   PK_EMP                                     P                                                        1                               NUMBER

    EMP                  ENAME                                                                                                                                                               VARCHAR2

    UP TO MIN...

    Just to warm up

    Select uc.table_name, cc.column_name, uc.constraint_name, uc.constraint_type, cc.position, tc.data_type

    from user_constraints uc

    inner join

    user_cons_columns cc

    On cc.owner = uc.owner

    and cc.table_name = uc.table_name

    and cc.constraint_name = uc.constraint_name

    inner join

    USER_TAB_COLUMNS tc

    On uc.table_name = tc.table_name

    and cc.column_name = tc.column_name

    where uc.table_name = 'EMP '.

    TABLE_NAME COLUMN_NAME Constraint_name Constraint_type POSITION DATA_TYPE
    EMP EMPNO SYS_C0019683833 C - NUMBER
    EMP EMPNO SYS_C0019683834 P 1 NUMBER
    EMP MGR SYS_C0019683835 R 1 NUMBER
    EMP DEPTNO SYS_C0019683836 R 1 NUMBER

    Concerning

    Etbin

  • REF CURSOR output and race update

    Hello

    I have a process where I need to make changes in quantity for the products. I want to these products and the quantity of output in a c# application and also update my table of inventory with the new values.

    My question is what is the best way to have a stored procedure out a REF CURSOR (for the purposes of c#) and use the same data that came out in the REF CURSOR to update my table of inventory?

    I have this:

    -USE IT TO GET MY PRODUCTS-
    PROCEDURE sp_get_products)
    r_products ON SYS_REFCURSOR
    )

    IS

    BEGIN

    Select ProductID, InStock
    Products

    END sp_get_products;


    -USE CE TO OUTPUT REF CURSOR and run - UPDATE
    PROCEDURE sp_get_ref_products)
    r_ref_products ON SYS_REFCURSOR
    )

    IS

    type ProductID is the Products.ProductID%type table;
    QTY type is table of the Products.QTY%type;

    l_ProductID ProductID;
    l_QTY QTY;

    BEGIN
    sp_get_products (r_ref_products);

    Get the r_ref_products COLLECT in BULK IN l_ProductID, l_QTY;
    ForAll indx l_ProductID.first... l_ProductID.Last
    Update product p
    Set p.QTY = l_QTY (indx)
    Where p.ProductID = l_ProductID (indx);

    COMMIT;


    END sp_get_ref_products;

    Maybe you're not understanding what is a Ref Cursor. It does not store a result set.

    Take a read of this thread:

    [PL/SQL 101: understanding Ref Cursor | http://forums.oracle.com/forums/thread.jspa?threadID=886365&tstart=0]

  • Made Oracle 6i LOV with ref cursor returned by a function of database

    Hi all

    I want to dynamically create a LOV in oracle forms 6i using the value of ref cursor returned by the function of database.

    is this possible?

    Using loop, I could able to display the values returned by the ref cursor, but how can I assign these values in the LOV?

    You will need to loop through your REF Cursor and assign each value to a group of registration of forms and then assign the Group Record to your LOV.  Take a look at the built-ins CREATE_GROUP, ADD_GROUP_COLUMN and ADD_GROUP_ROW in the help system of forms for more information about how to use these built-ins and examples of how to use them.

    Craig...

  • Ref Cursor on implicit and explicit cursors

    Hello

    In my company the drafting of PL/SQL procedure, everyone uses "Ref Cursor",
    But the article below, said implicit is the best, then Explicit and Ref Cursor...

    [http://www.oracle-base.com/forums/viewtopic.php?f=2 & t = 10720]

    I'm a bit confused by this, can someone help me understand this?

    Thank you

    SeshuGiri wrote:

    In my company the drafting of PL/SQL procedure, everyone uses "Ref Cursor",
    But the article below, said implicit is the best, then Explicit and Ref Cursor...

    [http://www.oracle-base.com/forums/viewtopic.php?f=2&t=10720]

    I'm a bit confused by this, can someone help me understand this?

    It has performance and it has performance...

    To explain. There is one type of cursor in Oracle - that is the cursor which is analyzed and compiled by the SQL engine and stored in the shared the database pool. The "+ client +" then receives a handle (called a SQL statement handle of many APIs) that can be used to make reference to this slider in the SQL engine.

    The performance of this slider is not determined by the customer. It is determined by the execution plan and how much enforcement of this slider cost ito of server resources.

    The customer can be Java, VB, .net - or a PL/SQL program. This client language (SQL client), has its own structures dealing with this from the SQL engine cursor handle.

    It can hide by the developer all together - so that they can't even see that there is a statement handle. That's what the implicit cursors in PL/SQL.

    It can allow the developer to manually define the structure of slider - this is what the explicit cursors, ref Cursor and DBMS_SQL cursors in PL/SQL.

    Each of these client cursor structures provides the programmer with a set of features to address different SQL cursor. Explicit cursor in PL/SQL constructs do not have the use of dynamic SQL statements. REF CURSOR and cursors DBMS_SQL do. REF CURSOR does not allow the programmer determine, at runtime, the structure of the projection of the cursor SQL. DBMS_SQL sliders do.

    Only ref Cursor can be created in PL/SQL and then handed over to another client (for example, Java/VB) for treatment. Etc.

    If each of the works of art/customer interfaces gives you a different feature for SQL cursors.

    Choose the implicit cursors for example does not the SQL cursor move faster. The SQL engine does not know and does not care, which customer construct you use to deal with the SQL cursor handle, he gave you. It does not matter. It does not affect his performance of cursor SQL.

    But on the client side, it can matter - if your code when dealing with that SQL cursor determines how fast your interaction with this SQL cursor is. How many context changes you make. How you use and reuse the SQL (for example hard vs soft analysis vs analysis reusing the same cursor handle). Etc.

    Are there any unique client cursor construction which is better? N °

    It's ignorant views. The customer's language provides a box tool, where each tool has a specific application. The competent developer will use the right tool for the job. The stupid developer will select a tool and use it as The Hammer to 'solve' all problems.

  • Ref cursor vs dbms_sql

    Hello

    What is the difference between dbms_sql and ref cursor.

    Thank you

    Smidreb wrote:

    What is the difference between dbms_sql and ref cursor.

    Client language interfaces of SQL cursors.

    All SQL are analyzed, stored and runs as sliders (including anonymous PL/SQL blocks). All cursors are equal. In other words, there is no such thing as a ref cursor or implicit cursor or cursor DBMS_SQL in the SQL engine. There are only cursors and they work all the same. There is a standard Oracle Call Interface to create and use and throw sliders.

    On the side of the customer's language (PL/SQL, Java, C/C++, etc.), there are usually a number of interfaces of client language by using the Oracle Call Interface for dealing with the sliders.

    In Delphi for example, there are different classes for different types of sliders (dynamic SQL statements, static SQL on a table, PL/SQL calls, etc.). In PL/SQL, there are also various interfaces in the language for using cursors.

    REF CURSOR is such an interface - with a specific feature to create and analyze the cursor using PL/SQL and then switch this slider handle to an external client language so he could use it.

    DBMS_SQL is a simplistic implementation of the actual Oracle Call Interface for cursors. Lower level stuff - this is basically how it works under the hood when dealing with a slider. Features are dynamic, binding and dealing with dynamically projection SQL cursors. This is widely used by applications such as Apex which deals really dynamic SQL and all aspects of it.

Maybe you are looking for

  • I can't access some websites using Firefox. For my own site, I get "file not found". My Yahoo downloads in the form of text. No problems with browsers IE or Chrome

    I can't access some websites using Firefox. Pages say "File not found" or in the case of Yahoo and Facebook, they resemble the on-screen text files. No problems with my computer and it is not the case with my browsers IE and Chrome. Already deleted a

  • Activation key

    Hi all I just want to know where can I get the activation key for the 8.1 of Windows that comes with theHP laptop 15-r011dx. Generally, the key is located at the bottom of the laptop, but this time it didn't this sticket. I only have Windows 8 logo s

  • 6259

    Hello I am currently using the connected to a block TBX-68 and Labview 2010 6259.  Basically, I'm trying to just use it for a multimeter to get accurate and timely measures, but there is something I don't understand all the examples in Labview. My pr

  • HP Envy x 2 - my camera said "There was a problem take this photograph.

    Hi guys, I have the new HP Envy x 2 and I appreciate it. There is just this slight little problem. Whenever I open the application "Camera" or "Youcam", I get a message that says that there is a problem taking this photograph. This happens when I try

  • 64-bit programs fail to run on a 64 bit OS

    On a system running freshly installed with Windows 7 Home Premium 64 bit, when I try to install VLC 64-bit or 7 Zip 64-bit or any other program for that matter, even as an administrator (rt click Run as admin) or otherwise, the pointer icon shows jus