Complex requirement!!!! Any Help on this !!!

Hi All ,
BANNER
Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
PL/SQL Release 9.2.0.5.0 - Production
CORE     9.2.0.6.0     Production
TNS for 32-bit Windows: Version 9.2.0.5.0 - Production
NLSRTL Version 9.2.0.5.0 - Production
I have a Table having the values as
Emp      Sal      Inc     
100     1000     100
100     1000     900
100     1000     100
200     500     500
300     200     100If Inc is Less Than or equal to Sal - Insert in a Temp - Record 1 ( As it is)
If Inc (Sum Record1 + Record2) ( 100+900 =1000) Since the values is equal to Sal - Insert in a Temp Table - Record 2 ( As it is)
If Inc (Sum Record1 + Record2) ( 100+900+100 =1100) Since the values Inc Sum( 1100) > 1000 - Insert in a Temp1 Table the difference -100 - Record 3
I took a Ex from Internet and started ... whether should i need to use Cursor, Loop ?? Not sure
Since I have not used Loop stmt..
DECLARE
    i NUMBER := 1;
BEGIN
    LOOP
        INSERT INTO T1 VALUES(i,i);
        i := i+1;
        EXIT WHEN i>100;
    END LOOP;
END;Can anyone guide or give some inputs on this ...for me to get started to develop my own development...
Thanks
Ananda
Edited by: Ananda on Apr 8, 2010 9:11 PM
Edited by: Ananda on Apr 8, 2010 9:30 PM
Edited by: Ananda on Apr 9, 2010 2:32 AM
Edited by: Ananda on Apr 9, 2010 3:23 AM
Edited by: Ananda on Apr 9, 2010 12:00 PM

Hi ,
Source: I have just have different Column name ...its is the Exact requirement from the Business not an Example
BANNER
Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
PL/SQL Release 9.2.0.5.0 - Production
CORE     9.2.0.6.0     Production
TNS for 32-bit Windows: Version 9.2.0.5.0 - Production
NLSRTL Version 9.2.0.5.0 - ProductionSource: I have just have different Column name ...its is the Exact requirement from the Business not an Example
Emp      Sal      Inc     
100     1000     100
100     1000     900
100     1000     100
200     500     500
300     200     100
Expected Output
Emp      Sal      Inc
100     1000     100 -- For this record the Inc < Sal ... Insert in a Table1 Similiar Struture
100     1000     900 -- For this record the Sum(IncRecord1+IncRecord2)(100+900) < Sal....Insert in a Table1 Similiar Struture
100     1000     -100 -- For this record the Sum(IncRecord1+IncRecord2+IncRecord3))(100+900+100) < Sal....Insert in a Table2 Similiar Struture
200     500     500 -- For this record the Inc = Sal we insert
300     200     100 -- For this record the Inc < Sal we insertExplanation
==============
If Inc is Less Than or equal to Sal - Insert in a Temp - Record 1 ( As it is)
If Inc (Sum Record1 + Record2) ( 100+900 =1000) Since the values is equal to Sal - Insert in a Temp Table - Record 2 ( As it is)
If Inc (Sum Record1 + Record2) ( 100+900+100 =1100) Since the values Inc Sum( 1100) > 1000 - Insert in a Temp1 Table the difference -100 - Record 3
Thanks
Emp      Sal     Inc     
100     1000     100
100     1000     900
100     1000     100
200     500     500
300     200     100
Expected Output
Emp      Sal     Inc
100     1000     100 -- For this record the Inc < Sal ... Insert in a Table1 Similiar Struture
100     1000     900 -- For this record the Sum(IncRecord1+IncRecord2)(100+900) < Sal....Insert in a Table1 Similiar Struture
100     1000     -100 -- For this record the Sum(IncRecord1+IncRecord2+IncRecord3))(100+900+100) < Sal....Insert in a Table2 Similiar Struture
200     500     500 -- For this record the Inc = Sal we insert
300     200     100 -- For this record the Inc < Sal we insert
Explanation
==============
If Inc is Less Than or equal to Sal - Insert in a Temp - Record 1 ( As it is)
If Inc (Sum Record1 + Record2) ( 100+900 =1000) Since the values is equal to Sal - Insert in a Temp Table - Record 2 ( As it is)
If Inc (Sum Record1 + Record2) ( 100+900+100 =1100) Since the values Inc Sum( 1100) > 1000 - Insert in a Temp1 Table the difference -100 - Record 3
Thanks

Similar Messages

Maybe you are looking for

  • Repair or Change Motherboard

    Hi, I've got a Lenovo 3000 N200 0769-AH9 Laptop with a T9300 Penryn-CPU and broke my Mainboard(CPU-Cooler doesn't work any more).  I saw a Mainboard for 150 €, which is very cheap, as there are no replacement mainboards to buy under 400€. I would buy

  • Photoshop CS4 on Yosemite Not Printing

    Thanks to Millenium, I got CS4 to work on Mac OS X Yosemite, but it seems like my Epson r2880 won't print from it. I can get printing from CS6 and other programs, but not from CS4 :-? Any ideas?

  • Open on startup?

    Can I set Mail to automatically open and get n messages every time I start my computer? If so, how?

  • Same project in CS5 to PAL DVD and NTSC DVD.

    Hi everyone, I am trying to find best solution how to do it. My project is slideshow with scaled JPEG images and some video clips from DSLR camera Canon T3i. I know that video is 16:9 (1920x1080, 29.97fr) ratio and my output should be 4:3 ratio. With

  • SRM EBP certification --- Please guide

    Hi Friends, I want to take the SRM EBP certification, Please guide me on the same. Please send me the document " SAP BestPractices for SRM "  and other relevant documents needed for SAP SRM EBP certification with sample questions on the same. My mail