SQL Language (MOSC)

MOSC Banner

Using Case when with insert statement

edited May 31, 2015 1:56AM in SQL Language (MOSC) 2 commentsAnswered ✓

Hello All,

I want to create a query in sql for the below table

Cost Center     Position     ID

 

   

03-12111110122
03-12111111211
05-00000100802
07-01322108027

I want to input the ID of particular row on the basis of cost center of the previous row. For row 1, The value of ID should be 1

For row 2, The value should be 1+1 =2 as the cost center of previous row is same as the current row. The value of ID for row 3, should be 1 as the cost center of previous row is not same as the cost center of current row.

Thanks in advance

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center