Want a query to see only the changes data of a specific no.

here are the table sturcucture and data for the table:
create table import_lc (
LC_NO varchar2(20),
AMEND_NO varchar2(2),
USANCE_PERIOD number,
AMT_FCY number,
AMT_LCY number,
SHIPMENT_PERIOD number,
EXPIRY_DATE date,
EXPIRY_PLACE varchar2(50));
Insert into FE_IMPORT_LC
(LC_NO, AMEND_NO, USANCE_PERIOD, AMT_FCY, AMT_LCY, SHIPMENT_PERIOD, EXPIRY_DATE,
EXPIRY_PLACE)
Values
('1', '1', 90, 10000, 500000, 15, TO_DATE('02/13/2008 00:00:00', 'MM/DD/YYYY
HH24:MI:SS'), 'DHAKA');
Insert into FE_IMPORT_LC
(LC_NO, AMEND_NO, USANCE_PERIOD, AMT_FCY, AMT_LCY, SHIPMENT_PERIOD, EXPIRY_DATE,
EXPIRY_PLACE)
Values
('1', '2', 90, 10000, 500000, 30, TO_DATE('03/13/2008 00:00:00', 'MM/DD/YYYY
HH24:MI:SS'), 'DHAKA');
Insert into FE_IMPORT_LC
(LC_NO, AMEND_NO, USANCE_PERIOD, AMT_FCY, AMT_LCY, SHIPMENT_PERIOD, EXPIRY_DATE,
EXPIRY_PLACE)
Values
('2', '1', 90, 15000, 800000, 30, TO_DATE('01/19/2008 00:00:00', 'MM/DD/YYYY
HH24:MI:SS'), 'DHAKA');
Insert into FE_IMPORT_LC
(LC_NO, AMEND_NO, USANCE_PERIOD, AMT_FCY, AMT_LCY, SHIPMENT_PERIOD, EXPIRY_DATE,
EXPIRY_PLACE)
Values
('2', '2', 120, 20000, 1000000, 30, TO_DATE('01/19/2008 00:00:00', 'MM/DD/YYYY
HH24:MI:SS'), 'DHAKA');
COMMIT;
NOW, if u see the table data, u see,
for lc_no=1; only the shipment_period and expiry_date has been changed with the
amend_no.
NOW, if u see the table data, u see,
for lc_no=2; only the amt_fcy and amt_lcy has been changed with the amend_no.
there could be many more columns like these where the data can change with the
amend_no but the lc_no will be the same.
now, i want to make a query by which i can see only the changes column value for a
particular lc_no and maximum amend_no for that lc_no.
& result data should be from the maximum amend_no for that lc_no.
like:
for lc_no = 1 ;
SHIPMENT_PERIOD EXPIRY_DATE
30          13-03-2008
And for lc_no = 2 ;
USANCE_PERIOD     AMT_FCY     AMT_LCY
120          20000     1000000

I'm not sure that I completely understand your requirement, but here's something that should, at the very least, get you started. If you don't know what the LAG function does, look it up in the documentation.
SELECT lc_no,
       amend_no,
       usance_period,
       amt_fcy,
       amt_lcy,
       shipment_period,
       expiry_date,
       expiry_place
FROM   (SELECT lc_no,
               amend_no,
               CASE
                 WHEN usance_period <> LAG (usance_period) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN usance_period
               END usance_period,
               CASE
                 WHEN amt_fcy <> LAG (amt_fcy) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN amt_fcy
               END amt_fcy,
               CASE
                 WHEN amt_lcy <> LAG (amt_lcy) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN amt_lcy
               END amt_lcy,
               CASE
                 WHEN shipment_period <> LAG (shipment_period) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN shipment_period
               END shipment_period,
               CASE
                 WHEN expiry_date <> LAG (expiry_date) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN expiry_date
               END expiry_date,
               CASE
                 WHEN expiry_place <> LAG (expiry_place) OVER (PARTITION BY lc_no ORDER BY amend_no) THEN expiry_place
               END expiry_place,
               rn
        FROM   (SELECT lc_no,
                       amend_no,
                       usance_period,
                       amt_fcy,
                       amt_lcy,
                       shipment_period,
                       expiry_date,
                       expiry_place,
                       ROW_NUMBER () OVER (PARTITION BY lc_no ORDER BY amend_no DESC) rn
                FROM   fe_import_lc)
        WHERE  rn <= 2)
WHERE  rn = 1

Similar Messages

  • I used to be able to see a preview of my scan which i can no longer see only the adobe acrobat symbol I am using Adobe pro 9 can this be changed??

    I used to be able to see a preview of my scan which i can no longer see only the adobe acrobat symbol I am using Adobe pro 9 can this be changed??

    Yes, that appears how Mavericks works right now. However, you can open the Address Panel, select all your contacts, then click the To (or CC, or Bcc) buttons to move the selection to the address field.
    If it is not already in the Toolbar, right-click on the Toolbar and select Customize Toolbar…
    Then, drag the address panel up to wherever you want it.
    You may also want to add it to the New Message window in the same way.

  • I have been using the Firefox feature in which I could have multiple sets of tabs open but see only the set I was working with. I updated and now feature is gon

    I have been using the Firefox feature in which I could have multiple sets of tabs open but see only the set I was working with. I updated and now feature is gone. I had a small icon on the upper right side of my toolbar. I used it all the time to keep separate windows for news, financial items, travel plans, etc. Has this been removed from Firefox?

    Hi,
    The [https://support.mozilla.org/en-US/kb/tab-groups-organize-tabs Tab Groups] feature is still present. You can try to right-click the + after the last tab and [https://support.mozilla.org/en-US/kb/how-do-i-customize-toolbars Customize]. If the icon is hidden behind another, or if it's available inside the Customize mini window, you can place it back. If the problem persists, you can also try to '''Reset toolbars and controls:''' and '''Make Changes and Restart''' [https://support.mozilla.org/en-US/kb/Safe%20Mode Safe Mode] start screen.

  • How to get the only the changed or newly added entries in AFTER SAVE.

    I have created table maintenance generated for a table,I want to get the newly added or changed entries while saving thats why im using AFTER SAVE event for the same,can anyone please tell me how to get the only the changed or newly added entries in AFTER SAVE.

    Hi,
    Welcome you post on the forum.
    I have moved your thread here because it is in English and should not in the language specific forum. What is your system version?
    Thanks,
    Gordon

  • Does Universal Connector read only the changes or the whole of the database everytime

    Does the Universal Connector read only the changes in the external database into the Connector View every scheduled cycle or does it read the whole of the database into the connector view every time ?
    I need to write a indirect connector for Lotus Notes database using the universal connector and univeral text parse.So I want to know if the Import and Dump scripts that I will have to write will have to read just the changes that took place or the whole of the Notes DB everytime ?
    -Aparna

    If it is possible to get just the changes then do that.

  • My i phone 5s is open and close . i see only the of apple

    My i phone 5s is open and close . i see only the logo of apple

    Hi Imad101,
    Thanks for using Apple Support Communities.  If you're unable to get past the Apple logo on your iPhone 5s, this article may help:
    iOS: Unable to update or restore
    http://support.apple.com/kb/ht1808
    Cheers,
    - Ari

  • How can I  see only the music that is downloaded onto my ipad instead of entire Homesharing library?

    How can I  see only the music that is downloaded onto my ipad instead of entire Homesharing library?

    Turning off Home Sharing would seem the most logical step.

  • In ios 6 I could choose an artist on the music app and see all his albums in a list. Now, with ios 7, it shows all the songs from every album, making it EXTREMELY hard to see all the albums. Is there a way to minimize this view and see only the albums?

    Hello!
    I need some help with the music app in ios 7...
    In ios 6, I could choose an artist from the "srtists" view and it would show me all his albums as a list. Now, in ios 7, when I choose an artist, it shows me every song underneath every album, making it impossible to see al the albums at once! Is there anyway to minimize this view so I could see only the albums' titles as a list?
    It is VERY annoying. I would very much appreciate any help on this! 
    Thank you

    Exactly!
    This is all about the experience and accessibility. I don't even mind if the new desing is beautiful or not, but if I find myself, like you, avoiding looking for my music, my experience becomes frustrating. I have about 35 albums of a single artist and I used to love going over them and choose the right thing for me, especially being on the road a lot, and now I have to think twice about even entering his name.
    I really hope Apple will take those kind of things into consideration when they issue updates for ios 7, and maybe also give us back the goole search which was embeded into the spotlight search (which is really not that big of a request).
    And for your 4s - get the new iphone, it's MUCH better

  • In my old OS I could press F11 and clear all the open windows from view to see only the desktop. How can I do that now in Mavricks?

    In my old OS I could press F11 and clear all the open windows from view to see only the desktop. How can I do that now in Mavricks?

    system preference > Keyborad >  click the box thast says  use all f1,f2,f2 keys as standard functiong Key and then the f11 key should casue all window fo fly to the side and you can see your desktop

  • The websites are being stretched sideways to twice their normal width so I can see only the left half of a site unless I go into "Fullscreen" mode; ideas?

    Whenever I use Firefox the page opens so that I can see only the left half of whatever site; i.e. half of the useful page info (the rest is cut off) displays on the right half of my screen while the left half of my screen shows just background of the site. Using the maximise/restore button does nothing. If I swap to the fullscreen view I can see everything fine but obviously I lose my tool bars. I installed the latest version of Firefox with no joy. I've looked for a page setup function to no avail. I thought that time would fix this as it is something that has happened before but was temporary. Other browsers work fine. I thought about uninstalling then re-installing but I'm not keen to lose my bookmarks etc. unless I have to. Thanks for your help in advance; I hope this ramble makes some sense.
    Cheers.

    This issue can be caused by the Babylon Toolbar 1.1.8 extension
    See:
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • When I open a pdf in Adobe Acrobat xi pro it is not displaying correctly. If a file is all black with orange writing, I will see only the orange writing. Its not until i print it or open crop pages dialog box that i see the background. i am on a Windows 7

    When I open a pdf in Adobe Acrobat xi pro it is not displaying correctly. If a file is all black with orange writing, I will see only the orange writing. Its not until i print it or open crop pages dialog box that i see the background.
    i am on a Windows 7 professional PC, 64-bit.

    If anyone is reading this still looking for what caused the issue and how to fix it here is what I discovered.
    The antivirus program our company uses, Bitdefender Antivirus Plus, was causing some of the PDF files not to open. After troubleshooting the different modules and settings the culprit was..
    Scan SSL in Privacy Control Settings. Turning it OFF solved the problem and all the PDF files that previously would not open now open just fine. This issue has been sent to Bitdefender for them to review. If you use a different antivirus program and are having this issue try locating the Scan SSL setting and see if turning it off solves the problem.

  • TS3899 I can preview email when it arrives (I chose 5 lines) but when I then go to open up the full email, I see only the header info (To, Subject & Date); nothing in the body...it is blank.  This only started recently as before, it worked as expected. He

    I can preview email when it arrives (I chose 5 lines) but when I then go to open up the full email, I see only the header info (To, Subject & Date); nothing in the body...it is blank.  This only started recently as before, it worked as expected. Help?

    I have two yahoo accounts and I know as they 'improved' their servers I had periodic outages. It'd work fine on my webmail on  my computer, webmail on the iPad, but not via the mail app. And it was stuff on their end. It may be a case of wait and see and you may need to eventually remove/readd the account on your iPhone.
    When the issue is on their end, unfortunately there's not much for users to do beyond wait it out or find work arounds.

  • When I play a video in mirroring mode,I can see only the video  in the tv thru apple tv ,not in my ipad 2 how  can i fix it? to see in both parts.

    when I play a video in mirroring mode,I can see only the video  in the tv thru apple tv ,not in my ipad 2 how  can i fix it? to see in both parts.

    Have you tried resetting the iPad:
    Reset iPad:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.

  • How to get only the changed rows in h:dataTable

    Hi,
    I am very new in jsf technology.
    For our application, I need to process only the changed rows in the jsf datatable in managed bean.
    User may also enter new rows.We have to consider this also.
    Pls post ur suggession as soon as possible.This is urgent.This will be best if someone can post me some code snippets.
    Thanks
    -S

    As klejs said, set the valueChangeListener attribute to each of the input fields. Have a method in your backing bean which would
    1) get the index from the component id
    2) get the object and the above index from ArrayList
    3) check if the old Value is different from the new value. If yes, set some boolean flag in that object to true indicating that the row is modified.
    Sample code below. Please feel free to add checks if you need.
         public void updateDirtyFlag(ValueChangeEvent valueChangeEvent){
             if(valueChangeEvent.getOldValue()==null && valueChangeEvent.getNewValue()==null){
                     return;
             if(valueChangeEvent.getComponent().getId()==null){
                 return;
          //Extract the index from the component id in the getId method
             int idVal=getId(valueChangeEvent.getComponent().getClientId(FacesContext.getCurrentInstance()));
             ArrayList dataList=getData(); // data from session or request scope
              if((valueChangeEvent.getOldValue()==null && valueChangeEvent.getNewValue()!=null)        
                     || (valueChangeEvent.getOldValue()!=null && valueChangeEvent.getNewValue()==null)){
                 if(dataList!=null && idVal<dataList.size() && idVal>-1){
                     YourBaseValueObject pojo=(YourBaseValueObject)dataList.get(idVal);
                     pojo.setUpdateFlag(true);
             else if(valueChangeEvent.getOldValue()!=null && valueChangeEvent.getNewValue()!=null && !valueChangeEvent.getOldValue().equals(valueChangeEvent.getNewValue())){
                 if(dataList!=null && idVal<dataList.size() && idVal>-1){
                     YourBaseValueObject pojo=(YourBaseValueObject)dataList.get(idVal);
                     pojo.setUpdateFlag(true);
         }HTH.
    Karthik

  • Time delay on seeing the changed data onto the webi reports

    Hello,
    I'm new to BOBJ and was hoping someone can help me with adjusting the time delay the reflects the changed data to the Webi reports.
    I have a user that would update a form on our EP.  Afterward, she would have to wait a while before she can see the changed data on our Webi reports.
    can you please tell me the default time lag and show me where I can change it if required?
    thanks.

    Thanks for the reply.
    Our BO is 3.1 SP4.
    We just implemented PBF (Public Budget Formulation) and our forms are running on NWCE server.  It's being written to our backend BW 7.01 SP8 server.  I was told by our users that after she updates some new information on the form, it takes a while before she can see it on the reports.  My understanding was the universe should see the updated data from our BW immediately after they refresh.  Just as you both mentioned.  But according to the users, its not.  there's a time delay.
    I'm going to test this myself if there's a delay.  In the meantime and suggestion would be helpful.

Maybe you are looking for