To Get Last Updated Value.

Hi All
I want to fetch data from nearly 15 tables.
All the tables contains a Modified_date and Insert_date columns
If any of the table contains a modifed_date or insert_date with in last 2 Days, Then i have to pick that rows.
Please suggest me how to fetch these values in an optimistic way,Since all the tables contains millions of data.
Note:
Im using oracle 11g
Thanks
Jo

Johney  wrote:
Hi All
I want to fetch data from nearly 15 tables.
All the tables contains a Modified_date and Insert_date columns
If any of the table contains a modifed_date or insert_date with in last 2 Days, Then i have to pick that rows.
Please suggest me how to fetch these values in an optimistic waywhat is difference between optimistic fetch & pessimistic fetch?
>
Note:
Im using oracle 11g
Thanks
Jowe can't write SQL when we don't know table names or column names.
How do I ask a question on the forums?
SQL and PL/SQL FAQ

Similar Messages

  • Transformation routine to get last month value

    Hi experts,
    I am trying to write a routine in a transformation to get last months value from another dso.
    Here is my code:
    Data:
    zamnt type F,
    zmonth type c length 6.
    zmonth = sy-datum+0(6).
    select sum( /BIC/ZAMNT ) into i_amnt
    from /BIC/AZDSP00700
    where CALMONTH = zmonth -1.
         RESULT = zamnt.
    I get an incorrect expression "where CALMONTH = zmonth -1." because it does not understand "-1"
    Can anyone help me?

    Hi Odd Hilt,
    Please confirm CALMONTH format is yyyymm or something different.
    If CALMONTH format is yyyymm.
    try following code
    zmonth = sy-datum+0(6).
    ZMONTH1 = ZMONTH - 1.
    select sum( /BIC/ZAMNT ) into i_amnt
    from /BIC/AZDSP00700
    where CALMONTH = zmonth1.
    RESULT = zamnt.
    Thanks,
    Chandra

  • PowerPivot get last update

    My table looks like this:
    FLIGHT | UPDATE | ETA | ARRIVAL
    A | 2/6/14 | 6/18/14 | 6/16/14
    A | 6/6/14 | 6/19/14 | 6/16/14
    B | 1/7/14 | 6/2/14 | 6/26/14
    B | 6/16/14 | 7/2/14 | 6/26/14
    B | 6/23/14 | 6/26/14 | 6/26/14
    I need to get the latest ETA update 7 days prior arrival. For instance: Flight A arrived on 6/16. 7 days before this was 6/9. The latest update before this date was 6/6. On that date, the provided ETA was 6/19. So my measure would return:
    A -> 6/19/2014
    B -> 7/2/2014
    How would you write this in PowerPivot?
    Thanks

    You'll need to add a working day flag to your data, either in a date table related to [UPDATE] or in the fact table itself. Then modify the last bit of the formula (before all the closing parentheses) to this:
    ALL ( '--tablename--'[UPDATE] ),
                        '--tablename--'[UPDATE]
                            < VALUES ( '--tablename--'[ARRIVAL]
    ) - 7 && '--tablename--'[WorkingDayFlag] = 1

  • How should get last month value from report?

    Hi experts,
    How should last month value. For example
    jan    feb    march
    100   --       ---
    Here i want to get jan month value in march coloumn.

    Hi ,
    It is only show last month value. but my requirement is if last month is empty it should bring Before Last month.
    For Example
      Jan       Feb       Mar
    1000   
    i need if the Feb value is empty should come jan month value.

  • Query to get last updated time of tables

    Hi,
    How to get the last updated date time of the Max DB table
    Regards,
    Satish

    Hi,
    Unfortunately, do not this this would be possible. Check this thread:
    MAXDB Audit logs
    Regards,
    Srikishan

  • I don't get last update iOS 8.3

    I Don't get the last update iOS 8.3

    It may not yet be available in your region. Where are you located?

  • Getting the UPDATEd value and its primary key

    I have two procedures, proc1 and proc2.
    In proc1 there is an update happening like
    CREATE OR REPLACE procedure proc1
    as
    TYPE NumList IS TABLE OF employees.employee_id%TYPE;
    enums NumList;
    TYPE NameList IS TABLE OF employees.last_name%TYPE;
    names NameList;
    BEGIN
    UPDATE emp set sal=900 WHERE department_id = 30
    RETURNING employee_id, last_name BULK COLLECT INTO enums, names;
    DBMS_OUTPUT.PUT_LINE('Updated ' || SQL%ROWCOUNT || ' rows:');
    FOR i IN enums.FIRST .. enums.LAST
    LOOP
    DBMS_OUTPUT.PUT_LINE('Employee #' || enums(i) || ': ' || names(i));
    END LOOP;
    END;
    /In proc2 which is getting executed just after proc2 i want to SELECT the sal column values and its primary keys(employee_id) which got updated in proc 1.
    How can i achieve this?

    add two out parameters from proc1 so that you can pass them into proc2 (obv. you'd need to add two in parameters to proc2 if they aren't there already)

  • Refreshing the page to get last saved value in the select box

    Hi,
    I have a combo box in a form and i have loaded the country name from the DB using bean. Now i have a button near the combo box and if i don't have any particular country in the combo box. I will click that button and the country form will open. Now i will save the country name which is not available and i will close the form. When i close the pop up country window automatically the last saved country name should come and loaded in the parent form's combo box. How should i do that. I have refreshed the page and i am getting some error in that and when i reload the page my previous text box values are vanished. Please help me.
    Thanks in advance.

    Hi,
    Thanks for u r reply.
    But i haven't used the session and hidden variables. can u please explain me in detail.

  • How to fetch last transactioned values for given period

    Hi,
    I'm working on a report, here I'm fetching data from j_2irg1bal table for some period. it has data to internal table like
    e.g. : given period 01-04.2009 to  30.04.2009
    date        mantr  opening balance closing balance
    04.04.2009  1007     100             130
    08.04.2009  1007     130              80
    here for given date two record are available,
    i need to capture last updated value i.e. for date 08.04.2009.
    Kindly suggest your ideas to move with this

    Hi,
    Assume that your values are in internal table ITAB.  Then,
    Sort ITAB by date DESCENDING.
    Doing so, your records gets sorted in Descending Order with respect to Date. And the Last updated record comes in the first position.
    And now,
    Read table ITAB index 1.
    The above code, fetches the last record into the Work-Area.
    That's it.
    Rgds,
    Ramani N

  • How to retrieve workbook's "Last Refreshed" value using VBA?

    Does anyone know how to retrieve a BEx workbook's "Last Refreshed" value using VBA?
    What I've done is expand upon a colleague's existing Excel VBA solution to automatically log into SAP BEx and batch process (and also schedule) the running of multiple BEx reports. As each BEx report in the queue is processed, the results of the run are written to a "Results" worksheet -- indicating whether that BEx report was processed successfully or not. I'm pretty much done, and everything works like a charm.
    Except I have one little problem remaining: during the processing of each BEx report, the SAP BEx status dialog appears, giving the user the ability to cancel the processing of that particular report, if they so desire. If the user cancels, I want my "Results" worksheet to indicate that for that report.
    At first, I thought, okay, I'll just test the return value when calling the SAPBEX.XLA's SAPBEXrefresh function. That function's return value is supposed to return the number of errors that occurred after each time SAPBEXrefresh is fired -- normally it's 0 if everything runs okay. So surely, if the user cancels, there's got to be some sort of error and the return value of SAPBEXrefresh would be > 0, right? Nope, no such luck!
    Which brings me back to my question in this post -- I found out through my company's SAP consultant that, if the user hits cancel in the SAP BEx dialog, the "Last Refreshed" value will not change. Therefore, he told me, simply test the value of the "Last Refreshed" value before and after each BEx reports' run. If the "Last Refreshed" value doesn't change, then presto, you know the user canceled.
    This is where I'm stuck. How do you programmatically get the "Last Refreshed" value? Obviously, you could write VBA code to find the first cell in the BEx report with the text "Last Refreshed" and then get the value in the adjoining cell. The problem with that is, what if, for some stupid reason, there's another cell somewhere in the BEx report with the text, "Last Refreshed". There's no way I can be sure that I've really found the "Last Refreshed" value plugged in by BEx.
    I've been looking extensively in this forum for an answer, but haven't found any. It seems like there are a lot of SAP BEx experts here, and if anyone can help me out here, I would greatly appreciate it.
    Thank you.

    Well, it was a little circuitous, but I figured out the solution to my own question.
    I recalled I had read about the sapbexDebugPrint macro in sapbex.xla in one of Peter Knoer's posts in this forum. So I thought, maybe I can use that to get the before and after refresh values of "Last Refreshed" in the workbook. Well, I was half-right: I could only use sapbexDebugPrint to get the workbook's after-refresh values of "Last Refreshed".
    But it didn't matter!
    As long as the after-refresh value of the workbook's "Last Refreshed" value was later than the after-refresh value of the previous workbook in the processing queue, I knew the refresh was successful and the user didn't cancel. There were some other logic permutations I had to factor in, but basically that was the answer.
    Here are snippets of my code from the main procedure, for anyone's who interested:
                '   **** Refresh query ************************************
                ' Get the previous "Last Refreshed" value
                ' We're going to need to compare this to the "Last Refreshed" value
                ' after running SAPBEXrefresh function to trap the possibility of
                ' the user canceling via the SAPBEx status dialog box
                PrevLastRefr = GetLastRefreshed()
                ' Reactivate the source workbook, just in case
                SourceWorkbook.Activate
                 RefreshRetVal% = Application.Run("SAPBEX.XLA!SAPBEXrefresh", True, , False)
                If RefreshRetVal% <> 0 Then
                    blnProcessingErr = True
                End If
                ' Get the current "Last Refreshed" value and compare it to the previous value
                CurrLastRefr = GetLastRefreshed()
                If CurrLastRefr = "NOT FOUND" Then
                    ' Refresh canceled
                    blnProcessingCanceled = True
                Else    ' We found a valid current "Last Refreshed" value
                    If PrevLastRefr = "NOT FOUND" Then
                        ' Refresh okay
                        blnProcessingCanceled = False
                    Else
                        If CDate(CurrLastRefr) > CDate(PrevLastRefr) Then
                            ' Current "Last Refreshed" value is later than previous value,
                            ' so refresh okay
                            blnProcessingCanceled = False
                        Else
                            ' Refresh canceled
                            blnProcessingCanceled = True
                        End If
                    End If
                End If
                ' Reactivate the source workbook, just in case
                SourceWorkbook.Activate
    And here's my function which retrieves the "Last Refreshed" value by calling sapbexDebugPrint macro in sapbex.xla:
    Function GetLastRefreshed() As Variant
    ' Get the SAP BEx "Last Refreshed" value by calling
    ' SAPBEx.xla's sapbexDebugPrint procedure and creating
    ' the special diagnostic workbook.
    On Error GoTo GetLastRefreshed_Error
        Dim TextCell As Range
        Dim TextCellAddr$
        Dim TextCellRow%, TextCellCol%
        Dim LastRefreshedVal As Variant
        Dim NumWorkbooks%
        ' Initialize
        GetLastRefreshed = "NOT FOUND"
        LastRefreshedVal = "NOT FOUND"
        ' Turn off screen updating until the end
        Application.ScreenUpdating = False
        ' Get the number of currently open workbooks
        NumWorkbooks% = Workbooks.Count
        ' Call the SAPBEx.xla's sapbexDebugPrint procedure
        ' This'll create a diagnostic workbook with all the information
        ' about the BEx query that was previously refreshed
        Application.Run "SAPBEX.XLA!sapbexDebugPrint"
        ' Let's double-check that the diagnostic workbook actually
        ' got created
        ' If there's any error at this point or if the number of workbooks
        ' isn't more than it was a moment ago, raise custom error
        If (Err.Number <> 0) Or (Not (Workbooks.Count > NumWorkbooks%)) Then
            Err.Raise vbObjectError + 513, , "sapbexDebugPrint failed to create the diagnostic workbook"
        End If
        ' We'll need to look at a worksheet named "E_T_TXT_SYMBOLS"
        ' in the diagnostic workbook
        ' If this worksheet doesn't exist, then we know that there
        ' was no previously refreshed query during this session
        ' (We could loop through the collection of worksheets in the workbook
        ' to see if that worksheet actually exists, but we'll use
        ' error handling to deal with this instead)
        ' Find the first cell in the "E_T_TXT_SYMBOLS" worksheet
        ' with the text "Last Refreshed"
        ' (If the worksheet doesn't exist, an error will be thrown...)
        Set TextCell = Sheets("E_T_TXT_SYMBOLS").Cells.Find(What:="Last Refreshed", _
                    LookIn:=xlValues)
        If TextCell Is Nothing Then
            ' Can't find the cell, so we know the user had canceled during previous refresh
            LastRefreshedVal = "NOT FOUND"
        Else
            ' Found the cell, now we're in business
            TextCellAddr$ = TextCell.Address ' $F$11
            TextCellRow% = CInt(Mid(TextCellAddr$, InStr(2, TextCellAddr$, "$") + 1))
            TextCellCol% = ColRef2ColNo(Mid(TextCellAddr$, 2, InStr(2, TextCellAddr$, "$") - 2))
            ' The cell with the "Last Refreshed" value is going to be 2 columns to the right
            LastRefreshedVal = Sheets("E_T_TXT_SYMBOLS").Cells(TextCellRow%, TextCellCol%).Offset(0, 2).Value
            ' Ensure the "Last Refreshed" value is a valid date/time
            If Not IsDate(LastRefreshedVal) Then LastRefreshedVal = "NOT FOUND"
        End If
    GetLastRefreshed_Exit:
        ' Err.Number -2147220991 is my custom raised error:
        ' "sapbexDebugPrint failed to create the diagnostic workbook"
        If Err.Number <> -2147220991 Then
            ' Close the diagnostic workbook and return Last Refreshed value
            Workbooks(ActiveWorkbook.Name).Close SaveChanges:=False
            GetLastRefreshed = LastRefreshedVal
        End If
        Application.ScreenUpdating = True   ' Turn on screen updating
        Exit Function
    GetLastRefreshed_Error:
        Select Case Err.Number
            Case 9  ' Subscript out of range (which means "E_T_TXT_SYMBOLS" worksheet doesn't exist)
                LastRefreshedVal = "NOT FOUND"
            Case Else
                MsgBox "Error encountered during getting Last Refreshed value." & vbCrLf & vbCrLf & _
               "Error: " & Err.Number & " - " & Err.Description, vbExclamation, gstrErrBoxTitle
        End Select
        Resume GetLastRefreshed_Exit
    End Function
    Like I said, the solution was a little circuitous, but it works!

  • How to refresh VO to get the changed value in other AM or backend database

    one VO is refrenced by two AMs, when i insert or update data by VO in one AM, how to get the changed data in another AM ?
    another case is i have updated some attributes of the record in database by SQL statement ,but the client can not get the updated value at once .
    i have tried to use executeQuery() ,but it does not work. now i always do a rollback method ,a bad idea.:)
    pls help me ! thanks
    Message was edited by:
    Guo Qinghua

    Mind that ADF BC (probably like any other persistence framework) caches data. So when you update something in the database other than via ADF BC, you then have in the ADF BC cache what is called 'stale data'. When you try to commit that nevertheless, the database will tell ADF BC that the record in the database has been updated by another user, and a rollback will be done. That is all to be expected.
    You can find some more info on how this works here:
    http://download-uk.oracle.com/docs/html/B25947_01/bcvoeo007.htm
    It also explains how to clear the cache and enforce that data will be read from the database.
    Jan Kettenis

  • Last year value

    I am having a table inv_sales_trgt_val and columns
    branch_cd number(3),
    vndr# number(3),
    yymm number(6) ,
    vgroup# number(3),
    sales_trgt_amt number(11,2),
    sales_actl_amt number(11,2),
    cuml_trgt_amt number(11,2),
    cuml_actl_amt number(11,2),
    last_yr_yymm_amt number(11,2)
    In report i need to get sum(sales_actl_amt) which is present year and sum(last_yr_yymm_amt) which is last year ,i am getting sum(sales_actl_amt) correct value but sum(last_yr_yymm_amt) getting different value .so from sales_actl_amt can i get last year value in report.
    please help me
    thank you.

    Hi Joss,
    In SQL Server Analysis Services, we can can compare revenue with the hierarchy periods (year, month, day) by using the PARALLELPERIOD function, and now you want to compare with custom periods. (NOTE: We cannot compare it with the PARALLELPERIOD function
    since
    PARALLELPERIOD function returns a member from a prior period in the same relative position as a specified member. So if the first time span not equal to the second one (such as the first period is 3 days, and the second period is 2 month)).  Here
    is a sample query about PARALLELPERIOD function for your reference.
    with
    set Hotels as
    [Hotels].[Hotel ID].&[1015],
    [Hotels].[Hotel ID].&[5640],
    [Hotels].[Hotel ID].&[8800]
    set Period as [Arrival Date].[Date].[Month].&[2012]&[1]:[Arrival Date].[Date].[Month].&[2012]&[12]
    member [Arrival Date].[Date].[0] as sum({ Period })
    member [Total Amount N-1] as (PARALLELPERIOD([Arrival Date].[Date].[Year], 1, [Arrival Date].[Date].[Year].&[2012]), [Measures].[Total Amount])
    select
    [Measures].[Total Amount],
    [Measures].[Total Amount N-1]
    } on 0,
    nonemptycrossjoin
    Hotels,
    Hotels.[Hotel].children,
    *{[Arrival Date].[Date].[0]}
    } on 1
    from [Booking_Cube]
    Regards,
    Charlie Liao
    TechNet Community Support

  • How get pervious row value in grid

    hi master
    sir
    I have grid in my form my user design the balance sheet
    Then he want add the last row value in next row
    Such as
    Row2          amount=1000
    Row3               row2+2000
    Total          row3-row2
    How I get last row value
    Please give me idea

    Other solution is to use a collection in a package unit.
    Type TYP_COLL is table of Number INDEX BY BINARY_INTEGER ;
    my_coll TYP_COLL ;
    Then in the Post-Trigger :
    my_coll( :system.current_record ) := value ;so you can navigate easily within the collection in both directions Next/Previous.
    Easy to get the previous value:
    value := my_coll( :system.current_record - 1 ) ;Francois

  • BAPI doesnt show updated values

    Hi Experts,
    I have this problem with a bapi "BAPI_BUS20350_GET_DETAIL", it is used to get the details (descriptions , partners) etc of an Audit.
    The problem is when i make some changes to an audit(say description) in a report and run this bapi it still gives me the old values , it is only when i run the report again that it shows me the new values .
    I would like to get the updated values in the same running session , there is no refresh bapi in the function group.
    Please throw some lite on how to solve this problem.
    Appreciate Ur Replies,
    Chaitanya.

    Hi Chaitanya,
    Please try to call the BAPI, " BAPI_TRANSACTION_COMMIT" which will commit the current work process which in turn help you to solve your current problem, or else you can use ABAP statements like COMMIT, or WAIT UP TO sec SECONDS etc.
    Thanks and Regards,
    Antony Thomas

  • How can I get the last updated email address of the customer ??

    Dear All,
    Please let me know, How can I get the last updated email address of the customer ??
    Also, I am trying to read CDHDR table where OBJECTCLAS is ADRESSE, however what value should be passed into OBJECTID field, looks like it is ADRNR with a Suffix BP.
    Please confirm me what value should be passed into OBJECTID field.
    Thank you.
    Anitha

    Hi Anitha,
      Check if this is something that helps you:
    Change documents in BAS
    CDHDR
    address type 1
    objectclass = ADRESSE             
    objectid = addrgroup + addrnumber     (ADRC-ADDR_GROUP + ADDRNNUMBER) !!
                     'BP  000xxxxxx'
    private address (address type 2)
    objectclass = ADRESSE2
    objectid =  'BP  000xxxxxx000yyyyyyy'   
                            persnumber+adrnr private
    address type 3
    objectclass = ADRESSE3
    objectid =  'BP  000xxxxxx000zzzzzzz'
                              persnumber +comp.address
    The above details is from the link: http://wiki.sdn.sap.com/wiki/display/ERPLO/LO-MD-BP
    Regards,
    Swarna Munukoti

Maybe you are looking for