Home » SQL & PL/SQL » SQL & PL/SQL » To determine if the column value is decreasing (Oracle 11g )
To determine if the column value is decreasing [message #633470] Thu, 19 February 2015 06:59 Go to next message
roblvl
Messages: 27
Registered: June 2003
Junior Member
Hi friends

I have a table like this

Seq_id Ins_no Ins_Sa
20 0 1000
21 1 900
22 2 800
23 3 700
24 4 600
25 5 500
26 6 400
27 7 300
28 8 200

As the installment no increases , Installment SA reduces , however if due to some error
if the table data comes like this

Seq_id Ins_no Ins_Sa
20 0 1000
21 1 900
22 2 800
23 3 900 --- *
24 4 600
25 5 500
26 6 600----- *
27 7 300
28 8 200

I want to determine what are the rows in which the Installment sa has not decreased as the Installment
number increased.

your help on this is highly appreciated
Re: To determine if the column value is decreasing [message #633471 is a reply to message #633470] Thu, 19 February 2015 07:02 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Your effort will also be appreciated if you follow the posting guidelines. What stops you from using code tags? Where is the test case?

[Updated on: Thu, 19 February 2015 07:27]

Report message to a moderator

Re: To determine if the column value is decreasing [message #633476 is a reply to message #633471] Thu, 19 February 2015 07:29 Go to previous message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
See whether LAG / LEAD analytic functions might help. They enable you to view previous / next record's values and compare them to current record ones.
Previous Topic: Oracle 11g
Next Topic: New to using Oracle. Need help!
Goto Forum:
  


Current Time: Fri Apr 19 15:39:53 CDT 2024