Link Query and Ref Cursor Query

Hi all!!
How can I link Query and Ref Cursor Query??
I mean, How can I pass input parameters to the PL/SQL procedure if they are not User parameters but they come from another table??
Thanks a lot
F.

I have searched the forum and this is the closest to my problem.
Just started using ref cursors in my reports.
The problem I am running into is that I have two ref cursor queries in my report - they each contain a column named seq_no which forms a join (in the database) .
My report returns the correct number of records in each query, but I can't find a way to enforce the join. I've tried all the methods I can think of including combining the results into one query.
The IDE won't let me join on a column and when I join on the group (which I make only contain the seq_no fields) that join is ignored.
Can anyone help me on this?

Similar Messages

  • Cursors are not closed when using Ref Cursor Query in a report  ORA-01000

    Dear Experts
    Oracel database 11g,
    developer suite 10.1.2.0.2,
    application server 10.1.2.0.2,
    Windows xp platform
    For a long time, I'm hitting ORA-01000
    I have a 2 group report (master and detail) using Ref Cusor query, when this report is run, I found that it opens several cursors (should be only one cursor) for the detail query although it should not, I found that the number of these cursors is equal to the number of master records.
    Moreover, after the report is finished, these cursors are not closed, and they are increasing cumulatively each time I run the report, and finally the maximum number of open cursors is exceeded, and thus I get ORA-01000.
    I increased the open cursors parameter for the database to an unbeleivable value 30000, but of course it will be exceeded during the session because the cursors are increasing cumulatively.
    I Found that this problem is solved when using only one master Ref Cursor Query and create a breake group, the problem is solved also if we use SQL Query instead of Ref Query for the master and detail queries, but for some considerations, I should not use neither breake group nor SQL Query, I have to use REF Cursor queries.
    Is this an oracle bug , and how can I overcome ?
    Thanks
    Edited by: Mostafa Abolaynain on May 6, 2012 9:58 AM

    Thank you Inol for your answer, However
    Ref Cursor give me felxibility to control the query, for example see the following query :
    function QR_1RefCurDS return DEF_CURSORS.JOURHEAD_REFCUR is
    temp_JOURHEAD DEF_CURSORS.JOURHEAD_refcur;
              v_from_date DATE;
              v_to_date DATE;
              V_SERIAL_TYPE number;
    begin
    SELECT SERIAL_TYPE INTO V_SERIAL_TYPE
    FROM ACC_VOUCHER_TYPES
    where voucher_type='J'
    and IDENT_NO=:IDENT
    AND COMP_NO=TO_NUMBER(:COMPANY_NO);
         IF :no_date=1 then
                   IF V_SERIAL_TYPE =1 THEN     
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
                   AND IDENT=:IDENT
              AND ((TO_NUMBER(VOCH_NO)=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
              OR (TO_NUMBER(VOCH_NO) BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
              OR (TO_NUMBER(VOCH_NO)<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
              OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))
                   ORDER BY TO_NUMBER(VOCH_NO);
                   ELSE
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
                   AND IDENT=:IDENT               
              AND ((VOCH_NO=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
              OR (VOCH_NO BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
              OR (VOCH_NO<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
              OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))     
                   ORDER BY VOCH_NO;          
                   END IF;
         ELSE
                   v_from_date:=to_DATE(:from_date);
                   v_to_date:=to_DATE(:to_date);                         
              IF V_SERIAL_TYPE =1 THEN
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
              AND IDENT=:IDENT                         
                   AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
                   OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
                   OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
                   OR (:from_date is null and :to_date is null ))     
                   ORDER BY VOCH_DATE,TO_NUMBER(VOCH_NO);     
              ELSE
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
                   AND IDENT=:IDENT                         
              AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
                   OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
                   OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
                   OR (:from_date is null and :to_date is null ))     
                   ORDER BY VOCH_DATE,VOCH_NO;          
              END IF;
         END IF;               
         return temp_JOURHEAD;
    end;

  • How to write REF-CURSOR Query in Oracle Reports

    Hello Guys!!
    I have a form in which you can select regions/divisions/locations etc by the use of check boxes. And the selected values will be inserted into a table, and based on the selected values of the table the report is run.
    The issue I have is with the query inside the Oracle reports(attached to this file).
    The query works fine until the last two EXISTS conditions.
    IF a region exists In the table report_param then it works fine but if there are no divisions in it , then the query returns no values, which is not correct.
    Someone has advised me to use a ref-cursor query inside reports tool, which I am not aware off. So, anykind of suggestions or advises are welcome. Please let me know about it as it is very urgent issue for me. Anykind of help would be greatly
    appreciated.
    Thanks,
    Vishal
    -------------------------------------------------------Query in Oracle Reports---------------------------------------------------------
    select c.key_segment, p.supplier_id,
    decode(:in_col_nm, 'BRAND',nvl(p.product_brand,'<Unknown Brand>'), 'PLN',nvl(p.product_legal_name,'<Unknown Legal Name>')) COL_NM,
    sum(a.ext_price) sales_dols,
    sum(comp_allow_pkg.get_comp_allow_stddiv(a.control_loc_id, a.product_id, a.sold_to_customer_id,
    a.doc_dt, a.ext_price, a.units)) cust_reb_dols,
    sum(a.units) units,
    sum(a.ext_cost) cost_dols
    from sales a, key_segment_plns c, product p, rep_wrtr_dw_cust h
    where a.doc_dt between :in_start_dt and :in_end_dt
    and a.customer_oc = h.control_loc_id
    and a.sold_to_customer_id = h.sold_to_cust_id
    and a.ship_to_customer_id = h.ship_to_cust_id
    and ((:in_dg_cd = 'B' and h.dealer_grower_cd in ('D','G')) or h.dealer_grower_cd = :in_dg_cd)
    and a.product_id = p.product_id
    and p.product_gl_class_cd = 'CHEM'
    and p.product_legal_name = c.product_legal_name
    and c.key_segment in ('GLYPHOSATE','PLANT HEALTH/RUST FUNGICIDES','PYRETHROIDS','STROBI FUNGICIDES')--&IN_KEY_SEGMENTS
    -- and (:in_oc = 'ALL' or (a.control_loc_id in (select control_loc from control_loc_comb_ocs where control_loc_comb = :in_oc)))
    -- SALES DATA FILTERS TO MATCH ACCUM_SALES_DG_MV
    and a.sale_type_cd in ('02','08')
    and a.document_type_cd in ('I','C','D')
    and (substr(a.product_id,-1) in ('0','1') OR nvl(upper(trim(p.product_brand)),'X') = 'TECH FEE')
    and a.units <> 0
    and a.unit_cost <> 0
    and a.unit_price <> 0
    -- NEW FILTERS ADDED 9/11/07: LOCATION(BRANCH), BUSINESS TYPE, RSM/ASM/REP
    and ((:in_loc = 'ALL') or (nvl(a.warehouse_id,'<blank>') in (SELECT param_value
    FROM report_param
    WHERE report_id = :IN_REPORT_ID
    AND session_id= :IN_SESSION_ID
    AND USER_ID = :IN_USER_ID
    AND param_name='LOCATION_TYPE')))
    and ((:in_uhs_ag = 'ALL') or (:in_uhs_ag = 'NA' and p.product_uhs_ag != 'A') or (p.product_uhs_ag = :in_uhs_ag))
    and ((:in_sales_rep = 'ALL') or (nvl(a.territory_id,'<blank>') in (SELECT param_value
    FROM report_param
    WHERE report_id = :IN_REPORT_ID
    AND session_id= :IN_SESSION_ID
    AND USER_ID = :IN_USER_ID
    AND param_name='SALES_REP_TYPE')))
    and EXISTS
    (SELECT '1'
    FROM locations l, report_param rp
    WHERE rp.report_id = :IN_REPORT_ID
    AND rp.session_id= :IN_SESSION_ID
    AND rp.user_id = :IN_USER_ID
    AND rp.param_value = l.region
    AND rp.param_name = 'REGION_TYPE'
    AND a.warehouse_id = L.ARS_LOCATION)
    and EXISTS
    (SELECT '1'
    FROM locations l, report_param rp
    WHERE rp.report_id = :IN_REPORT_ID
    AND rp.session_id= :IN_SESSION_ID
    AND rp.user_id = :IN_USER_ID
    AND rp.param_value = l.region
    AND rp.param_name = 'DIVISION_TYPE'
    AND a.warehouse_id = L.ARS_LOCATION)
    group by c.key_segment, P.supplier_id,
    decode(:in_col_nm, 'BRAND',nvl(p.product_brand,'<Unknown Brand>'), 'PLN',nvl(p.product_legal_name,'<Unknown Legal Name>'))

    Hi,
    I need your help to create a report using Ref-Cursor. please see the below thread
    Report using ref cursor or dynamic Sql

  • Select query on REF CURSOR

    Hi all,
    I am trying see if we can use LINQ like functionality to query a ref cursor resultset. I have about 50 procedures( as part of 12 packages) which send the ref cursor output to a front end application when called individually. Now I need to create a procedure to get only specified records from each of these 50 ref cursors and output it to another ref curosr.
    In other words how can I use the following
    select col_2 from pkg_abc.pro_ref_cursor_out(arg1, arg2...) where col_1 = 'X':I am not inclined to use a fetch as I foresee performance issues?
    Thanks

    @ Tubby. Here is what I am looking to do. Let us say I have two packages as below each with one ref cursor. In reality there are about 15 packages and 50 procedures and hence 50 ref cursors.
    CREATE OR REPLACE PACKAGE pkg_1
    IS
       TYPE resultset_typ IS REF CURSOR;
       PROCEDURE pro_1 (
          i_region          IN       VARCHAR2,
          o_resultset      OUT      resultset_typ,          -- 'recordset' output
    END pkg_1;
    CREATE OR REPLACE PACKAGE BODY pkg_1
    IS
       PROCEDURE pro_1 (
          i_region          IN       VARCHAR2,
          o_resultset      OUT      resultset_typ,         
       IS
        BEGIN
           OPEN o_resultset FOR
                 SELECT 'employees' AS person_type, employee_name FROM tbl_employees WHERE region = i_region;   
        END;
       END pro_1;
    END pkg_1;
    CREATE OR REPLACE PACKAGE pkg_2
    IS
       TYPE resultset_typ IS REF CURSOR;
       PROCEDURE pro_2 (
          i_region          IN       VARCHAR2,
          o_resultset      OUT      resultset_typ,          -- 'recordset' output
    END pkg_2;
    CREATE OR REPLACE PACKAGE BODY pkg_2
    IS
       PROCEDURE pro_2 (
          i_region          IN       VARCHAR2,
          o_resultset      OUT      resultset_typ,         
       IS
        BEGIN
           OPEN o_resultset FOR
                 SELECT 'customers' AS person_type, customer_name FROM tbl_customers WHERE region = i_region;
        END;
       END pro_2;
    END pkg_2;Currenlty the front end app calls these packages individually when required. But I want to create an additional package as follows so that I dont have to write the underlying queries again.
    CREATE OR REPLACE PACKAGE pkg_3
    IS
       TYPE resultset_typ IS REF CURSOR;
       PROCEDURE pro_3 (
          i_region          IN       VARCHAR2,
          i_name           IN       VARCHAR2,
          o_resultset      OUT      resultset_typ,          -- 'recordset' output
    END pkg_3;
    CREATE OR REPLACE PACKAGE BODY pkg_3
    IS
       PROCEDURE pro_3 (
          i_region          IN       VARCHAR2,
          i_name           IN       VARCHAR2,
          o_resultset     OUT      resultset_typ,         
       IS
        BEGIN
           OPEN o_resultset FOR
                 SELECT * FROM pkg_1.pro_1(i_region) WHERE employee_name = i_name
                 UNION ALL
                 SELECT * FROM pkg_2.pro_2(i_region) WHERE customer_name = i_name
        END;
       END pro_3;
    END pkg_3;

  • Ref Cursor Query

    I was exploring the use of a ref cursor query within my report. The question that I have is do you have to put the package in the reports program units or can you place the package on the db server and call the package?

    Hi,
    You can do it both ways.
    Regards
    Kamal

  • No flashback versions query and flashback transaction query tools on EM?

    No Flashback Versions Query and Flashback Transaction Query tools on EM Console?
    How to do Flashback Versions Query work and Flashback Transaction Query on EM Console?

    No Flashback Versions Query and Flashback Transaction
    Query tools on EM Console?WOrks on mine.
    How to do Flashback Versions Query work and Flashback
    Transaction Query on EM Console?Part of the Maintenance , Recovery wizard. Not intended to be a casual query tool.

  • How to link a non-linkable query and a plsql query in the datamodel

    Hi,
    I am creating a matrix group....
    Where in I get my
    1) Column values from a non-linkable query - Period (Jan, Feb....)
    2) Row values from a plsql query (ref cursor). Group is also from this query
    3) Cross product is on the above two queries.
    4) Cell info comes from a plsql query (refcursor).
    I created a group link from the cross product group (3) to the cell info query (4)
    I prepared the layout and executed the report... I am getting redundant data....
    The reason being the (4) and (1) are not linked properly.
    From google, About non-linkable queries column.... I understood that to link two non-linkable queries, we need to create a group link and then add a where clause in the child query referring the parent query column.
    But my case is a non-linkable query (which is a parent ) and a plsql query which is the cell.
    Any help...?
    Thanks in advance.
    KK

    Hello Sam,
    >
    I was wondering if you could have any link or examples to show how to make a form with report and an insert form in the same page, these two forms are related to the same table. Our customer wants a user can add new row to the table in a form and see all of rows created by this user in a report, this report should provide edit link as well. the problem is: whenever I inserted a new row or edit a row or delete a row, and submitted, and return to this page, all of hidden items lost their values, so report is blank, and some display only items also lost their values. Could anyone give me suggestions?
    >
    This will help:
    http://www.grassroots-oracle.com/2011/09/apex-tutorial-form-report-sharing-same.html
    Hope it helps!
    Regards,
    Kiran

  • Dynamic queries in report builder 6i ( ref cursor query )

    Hi everyone,
    My requirement is that I want to create a report where the query is dynamic. The dynamic part will be known at runtime as it is being passed via a parameter. My query looks like this :
    select * from emp where sal :p1 :p2
    Possible values for :p1 are - '>', '<', '>=', '<=', '=', '!='
    Possible values for :p2 are - any value entered by the user
    I tried creating a query in report builder based on a ref cursor. But it does not allow me to create the query for the ref cursor dynamically. That means I have to hardcode the query in the program.
    I tried using place holder columns without success.
    Can someone please help me ?
    Regards,
    Al

    Hi,
    You can use lexical paramters in the sql query
    x - char - parameter
    select * from emp &x
    you need to pass the value for x in the parameter as
    'where sal < 1234'.
    Note : Lexical variable should be of char datatype.
    This is an alternative to the ref cursors.
    This works. Hope this is clear.

  • Dynamic query with ref cursors

    please help me out there.
    can you give an example of how to construct a procedure using ref cursors.
    say if I had an employee table.
    employee table
    first name
    last name
    position
    dept
    I would have three input parameters, last name, position, dept. Sometimes only one parameters would be passed. Sometimes only two or sometimes all three.
    How can I construct the procedure being that the parameters will be dynamic
    thanks.

    Don't worry user484105 I don't do kicking, sarcasm and bad humour are other matters though.
    Yes you can use sys_refcursor, in fact all the tests that Todd and I have supplied, have done just that. Do you have a development database to work in?
    if so I would recommend
    1. Run demobld.sql if you don't already have emp table.
    2. Copy my second post in your other thread.
    3. Edit out all the sqlplus output and the first four columns.
    4. If any of this puzzles you see if you can find the answer in the SQL Reference, PL/SQL Guide or SQL*Plus manuals
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14357/toc.htm
    5. If you can't find the answer post what you have and the error here.
    6. It is probably best if you use sqlplus for this.
    You will learn a lot if you can do this.

  • Dynamic sql and ref cursors URGENT!!

    Hi,
    I'm using a long to build a dynamic sql statement. This is limited by about 32k. This is too short for my statement.
    The query results in a ref cursor.
    Does anyone have an idea to create larger statement or to couple ref cursors, so I can execute the statement a couple of times and as an result I still have one ref cursor.
    Example:
    /* Determine if project is main project, then select all subprojects */
    for i in isMainProject loop
    if i.belongstoprojectno is null then
    for i in ProjectSubNumbers loop
    if ProjectSubNumbers%rowcount=1 then
    SqlStatement := InitialStatement || i.projectno;
    else
    SqlStatement := SqlStatement || PartialStatement || i.projectno;
    end if;
    end loop;
    else
    for i in ProjectNumber loop
    if ProjectNumber%rowcount=1 then
    SqlStatement := InitialStatement || i.projectno;
    else
    SqlStatement := SqlStatement || PartialStatement || i.projectno;
    end if;
    end loop;
    end if;
    end loop;
    /* Open ref cursor */
    open sql_output for SqlStatement;
    Thanks in advance,
    Jeroen Muis
    KCI Datasystems BV
    mailto:[email protected]

    Example for 'dynamic' ref cursor - dynamic WHERE
    (note that Reports need 'static' ref cursor type
    for building Report Layout):
    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
    ref_cur_dyn type_ref_cur_dyn;
    BEGIN
    OPEN ref_cur_dyn FOR
    'SELECT * FROM dept WHERE ' | | NVL (p_where, '1 = 1');
    RETURN ref_cur_dyn;
    END;
    END;
    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;
    Regards
    Zlatko Sirotic
    null

  • Differences between Native Query and Hibernate Native Query?

    What is the differences between this two queries? as i was looking for native query. i saw hibernate native query... from what i've search through the internet, i know noted that hibernate query and native query is a totally different queries
    so is hibernate native query belongs to hibernate query? i m quite confuse 2 differentiate this with native query

    hi,
    Information is retrieved from the data base for use in out programs via a special language known as structured query language (SQL). SQL is a language designed for the use with relational data base systems.
       Open SQL is a subset of native SQL . SQL has been divided into two parts.
    > Open SQL  can recognized by the ABAP program.
    > They are 10 SQL statements out of which we use only 5.
    1. Select.
    2. Insert.
    3. Delete.
    4. Modify.
    5. Update.
    6. Fetch.
    7. Open Cursor.
    8. Close Cursor.
    9. Roll Back.
    10. Commit.
    out of which we use only the first 5.....
    > Native SQL. cannot be recognized by the ABAP program.
    > To execute Native SQL
    Exec SQL.
    End Exec.
    as it cannot be recognized by the ABAP we go for Open SQL.
    If this has helped u solve ur problem then dont forget to reward them with pointrs.
    with regards,
    madhuri.

  • Using CRUD procedures to update data and ref cursors to return data

    Hi:
    I am currently evaluating Apex 3.x to replace an existing app that uses lots of procedures to update and return data.
    1. Is it possible to return data from a function that returns a cursor (or from a procedure that has an input/output ref cursor parameter for that matter) ? Example: Let's say I have the following function in a package:
    function get_data return sys_refcursor
    is
    l_cursor sys_refcursor;
    begin
    open l_cursor for select sysdate as field from sys.dual;
    return l_cursor;
    end;
    Can I add a page with a table that is populated based on this function? Based on my research it is not possible, but I want an APEX expert to confirm it
    2. The old application uses CRUD procedures to update date, that is for each table there are 3 procedures, insert update and delete. Question: is it possible to channel all the update, inserts and deletes through these procedures? Furthermore, in lots of cases I use sequences to populate the primary keys, and the new value is returned as output parameter. Can I retrieve the output value and use it maybe in the next page I am branching to?
    In the samples that I've seen the same form is used for insert and update. How do I distinguish between the two modes?
    3. Can you please point me to some samples that show how to do 1 & 2. The standard samples that I've seen use the automatic row processing.
    4. Could you please recommend some good books about Apex or HTML db? I found the documentation unintuitive. It is hard to picture quickly how things tie together by reading this documention. I wish the documentation was more task oriented and presented 'how to...' implement generic patterns used in web apps.
    Thank you in advance

    Hi guys
    Check out the last 2 posts in this thread for ideas on how to implement 1.
    Report on user data from LDAP
    Varad

  • Using plsql table and ref cursor in oracle forms 10g

    Hi all,
    Can anyone give me an example of a scenario where we need to create a form manually based on a database stored procedures.
    And in that procedure i have created a pl/sql table and a ref cursor in data base level.
    CREATE OR REPLACE PACKAGE SCOTT.BONUS_PKG IS TYPE bonus_rec
    IS RECORD(
    empno     bonus_EMP.empno%TYPE,
    ename     bonus_EMP.ename%TYPE,
    job     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 BY BINARY_INTEGER;
    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 FROM bonus_EMP ORDER BY empno;
    BEGIN
    OPEN bonselect;
    ii := 1;
    LOOP
    FETCH bonselect INTO
    bonus_data( ii ).empno,
    bonus_data( ii ).ename,
    bonus_data( ii ).job,
    bonus_data( ii ).sal,
    bonus_data( ii ).comm;
    EXIT WHEN bonselect%NOTFOUND;
    ii := ii + 1;
    END LOOP;
    END bonus_query;
    PROCEDURE bonus_refcur(bonus_data IN OUT b_cursor) IS
    BEGIN
    OPEN bonus_data FOR SELECT empno, ename, job, sal, comm FROM bonus_EMP ORDER BY empno;
    END bonus_refcur;
    END bonus_pkg;
    i want to populate the data in forms manually not using forms data block wizard and programmatically.
    please reply...

    Can anyone give me an example of a scenario where we need to create a form manually based on a database stored procedures.Typically, you would use a procedure based block when you have a collection of data from multiple tables presented in a Form and your user needs to be able to update the information displayed.
    From your code example, it looks like you are using Oracle Support document "Basing a Block on a Stored Procedure - Sample Code [ID 66887.1]". If this is the case, keep following the document - it walks you through all of the steps. There is no need to Manually configure things that the Data Block Wizard will perform for you!
    i want to populate the data in forms manually not using forms data block wizard and programmatically. Why? Let the Data Block Wizard take care of configuring your block based on a procedure for you. There is no need to manually loop through the data! I've actually done what you are attempting and it was more work than was needed. Let Forms do the work for you. :)
    If you absolutely must do things manually, I recommend you use the PROCEDURE bonus_query(bonus_data IN OUT bontab) instead of the 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 is a simple case of looping through 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 sample demonstrates the basics, but as it is sample code - you will have to adapt it to your situation.
    Also, I strongly recommend you look at the article InoL listed. This is a very comprehensive discussion on REF CURSORs. If you are set on using a procedure based data source - it is more efficient to pass the table of records back to your form than it is to pass a ref cursor. Using a ref cursor, you might as well just using a standard named cursor and loop through your named cursor. The effect is the same (one row returned at a time creating lots of network traffic). Using the table of records is more efficient because the entire data set is returned so network traffic is reduced.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Authorization on Modify Y* Query and View Z* Query

    Hi Experts,
    is it possible to allow user to modify only Y* query and to display Z* and Y* query?
    I add two times S_RS_COMP (&S_RS_COMP1) in the SAME role (PFCG), one time allowing ALL activities for Y* query and othe allowing only display activity on Z* query...but it doesn't work! I have to do 2 different roles and add the two roles to the user?
    Any hints will be rewarded.
    Many thanks in advance,
    Fabio.

    mentioning in one role or two roles depends on your requirement.
    if you are planning of using one role, entries should be as below.
    S_RS_COMP
              actvt  --03, 16
              rszcompid -- Z*
    S_RS_COMP
              actvt  -- *
              rszcompid -- Y*
    S_RS_COMP1
              actvt ---*
              rszcompid ---Z, Y

  • BW QUERY and BW MDX Query

    Hi,
    While creating a report through crystal i see one option while creating a connection to database.
    SAP BW Query
    SAP BW MDx Query.
    Could anyone told me whats the technical diffrence between two.
    When option should be used when.
    Thanks
    Ashwani

    The BW Query Driver is an old version. the BW MDX is an enhanced version.
    The BW MDX Driver is able to leverage a BW query with two structures and it shows display attributes.
    ingo

Maybe you are looking for