Cursor -record fetch

Hi,
I'm getting the following error.
Error ** READNEXT: Unable to fetch next array of records from cursor
Kindly advic me on the same.
Thanks
KSG

KSG wrote:
Hi,
I'm getting the following error.
Error ** READNEXT: Unable to fetch next array of records from cursor
Kindly advic me on the same.Only if you would post the details like Oracle version, how you get this error and any piece of code that suffers from this problem.

Similar Messages

  • How to make cursor record/variable dynamic or substitute variable

    Hi
    I have couple of cursor records define in my PL/SQL procedures, they are all same structure type.
    For example
    C_rec_1 c_currsor%ROWTYPE;
    C_rec_2 c_currsor%ROWTYPE;
    C_rec_3 c_currsor%ROWTYPE;
    C_rec_4 c_currsor%ROWTYPE;
    C_rec_5 c_currsor%ROWTYPE;
    C_comm_rec c_currsor%ROWTYPE;
    BEGIN
    fetch .... into C_rec_1;
    fetch .... into C_rec_2;
    fetch .... into C_rec_3;
    fetch .... into C_rec_4;
    fetch .... into C_rec_5;
    IF c_rec1.dept = 100 then
    C_comm_rec := c_rec1;
    END IF;
    IF c_rec2.dept = 100 then
    C_comm_rec := c_rec2;
    END IF;
    IF c_rec3.dept = 100 then
    C_comm_rec := c_rec3;
    END IF;
    IF c_rec4.dept = 100 then
    C_comm_rec := c_rec4;
    END IF;
    IF c_rec5.dept = 100 then
    C_comm_rec := c_rec5;
    END IF;
    Here rather than coding 5 IF statement, Can I make c_rec_? dynamic?
    Something like but this does not work :)
    For i IN 1..5 loop
    If c_rec_&l = 100 then
    C_comm_rec := c_rec5;
    End if
    End loop;
    END;

    Hi Jaun,
    You have to go CMOD  Transaction .
    Create a project  and then write code in the exit EXIT_SAPLRRS0_001.
    there is include
    INCLUDE ZXRSRU01  double click on it and write code like below.
    Coding for Variable
        WHEN 'ZTES'.     YOUR variable name
    if     i_step = 1
          l_s_range-LOW = sy-datum +0(6).
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
    Hope this will help you.
    Regards
    vikas saini

  • Displaying count(*) in the cursor record

    Hi,
    I have the following cursor:
    CURSOR inputs_cur IS
    SELECT a, b, COUNT(*) cnt FROM INPUTS
              GROUP BY a, b
              ORDER BY COUNT(*) DESC;
    inputs_rec inputs_cur%ROWTYPE;
    BEGIN
    OPEN inputs_cur;
    LOOP
    FETCH inputs_cur INTO inputs_rec;.
    How can I reference count(*) in the cursor record?
    d_str := inputs_rec.a || ' ' || inputs_rec.b || inputs_rec.cnt ( or cnt) ???
    inputs_rec.cnt ( or cnt) does not display any data....
    Thanks
    Ia

    SQL> Declare
      2      Cursor C1 is Select a.c1 col1,count(*) col2 from
      3      (Select 1 c1 from dual connect by rownum<=10
      4       union all
      5       Select 2 c1 from dual connect by rownum<=20) a
      6      Group by a.c1;
      7  abc c1%rowtype;   
      8  begin
      9       Open C1;
    10       loop
    11       Fetch C1 into abc;
    12       exit when C1%NOTFOUND;
    13          dbms_output.put_line('Record Value: ' || abc.col1);
    14          dbms_output.put_line('Count of record: ' || abc.col2);
    15       end loop;
    16  end;
    17  /
    Record Value: 1
    Count of record: 10
    Record Value: 2
    Count of record: 20
    PL/SQL procedure successfully completed.
    SQL>

  • Is it possible to parse a cursor record into a function if so how?

    My question is basically as the title says. I would like to know if i can parse a cursor record through a function
    for example
    FOR r1 in c1
    LOOP
    calcuate(r1.mark1, r1.mark2,r1.mark3, r1.student)
    END LOOP
    where fucntion looks similar to
    CREATE function calculate(mark1 NUMBER, mark2 NUMBER, mark3 NUMBER, student VARCHAR2(15))
    RETURN NUMBER
    IS
    total NUMBER;
    BEGIN
    SELECT avg(all_marks) into total
    from table
    where mark1 = table.mark10 and
    mark2 > 100 and
    mark3 > 70;
    return NVL(total,0);
    end;
    if this is not possible how else can i do the specific task, where a cursor record is used to do a similar query to what the function does.

    > yes my system needs to be very efficient and with the least amount of code, besides this is for a
    database programming assingment where pl/sql is the language we are meant to master thus pl/sql >
    sql sad to say.
    Sorry, I don't get it. You say that your system needs to be efficient and in the very same breath you say "Screw efficiency, I want to use PL/SQL and not SQL". That is a bs statement IMO.
    There is a correct way. There is a wrong way. Choose one. It is not possible to do it correctly using the wrong principles, approach and code.
    > can cursor fetch loop parse through a function or am i just dreaming for that shortcut??
    What shortcut? A cursor is a SQL program. You are using PL/SQL to fetch from that cursor, iterating through it, does not change the fact that you are
    a) dealing with a SQL program (aka cursor)
    b) being serviced by the SQL engine
    What shortcut do you imagine there is? Not dealing with the SQL engine at all? PL/SQL is two languages. It is PL, a Programming Language based on ADA. This is tightly integrated with the SQL language.
    PL code is parsed and executed by the PL engine. SQL code is parsed and executed by the SQL engine. Each line of SQL code in PL/SQL, requires a context switch from the PL engine to the SQL engine in order for that SQL code to be executed. Each fetch from a cursor (via an explicit or implicit fetch), is a context switch to the SQL engine to execute that cursor in order to get the next set of (or single) rows.
    The more context switches there are, the more overheads there are. Each context switch pulls and/or pushes data between the PL and SQL engines.
    Okay, so now where is the "shortcut" - or more accurately called, correctly designing and coding PL/SQL?
    This is achieved by not pulling data into the PL engine that you do not really need as your PL code only pushes that very same data back to the SQL engine.
    This is achieved by reducing the number of context switches between the PL and SQL engines.
    This is achieved by processing data sets and not rows, in the PL engine.
    This is achieved by Maximizing SQL and minimizing PL/SQL.
    Now if you do not like and want to play silly buggers with PL/SQL and Oracle, that's your decision. I'm sure some here will throw you a rope (by posting really smelly code) from the bottom of the Oracle scalability and performance hole and help you drag yourself into it.

  • How to use Cursor's Fetch to return multiple column Data

    Hi ,
    This is my Table :
    SQL> select * from Login;
    USERNAME PASSWORD CONFIRMPASSWORD
    RAvi SAI SAI
    Kiran Keyboard Keyboard
    VARNU JAINA JAINA
    This is my stored Procedure , for that Table , this is working fine , where he Cursor's Fetch is returning only a Single column of Data .
    CREATE OR REPLACE PROCEDURE getEmpName(EMP_ID IN VARCHAR2)
    IS
    EMPNAME VARCHAR2(50);
    CURSOR MYCUR
    IS
    SELECT USERNAME from login where USERNAME=EMP_ID;
    BEGIN
    OPEN MYCUR ;
    LOOP
    FETCH MYCUR  INTO EMPNAME;
    DBMS_OUTPUT.PUT_LINE(EMPNAME);
    EXIT WHEN MYCUR%NOTFOUND;
    END LOOP;
    close MYCUR ;
    END;
    Now , I have a requirement as , i need to get the Password also along with Username ,
    Please tell me how can i use FETCH of Cursor to populate Details into the Declared Variables
    FETCH MYCUR  INTO EMPNAME;
    CREATE OR REPLACE PROCEDURE getEmpName(EMP_ID IN VARCHAR2)
    IS
    EMPNAME VARCHAR2(50);
    PASSWORD VARCHAR2(50);
    CURSOR MYCUR
    IS
    SELECT USERNAME , PASSWORD from login where USERNAME=EMP_ID;
    BEGIN
    OPEN MYCUR ;
    LOOP
    FETCH MYCUR  INTO EMPNAME; // Help needed here**
    DBMS_OUTPUT.PUT_LINE(EMPNAME);
    EXIT WHEN MYCUR%NOTFOUND;
    END LOOP;
    close MYCUR ;
    END;
    Edited by: user10503747 on Oct 14, 2010 11:51 AM
    Edited by: user10503747 on Oct 14, 2010 11:52 AM

    1) I'm hoping that this is a homework assignment. You would never, in the real world, store a password in clear text. And you would never, from a database design, have separate Password and ConfirmPassword columns.
    2) The INTO clause can accept a list of variables. So
    FETCH your_cursor_name INTO local_variable1, local_variable2;would be valid.
    3) You would generally want to avoid having local variables that share the name of a column-- that leads to some pretty serious confusion related to scoping. One common convention is to prefix local variables with a "l_".
    4) You would generally want local variables to inherit the type of the column rather than explicitly declaring the length of a string in your procedure. That way, if you change the table in the future, your code will continue to work.
    5) And finally, a procedure that just calls DBMS_OUTPUT would cause all sorts of red flags in reality. It would make far more sense for this to be a function that returns a value than a procedure that tries to write to a buffer that the client application may or may not have created.
    Justin

  • How to get the total count of the no. or rows a cursor has fetched

    Hi All,
    Is there a way to get the number of rows a cursor query has fetched, without looping into the cursor and using a counter variable
    I mean like in pl/sql table we can directly use the pl/sql table attribute .count is there a way to achieve this in cursor
    thanks a lot in advance

    Qwerty wrote:
    Is there a way to get the number of rows a cursor query has fetched, without looping into the cursor and using a counter variableYes.
    It is zero.
    On the first loop and first fetch it will be 1, second 2 etc.
    This is because cursors have no rows, or fetch no rows until your code or the client uses the cursor to fetch them.
    I mean like in pl/sql table we can directly use the pl/sql table attributeA PL/SQL array is not like a cursor, a PL/SQL array has the rows already fetched into it.
    A cursor is not an array but a pointer to a compiled SQL statement so you cannot count how many rows it has, because it has none. You can only count how many rows you fetch from it.

  • To display records fetched from the DB through ALBPM, in a custom JSP

    I want to display the records fetched from the database through ALBPM in a custom JSP as a table.
    Currently I am fetching the records and putting them in a BPM object group and sending it to the JSP as a BPM object. Now in the JSP I am trying to iterate and create a table to display the fetched data using the JSTL tag ==&gt;
    &lt;c:forEach ...... &gt;
    &lt;/c:forEach&gt;
    But I am always getting the following error in ALBPM workspace:
    The task could not be successfully executed. Reason: 'java.lang.RuntimeException: /webRoot/customJSP/CustomerSearch1.jsp(29,2) No such tag forEach var in the tag library imported with prefix c'
    Though there is a tag forEach var in the JSTL?? How to solve this error or is there any altrnative way to display the records in a JSP ??
    Thanks,
    Suman.

    Hello. I use custom JSP and it works well. You have to make sure 2 things:
    a) You have imported the libs, including these lines in your JSP:
    <%@ page session="true" %>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%@ taglib uri="http://fuego.com/jsp/ftl" prefix="f" %>
    b) The variable you are using in the "forEach" statement is stored in the BPM object you pass to the JSP in the call.
    Hope this helps.... Bye

  • Dynamic update  of cursor records when table gets updated

    Hi,
    I am having a table with 4 columns as mentioned below
    For a particular prod the value greater less than 5 should be rounded to 5 and value greater than 5 should be rounded to 10. And the rounded quantity should be adjusted with in a product starting with orderby of rank with in a prod else leave it
    Table1
    Col1     prod     value1     rank
    1     A     2     1          
    2     A     6     2
    3     A     5     3
    4     B     6     1
    5     B     3     2
    6     B     7     3
    7     C     4     1
    8     C     2     2
    9     C     1     3
    10     C     7     4
    Output
    Col1     prod     value1     rank
    1     A     5     1          
    2     A     5     2
    3     A     3     3
    4     B     10     1
    5     B     0     2
    6     B     6     3
    7     C     5     1
    8     C     5     2
    9     C     0     3
    10     C     4     4
    I have taken all the records in to a cursor. Once after rounding the request of 1st rank and adjusting the values of next rank is done. Trying to round the value for 2nd rank as done for 1st rank. Its not taking the recently updated value(i,e adjusted value in rounding of 1st rank).
    This is becoz of using a cursor having a value which is of old value.
    Is there any way to handle such scenario's where cursor records gets dynamically updated when a table record is updated.
    Any help really appreciated.
    Thanks in Advance

    Hi,
    Below is the scenario. Which I am looking for.
    ITEM_ID(A)
    ITEM_ID Value Date
    A          3     D1     
    A          5     D2
    A          3     D3     
    A          5     D4
    A          3     D5     
    A          5     D6
    Rounding for Item A has to be done for the rows less then D2 and rounding value is
    x and value adjustment to be done from very next row.
    --For record D1 rounding to be done and value adjustment is to be done from D2 to till the end untill the adjustment value is 0.
    --For record D2 (updated value has to be taken from rounding which updated in D1 row rounding) and the adjustment has to be done from very next row D3 to till the end or adjustment value is o.
    --For D3 row onwards no rounding has to be done.
    ITEM_ID(B)
    B          7     D1     
    B          8     D2
    B          9     D3     
    B          5     D4
    B          4     D5     
    B          3     D6
    Rounding for Item has to be done for the rows less then D3 and rounding value is
    y and value adjustment to be done from very next row.
    --For record D1 rounding to be done and value adjustment is to be done from D2 to till the end untill the adjustment value is 0.
    --For record D2 (updated value has to be taken from rounding which updated in D1 row rounding) and the adjustment has to be done from very next row D3 to till the end or adjustment value is o.
    --For record D3 (updated value has to be taken from rounding which updated in D2 row rounding) and the adjustment has to be done from very next row D4 to till the end or adjustment value is o.
    --For D4 row onwards no rounding has to be done.
    Thanks in Advance
    Edited by: unique on Apr 16, 2010 11:20 PM

  • Maximum record fetched  property of block

    hi friends
    i have a basetable block
    and i set the maximum record fetched property for this block to 1
    but when i execute_query
    i see all records.
    can any one help me?
    and i set this property ---> query array size
    but it doesnot work also!!!!
    tahnks
    regards,
    shoja

    This property takes effect when the Query All Records property is set to true - and you may have to set the interaction mdoe to Non-blocking at Form mode.
    A Simpler way to limit the number of rows would simply be to add
    where rownum < 2 to the where clause for the block.

  • PLSQL and XMLTYPE -- Trying to pass cursor record into a XMLTYPE query.

    Hi all --
    I'm trying to pass records from a cursor into a xmltype query, with no success. If i hard code what the cursor record is, it works just fine, but when I use cursor_rec.value, I think it is taking that strin literally. Here is a simple example of what i'm trying to do.
    Brief Background -- I have two tables (OPLAN, OPLAN_SUB_CONT) with an XMLTYPE column. OPLAN contains the bulk/main XML with about 30 elemets, while OPLAN_SUB_CONT contains the xml files which either inserts or updates any of the 30 elements. Instead of hard coding 30 statments to check each element, I created a cursor to cycle through the possible elements. If an element exists i do something , if not i go the next element.
    This returns null, using elements_rec.element_name in the query...
    declare
    cursor cur_get_elements is
    select element_name
    from oplan_element_attribs
    where parent_element='Transactions'
    and element_name='OPLAN_STATUS';
    elements_rec cur_get_elements%rowtype;
    v_element number;
    begin
    for elements_rec in cur_get_elements
    Loop
    dbms_output.put_line ('before extract');
    select nvl(count(value(p)),0)
    into v_element
    from oplan_sub_content_xml oscx,
    table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/elements_rec.element_name'))) p;
    if v_element =0
    then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is null');
    elsif v_element > 0
    then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is not null');
    end if;
    end loop;
    end;
    SQL> /
    before extract
    Element OPLAN_STATUS is null
    PL/SQL procedure successfully completed.
    If i hard code the element_name (elements_rec.element_name) on line 16 (line wraps) to "OPLAN_STATUS' i get desired results ... returns not null
    declare
    cursor cur_get_elements is
    select element_name
    from oplan_element_attribs
    where parent_element='Transactions'
    and element_name='OPLAN_STATUS';
    elements_rec cur_get_elements%rowtype;
    v_element number;
    begin
    for elements_rec in cur_get_elements
    Loop
    dbms_output.put_line ('before extract');
    select nvl(count(value(p)),0)
    into v_element
    from oplan_sub_content_xml oscx,
    table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/OPLAN_STATUS'))) p;
    if v_element =0
    then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is null');
    elsif v_element > 0
    then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is not null');
    end if;
    end loop;
    end;
    SQL> /
    before extract
    Element OPLAN_STATUS is not null
    PL/SQL procedure successfully completed.
    Any ideas?
    Thanks!

    I should try everything before posting! Sorry, got it to work...
    replaced ..
    select nvl(count(value(p)),0)
    into v_element
    from oplan_sub_content_xml oscx,
    table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/elements_rec.element_name'))) p;
    with
    select nvl(count(value(p)),0)
    into v_element
    from oplan_sub_content_xml oscx,
    table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/' || elements_rec.element_name || ''))) p;

  • Building a block based on the records fetched - Forms 10g

    Is there a way in forms to dynamically build the block ( I mean in a multi record block, we usally set the number of records displayed in the property pallete) Instead of setting the property is there a way that we can do it based on the records fetched by the query?
    select a.unit_id, substr(b.product_code,1,5)
    from [email protected] a,[email protected] b
    where substr(a.product_code,1,5) = b.product_code
    and substr(a.product_code,1,5) = 'E3088'
    and inv_product_type in ('PHER','LPHER','VPHER')
    and warehouse_id = 'A'
    This is the query.
    If the query for product_code fetched 5 units for product code = 'E3088' of inv_product_type as mentioned in the query, is if possible to build the multi record block? For another product E3077 it might give us 6 records.
    User wants me to see if I can do it? Is it possible?
    Thanks in advance.
    Anu

    Hi,
    I've not tried this and can't say for sure if it is possible or not.
    But, have a look at this link Re: Automatic  Number  of record displayed .
    I'd thought of a solution but never tried myself. Try if it works for you.
    If it doesn't, i think it will not be possible in oracle forms.
    Navnit

  • Record fetch size property hint

    Hi all,
    I'm using Oracle Forms Builder 10g and Oracle DB 11g. I have a LoV which selects about 150k rows. In fact in the DB the select * from <table> returns first 50 rows for about a second. My question is: What value to set for Record fetch size property to receive the first records faster because now it is loading about 20-30 seconds/which is unacceptable for me :) /. I checked docs for this property and if i increase it i suppose it will display rows faster?
    Thanks in advance,
    Bahchevanov.

    The records are composed of two columns, a code (5 characters) and a description (average size 25 characters). The average size of the record is then approx. 30 characters. From the documentation available in Forms:
        Also, the way in which the actual value is computed when a value of 0 is
        specified has changed. The actual value in this case is now
        0.5 M / total_record_size (i.e. sum_of_column_sizes, not max_column_size),
        but no more than 100 and no less than 20.  The coefficients (0.5 M, 100, and
        20) can be changed by setting these environment variables: 
        FORMS_COMPUTED_RGFS_DIVIDEND, FORMS_MAX_COMPUTED_RGFS,
        and FORMS_MIN_COMPUTED_RGFS.I believe that we are running with the default. Is this OK for this data set? Do we need to set the environmental variables listed above?
    Thanks,
    Thomas

  • DB proc - do you need to create a table to pass a ref cursor record type?

    I want to pass a limited selection of columns from a large table through a DB procedure using a REF CURSOR, returning a table rowtype:
    CREATE OR REPLACE package XXVDF_XPOS_DS021_ITEMS AS
         TYPE XXVDF_XPOS_DS021_ITEM_ARRAY
         IS REF CURSOR
         return XXVDF_XPOS_DS021_ITEM_TABLE%ROWTYPE;
    Do I need to create this dummy table?
    I can't get a TYPE to work, where the type is an OBJECT with the desired columns in it.
    So a dummy empty table will sit in the database...
    Is there another way?
    thanks!

    You can use RECORD type declaration:
    SQL> declare
      2   type rec_type is record (
      3    ename emp.ename%type,
      4    sal emp.sal%type
      5   );
      6   type rc is ref cursor return rec_type;
      7   rc1 rc;
      8   rec1 rec_type;
      9  begin
    10   open rc1 for select ename, sal from emp;
    11   loop
    12    fetch rc1 into rec1;
    13    exit when rc1%notfound;
    14    dbms_output.put_line(rec1.ename || ' ' || rec1.sal);
    15   end loop;
    16   close rc1;
    17  end;
    18  /
    SMITH 800
    ALLEN 1600
    WARD 1250
    JONES 2975
    MARTIN 1250
    BLAKE 2850
    CLARK 2450
    SCOTT 3000
    KING 5000
    TURNER 1500
    ADAMS 1100
    JAMES 950
    FORD 3000
    MILLER 1300or use, for example, VIEW to declare rowtype:
    SQL> create view dummy_view as select ename, sal from emp;
    View created.
    SQL> declare
      2   type rc is ref cursor return dummy_view%rowtype;
      3   rc1 rc;
      4   rec1 dummy_view%rowtype;
      5  begin
      6   open rc1 for select ename, sal from emp;
      7   loop
      8    fetch rc1 into rec1;
      9    exit when rc1%notfound;
    10    dbms_output.put_line(rec1.ename || ' ' || rec1.sal);
    11   end loop;
    12   close rc1;
    13  end;
    14  /
    SMITH 800
    ALLEN 1600
    WARD 1250
    JONES 2975
    MARTIN 1250
    BLAKE 2850
    CLARK 2450
    SCOTT 3000
    KING 5000
    TURNER 1500
    ADAMS 1100
    JAMES 950
    FORD 3000
    MILLER 1300 Rgds.

  • How to determine the cursor record count before the "open cursor"?

    Is it possible to determine the record count of an explicit cursor without running a count()? Say, my cursor definition is something like this,
    CURSOR cur_vehicle
    IS
    SELECT os.order_id, os.order_item, vs.part_id
    vs.part_num,
    vs.iso_num,
    vs.model_yr
    vs.dealer_cde,
    vs.cust_cde,
    px.plant_cd
    FROM parts_source vs,
    orders_source os,
    plant_tbl_crossref px
    wHERE os.order_id = vs.order_id
    AND vs.part_id = os.part_id
    AND vs.plant_cde = px.plant_cde
    ORDER BY os.order_id;
    I want to log the count of records returned by the above cursor prior to the first fetch, without running a count(1) for the query in cursor select.
    I know adding " Count(1) over(order by null) " in the cursor SELECT will bring it. But that does not help me log the record count to some log file or table before opening the cursor for processing.
    To conclude, my objective is to update the record count of cursor in some table before processing

    sarvan wrote:
    Is it possible to determine the record count of an explicit cursor without running a count()?
    ..snipped..No. The only way to do it correctly is inside that select.
    Each select is a consistent read. Which means that if this is done as 2 select statements, the 1st select can see a different version of the data than the 2nd select statement. does. So if you want a count and that to be consistent and on the same version of the data than the select, it has to be done as part of the select.
    Also consider what a cursor is. It is not a result set of sorts that is created in memory upfront - with a convenient interface that tells you the size/number of rows of that result set.
    A cursor is basically a program that reads database data as input and produce output. A fetch from a cursor is an instruction for this program to execute and output data.
    There's no data set that is created by the cursor from which the count can be determined. The cursor program does have state variables - like +%RowCount+ that specifies how many rows the cursor has thus far output. And you need to run that cursor to the end (no more output) in order to determine the total number of rows output by the cursor.

  • Cursor not fetching the latest value in the loop.

    Hi!
    I'm facing a peculear problem. I've a procedure which will check the total number of records in a loop. It will fetch that value. If that value mathced with certain condition then the outer loop execution need to stop. Here is my script -
    <<Outer Loop Script>>
    declare
      j  number(5);
    begin
      j := 1;
      dbms_output.enable(100000);
    while j <> 3 and j <=3
    loop
      sel_pri(3,j);
      dbms_output.put_line('J is : '||j);
    end loop;
      dbms_output.put_line('Executes.....');
    exception
      when others then
        dbms_output.put_line(sqlerrm);
    end;
    -- Procedure Script --
    create or replace procedure sel_pri(x  in number,y out number)
    is
      pragma autonomous_transaction;
    begin
       select count(a.flg) cnt
       into y
       from (
             select flg
             from   t_priority
             where  flg <= x
             and    flg < 4
             union
             select flg
             from   t_priority
             where  flg > x
             and    flg < 4
           ) a;
      --commit;
    end; Now, the problem is -
    Suppose i've two records are there in t_priority table. So, when i run my anonymous pl/sql block it won't satisfy the condition - as a result the loop will iterate untill the condition satisfiy. Now, if i insert data from a different session and commit the value in table t_priority which have only one field named flg and if count is 3. Then the process of the while loop should be stopped. But, it that is not happening. Infact it is fetching the old value. Why is it so?
    Thanks in advance for your reply.
    Regards.
    Satyaki De.

    sir i cannot understand your example.
    SQL> declare
      2 
      3   cursor bc is
      4   select ename from emp;
      5 
      6   procedure change_in_another_trans
      7   is
      8    pragma autonomous_transaction;
      9   begin
    10    update emp set ename = ename || '?';
    11    commit;
    12   end;
    13  begin
    14 
    15   for v in bc loop
    16 
    17    if bc%rowcount = 3 then
    18     change_in_another_trans;
    19    end if;
    20 
    21    dbms_output.put_line(v.ename);
    22 
    23   end loop;
    24 
    25  end;
    26  /
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    PL/SQL procedure successfully completed.
    Procedure change_in_another_trans is autonomous and is executed
    only once in the loop - when I fetched 3 rows from cursor. It updates
    the data I fetch in cursor loop and commits autonomous transaction.
    If Oracle would not support the read consistency for queries you had
    SMITH
    ALLEN
    WARD
    JONES?
    MARTIN?
    BLAKE?
    CLARK?
    SCOTT?
    KING?
    TURNER?
    ADAMS?
    JAMES?
    FORD?
    MILLER?
    But you see the data as they were at the moment (exactly SCN - System Change Number) of the query issue dispite they have been changed by another transaction after the cursor has been open. Hope I'm clear now.
    Rgds.

Maybe you are looking for

  • Device Manager displayed " Mass Storage Controller (Code 28)"

    Greetings to all Members I am using AMD 64 x2 3800+ processor. MSI mortherboard K8N Diamond. Graphic cards, two units, Geforce GTX6600GT. I am running on Window XP SP2. I have also updated the AMD latest drivers. I noticed each time I log on the comp

  • Install disk doesn't work with Windows Vista

    I just bought a new HP Color LaserJet Pro MFP M277dw and the install disk isn't compatible with Windows Vista.  Apparently there's no ful feature option for Windows Vista on an HP laptop.  After several hours of work I downloaded several drivers and

  • Delivery rescheduled during packing - problem

    We have a process where we invoice packaging material.  When we create the handling unit in the delivery packing, and use material with the relevant item category assignment, an item in the delivery is created.  The problem is that at the same time,

  • Invisible withholding tax amounts in FBL1N

    Hello, When I display vendor open items through FBL1N t-code I cannot see some of the withholding tax amounts although they really have been posted, as I can see them when I display the document number through FB03. Can anybody give me any explanatio

  • InDesign Server Plugin (C++) Plugin SDK: How to get the name of a frame?

    Hi guys, after some hours of digging with no luck and starting to think of dirty workarounds, I decided to ask In JSX, this would be "pageItem.name", but how to do this in a C++ Plugin? Any tips are appreciated!