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.

Similar Messages

  • Invoice hold workflow is not fetching the approver from ame

    Hi,
    I'm trying to get the next approver(3rd level) in wf process from ame through profile option, but it's not fetching the approver.
    my query is
    SELECT persion_id||employee_id
    FROM fnd_user
    WHERE employee_id = fnd_profile.VALUE('MG_AP09_PAYABLES_SUPERVISOR')
    other two level approvers (level1 and level 2)I'm getting , which is not through profile but direct join of tables as given below
    SELECT 'person_id:'|| rcv.EMPLOYEE_ID
    FROM ap_holds_all aph
    ,po_distributions_all pd
    ,rcv_transactions rcv
    WHERE pd.line_location_id = aph.line_location_id
    AND pd.PO_DISTRIBUTION_ID= rcv.PO_DISTRIBUTION_ID
    AND aph.hold_id = :transactionId
    AND transaction_type = 'DELIVER'
    SELECT 'person_id:'|| HR2.attribute2
    from ap_holds_all AH
    ,po_line_locations_all PLL
    ,hr_locations_all HR1
    ,hr_locations_all HR2
    where pll.line_location_id = AH.line_location_id
    AND pll.ship_to_location_id = HR1.location_id
    AND nvl(HR1.attribute1,HR1.location_id) = HR2.location_id
    AND AH.hold_id = :transactionId
    what may be the issue?

    Hi Surjith,
    Please look at the code I have written in the user exit, which is just for testing purpose. In SPRO I set workflow as 9 for all the release codes.
    IF i_eban-werks = '1000'.
      actor_tab-otype = 'US'.
      actor_tab-objid = 'S_RITESH'.
      APPEND actor_tab.
      CLEAR actor_tab.
    ENDIF.
    In PR I am getting the user name in processor coloumn correctly.
    please let me know if I am going wrong.
    Thank you.

  • Report is not fetching the data from Aggregate..

    Hi All,
    I am  facing the problem  in aggregates..
    For example when i  am running the report using Tcode RSRT2, the BW report is not fetching the data from Aggregates.. instead going into the aggregate it is scanning whole cube Data....
    FYI.. Checked the characteristcis is exactely matching with aggregates..
    and also it is giving the  message as:
    <b>Characteristic 0G_CWWPTY is compressed but is not in the aggregate/query</b>
    Can some body explain me about this error message.. pls let me know solution asap..
    Thankyou in advance.
    With regards,
    Hari

    Hi
    Deactivate the aggregates and then rebuild the indexes and then activate the aggregates again.
    GTR

  • Query not fetched the record

    Hello,
    Could someone help me please ?
    I have a listing of my sales orders and I want to make changes in my order by opening the form and fetched with that record. When I click on that particular orderno in my listing of order and call the form to display the details, it calls the form but says "Query could not fetch the record". I do not know why ? Please help me with the solution.
    Thanx

    Hello,
    I think you are passing orderno to called form as a parameter. If you are using parameter list check..
    1. If parameter data is getting in form correctly ?
    2. Next, have you changed where clause of other block,so that is will display record with passed orderno ?
    I am expecting more details from you.
    Thanx
    Adi

  • RSBBS jump query not fetching the document no in R3

    Dear Gurus
    With RSBBS transcation jump is given to R3 tansaction FB03. When query is executed and with right click go to option and with display document (FB03) its fetching the document no in DEVELOPMENT server . But when the query is transported to Production its not fetching the document no.
    Kindly do the needful at the earliest
    Regards,
    R.Satish

    Hi
    You said it is not fetching the doc no. Is it failing and showing some error?
    Have all the pre-requisite settings been done via Tcode SICF.
    Regards
    Nageswara

  • Not Breaking the loop but how to continue with the next iteration in a For

    Hi all
    i have the following piece of code
    Please let me know, what is the /*some construct*/ which will not break the loop but goes to the next iteration skipping Login b
    Loop
    Login A
    /*some construct*/
    Login B
    End loop;
    P.S
    I should do this without Label or Exception ... I am using oracle 8i
    Thanks
    Hariharan
    T

    An [url http://www.oracle.com/pls/tahiti/tahiti.tabbed?section=48911]IF statement?
    loop
      login_a;
      if false
      then
        login_b;
      end if;
    end loop;Regards,
    Rob.

  • Luxadm probe / Could not find the loop address for  the device at physical path

    Using EMC FibreChannel Disks on a Solaris 10
    # luxadm probe
    No Network Array enclosures found in /dev/es
    Error: Could not find the loop address for the device at physical path.
    # echo $?
    255
    Any ideas how to fix?
    Thank,
    Marcel

    Hi Marcel,
    Which Solaris 10 release is this?
    I found a very old bug that says this problem is already fixed in Solaris 10 although the bug description says
    its mostly seen on Solaris 8 and 9.
    https://bug.oraclecorp.com/pls/bug/webbug_print.showbug?c_rptno=15123550
    The bug says that these errors are displayed when StorADE 2.1 is running its rasagent cron job, which executes a luxadm display. 
    This process runs in the background so the user is not aware that another luxadm display process is running.
    Work-around: Do not run Storade rasagent cron job at same time as another luxadm display process.
    I hope this might help to debug this problem but I puzzled why this might be happening if its already fixed.
    Let me know if the workaround helps or so I can follow-up with the right support team.
    Thanks, Cindy

  • Value Field not fetching the data

    Dear COPA Experts,
    There has been an addition to the cost component structure for my current client. The cost component has been created and CK11n is showing the correct data for the correct cost component. I had to add value fields to my current COPA report to reflect the figures from the cost component. For that, I had created and activated the Value Fields in KEA6 and assigned it to the Operating concern in KEA0 and activated it. Then, I had assigned the value fields to the cost component structure in KE4R. I had then added the value field in the COPA form through KE95.
    When a new cycle is completed, It does not reflect the valuation in KE30 report. I had crossed checked in KE24 which is a standard report. The result in KE24 and KE30 report is same, i.e the valuation is not even reflected in KE24 report.
    Please guide me to where am I missing something?
    Best Regards...

    Hi,
      "When a new cycle is completed, It does not reflect the valuation in KE30 report". This statement is not clear. Are you expecting KEU5 cycles to populate this value field ? Normally this value field should be populated during billing (VF01) when the value of the cost component is populated in the value field.
    regards
    Waman

  • To_date function not fetching the desired result.....

    Hi Gurus,
    I get varied results from the below 2 queries, I am pessimistic about using to_char instead prefer using to_date, but query doesn't seem to fetch the complete data while using the to_date but with to_char it works. Please can someone make this to_date used query below work for me.
    Main table structure:
    Column Name     ID     Pk     Null?     Data Type     Default     Histogram     Encryption Alg     Salt
    MINISTRY_CODE     1          Y     VARCHAR2 (15 Byte)          Yes          
    BILL_MONTH     2          Y     DATE          Yes          
    CUBIC     3          Y     NUMBER          Yes          
    GALLONS     4          Y     NUMBER          Yes          
    AMOUNTS     5          Y     NUMBER          Yes          
    MTR_TYPE     6          Y     CHAR (1 Byte)          Yes          1st query:
    SELECT ministry_code,
    DECODE(mtr_type, 'C','Billed Cubic',
    'G','Billed Gallons',
    'A','Billed OMR',
    'R','Collected',
    'U','Total Unpaid Bills') mtr_type,
    SUM(CASE
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_char(bill_month,'MMYYYY') = '012011' AND mtr_type = 'C' THEN cubic
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_char(bill_month,'MMYYYY') = '012011' AND mtr_type = 'G' THEN (gallons)
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_char(bill_month,'MMYYYY') = '012011' AND mtr_type = 'A' THEN amounts
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_char(bill_month,'MMYYYY') = '022011' AND mtr_type = 'R' THEN amounts
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_char(bill_month,'MMYYYY') <= '022011' AND mtr_type = 'U' THEN amounts ELSE 0 END) January
    FROM tmp_paew_month_gafu1 WHERE ministry_code IN
    (SELECT DISTINCT ministry_code FROM tmp_paew_month_gafu GROUP BY ministry_code)
    GROUP BY ministry_code,mtr_type
    ORDER BY 1,3 DESCSAMPLE OUTPUT:
    MINISTRY_CODE MTR_TYPE JANUARY
    001 Billed Gallons 5326252
    001 Billed Cubic 24210.2363636364
    001 Total Unpaid Bills 16402.5
    001 Billed OMR 13287.36
    001 Collected 10410.508
    002 Total Unpaid Bills 12089.99
    002 Billed Cubic 0
    002 Billed OMR 0
    002 Billed Gallons 0
    002 Collected 0
    003 Total Unpaid Bills 27418.711
    2nd query:
    SELECT ministry_code,
    DECODE(mtr_type, 'C','Billed Cubic',
    'G','Billed Gallons',
    'A','Billed OMR',
    'R','Collected',
    'U','Total Unpaid Bills') mtr_type,
    SUM(CASE
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_char(bill_month) = to_date('012011','MMYYYY') AND mtr_type = 'C' THEN cubic
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_date(bill_month) = to_date('012011','MMYYYY') AND mtr_type = 'G' THEN (gallons)
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_date(bill_month) = to_date('012011','MMYYYY') AND mtr_type = 'A' THEN amounts
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_date(bill_month) = to_date('022011','MMYYYY') AND mtr_type = 'R' THEN amounts
    WHEN mtr_type NOT IN ('C','G','A','R','U') THEN 0 WHEN to_date(bill_month) <= to_date('022011','MMYYYY') AND mtr_type = 'U' THEN amounts ELSE 0 END) January
    FROM tmp_paew_month_gafu1 WHERE ministry_code IN
    (SELECT DISTINCT ministry_code FROM tmp_paew_month_gafu GROUP BY ministry_code)
    GROUP BY ministry_code,mtr_type
    ORDER BY 1,3 DESCSample OUTPUT:
    MINISTRY_CODE MTR_TYPE JANUARY
    001 Total Unpaid Bills 106062.002
    001 Billed OMR 0
    001 Billed Cubic 0
    001 Billed Gallons 0
    001 Collected 0
    002 Total Unpaid Bills 42023.243
    002 Collected 0
    002 Billed Gallons 0
    002 Billed Cubic 0
    002 Billed OMR 0
    003 Total Unpaid Bills 133260.435

    What is the sense of to_date(bill_month) in the second query?
    bill_month is already a date. to_date function will expect a character parameter and convert it in a date value.
    So what will happen? First the bill_month will be implicitely converted to a character value.
    Second this character value will be converted back to a date. You gave no format string. So both conversions will be made will your setting of nls_date_format.
    I can only guess what you really want. Perhaps you want to trunc the bill_month with trunc(bill_month,'MM').
    Please give us
    - table create script
    - insert statements for test data
    - required output for these test data
    - description of your requirements
    Edited by: hm on 22.11.2012 23:16

  • "BAPI_DOCUMENT_CHECKOUTVIEW2" -not fetching the original to local path ..

    Hi,
    When i use the function module "BAPI_DOCUMENT_CHECKOUTVIEW2" it is working fine. But i call in my webdynpro application , it is not placing the original to the given path . Plz give me the Solution
    Regards,
    Rani.

    That BAPI uses a SAPGUI connection to the client side to write the data into the local path of the client machine. Of course from Web Dynpro ABAP, you have no connection to the SAPGUI nor would you have access to write directly to the local filesystem of the client machine because of the sandbox nature of web browsers. Many of the BAPI_DOCUMENT_* function modules are structured this way, making them practically unusable from Web Dynpro or ther web environments.
    There is a way to make them work "dark" (without SAPGUI) and therefore from Web Dynpro.  You have to supply a value for the PF_HTTP_DEST or PF_FTP_DEST. These need to be remote locations that are running the SAPHTTP or SAPFTP applications and the SAP Gateway. Generally these might be the application server of the ABAP system itself.  You FTP the files to the application server and write them into a filesystem that is a public share that can be accessed by the client desktop.

  • Issue with VC/2 - not fetching the invoice details

    Hi All,
    We have an issue with TCode VC/2 in ECC 6. This is not fetching( not showing) the Invoice documents under the header "Last SD Documents".
    It is fetching the sales documents like orders, credit memo/debit memo requests but not the invoice documents.
    PLease help on this.
    Thanks in advance.
    Edited by: Harini Kesani on Jan 12, 2010 8:25 PM

    Is it possible that 'last SD document' means 'last sales document', not 'last billing document'? Unfortunately, I'm unable to confirm - we don't use this transaction. You can also check what tables are used in this transaction (get help from an ABAPer or Basis) and then check if there is correct data in those tables. It might be using info structures or index tables, which may need to be populated first.

  • EVCVW - Not Fetching the Dimension data

    Hi Friends,
    I designed a inut schedule where I used, EVCVW ($H$2,G11) to fetch the data of Dimension ex.. project.. I am unable to get the data. When I tested other page through EVDRE(), it is showing all the data for project ($H$2,G11), when I refresh, selct othe project, this is working, this is not working on the input schedule page.
    Pls send me your thoughts..
    Regards
    CSM Reddy

    Hi Friends,
    It is solved. I used EVCVW ( "APPLICATION","PROJECT") insted of EVCVW ($H$2,G11) ..
    Will be back for any other queries..
    Regards
    CSM Reddy

  • BootCamp Black Screen with white cursor not like the others :S

    i searched around but my problem is not like the others i was doing bootcamp  than i put my win 7 cd and reboot but a black screen comes with a  white cursor  and nothing happens and now i dont want the dang win 7 i just want my mac back with my data   i eject the cd and   reboot my mac gray scereen comes and after 10 sec.  black screen comes again says bootable device no found help ! i tried cmd  at the grey screen nothing happens i tried cmd+r   / cmd + alt  / cmd + r +p  / cmd+r+p+alt / cmd+alt+r   and all that stuff it wont do nothing please helllp i cant even recover my recover thing is inside my mac but cant acess there :S  it like im doomed  please help please i use lion

    Mac 101: Using Windows on your Mac via Boot Camp
    https://support.apple.com/kb/HT1461
    Boot Camp 4.0, OS X Lion: Frequently asked question  http://support.apple.com/kb/HT4818  http://manuals.info.apple.com/en_US/boot_camp_install-setup_10.7.pdf
    http://manuals.info.apple.com/en/Boot_Camp_Install-Setup_10.6.pdf
    create a Windows support software (drivers) CD or USB storage media
    http://support.apple.com/kb/HT4407
    The Boot Camp Assistant can burn Boot Camp software (drivers) to a DVD or copy it to a USB storage device, such as a flash drive or hard drive. These are the only media you can use to install Boot Camp software.
    https://support.apple.com/kb/HT4569
    Installation Guide  
    Instructions for all features and settings.
    Boot Camp 4.0 FAQ  Get answers to commonly asked Boot Camp questions.
    Windows 7 FAQ  Answers to commonly asked Windows 7 questions.
    http://www.apple.com/support/bootcamp/
    iMac displays a black screen during installation of Windows 7

  • WD iView not fetching the data

    Hi,
         I developed some WD (Java) application.But certain iView like sales order,delivery order not displaying the sales order number & delivery order number. Fuction module is working fine in backend.How to resolve this,can anyone help me for the same?
    Thanks,
    Kundan
    Edited by: Kundan 2009 on Mar 8, 2010 12:04 PM

    Hi Kundan,
    Please display text message on screen whether correct sales order number & delivery order number coming or not model node/attribute.
    >For certain iView like sales order,delivery order not displaying the sales order number & delivery order number?
    Check your binding properly and context node/model node.
    Hope this will helps you.
    Regards,
    Arun Jaiswal

  • Strange Problem: Cursor not fetching all rows

    Hello,
    When fetching from a cursor on a PL/SQL block in a stored procedure, the cursor seems to stop in the middle of the loop without an exception. The number of rows the cursor fetches varies from call to call. The same problem repeats in a FOR loop, direct CURSOR open and calling the fetch directly in the FOR loop.
    The strangest thing is that I took the code and executed it on an external script and it worked fine.
    What can cause the cursor to stop?
    Thanks

    Hi,
    Could you paste your stored procedure?
    cheers

Maybe you are looking for

  • Error during Olap metadata retrieval

    Hi all, We are getting the following error while trying to establish connection to the olap catalog to retrive olap metadata information for BI Beans "Successfully connected to the Oracle database but failed to retrieve metadata. Although the databas

  • [Solved] GNOME 3 Properties Dialogue auto closing

    I recently discovered that when i right click on a file and select "Properties" dialog box flashes and gone..... what should i do to fix it.... Help Mee....... Last edited by chamoo2000 (2012-04-24 14:45:46)

  • Subscreen in Screen Painter

    Hi Friends, I have created a layout in screen painter using Tabstrip with wizard which is having Tabstrip control with four tabs.  Now I want to attach to table to each tab,so that I can input some data and save in the table. I request you to kindly

  • AS3 Blending Modes

    Hi all, I'm trying to apply the Screen Blending Mode to a Movie Clip.  I know how to do this using the properties panel if the clip is on the stage, but I need to do this purely with Actionscript 3 and I'm having difficuly finding how to do this prop

  • CS6 to CS issues

    Does anyone know if saving a file created in CS6, down to CS, and is opened from another computer using CS only, losing information in the process?