Home » SQL & PL/SQL » SQL & PL/SQL » searching through at table
searching through at table [message #434805] Thu, 10 December 2009 20:48 Go to next message
shapik
Messages: 1
Registered: December 2009
Location: islamabad
Junior Member
im new to pl/sql and need help

i want to search through a table column and check weather a sequence is broken which means i have to compare two consecutive entries in a column.

Re: searching through at table [message #434807 is a reply to message #434805] Thu, 10 December 2009 20:51 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>i want to search through a table column and check weather a sequence is broken which means i have to compare two consecutive entries in a column.

Rows in a table are like balls in a basket.
After you have 1 ball in your hand, how do you obtain the consecutive ball?

You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Go to the URL above click the link "Posting Guidelines"
Go to the section labeled "Practice" & do as directed.

This is actually a FAQ.
SEARCH this forum for LAG function.
Re: searching through at table [message #434813 is a reply to message #434805] Thu, 10 December 2009 22:47 Go to previous message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
You can do this by single SQL statement. No PL/SQL block is required.

What you can do is, sort all those record in particular order and compare two consicutive values of required column using LAG/LEAD function.

regards,
Delna
Previous Topic: Is there any single line sql syntax to disable all constraint in a table
Next Topic: ORA-04021 Timeout occured while waiting to lock object
Goto Forum:
  


Current Time: Sat Feb 15 02:24:36 CST 2025