Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can we manage the gap in a primary key column created
by a sequence?
Ex:a company has empno as primary key generated by a
sequence and some employees leaves in between.What is the
best way to manage this gap?

Answer Posted / poornima

using cursor we find the gap in sequence, but this method
is quite complicated and slow process...

so we use some analyical fuctions such as lead and lag as

{LEAD | LAG} (value_expression, offset, default)
OVER ([PARTITION BY expr] ORDER BY expr)

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List out the difference between commit, rollback, and savepoint?

1018


How to define a procedure inside another procedure?

999


what are steps for interface? where is exchange rate defined in which table?

2121


How to omit columns with default values in insert statement in oracle?

1036


What is save point in oracle database?

1281


How to add a new column to an existing table with a default value?

1000


What is tns name?

963


What are the attributes of cursor?

1033


How do we get field detail of a table?

1057


Can we store pictures in the database and if so, how it can be done?

1017


How to test null values?

1080


Explain the use of owner option in exp command.

1027


List the various oracle database objects?

1041


Explain a segment?

1072


How do I limit the number of rows returned by an oracle query after ordering?

1143