[Oracle 8i] Need help pruning branches from a hierarchical query

My problem is that my hierarchical query seems only to trim out the values that don't meet my criteria, but still includes their children. When my query hits a record that does not meet my criteria, I want it to stop there. I've tried including the criteria in just the 'where' clause of the query, and have also put the criteria in the 'connect by' clause as well, but nothing has fixed it. Please keep in mind I'm using Oracle 8i, so I can't use some of the 'nicer' statements for hierarchical queries that they introduced in 9. I'm stuck with 'Start With...Connect By'.
I have sample tables/data that I can post if someone needs to see that to help me, but to start with, here's my current query:
SELECT     *
FROM     (
          SELECT
               LEVEL
          ,     c_bill.comp_part_nbr                     AS     c_part_nbr
          ,     (select c_part.part_desc
               FROM part c_part
               WHERE c_part.part_nbr=c_bill.comp_part_nbr)     AS     c_part_desc
          ,     (SELECT c_part.part_type
               FROM part c_part
               WHERE c_part.part_nbr=c_bill.comp_part_nbr)      AS     c_part_type
          ,     c_bill.qty_per                          AS     c_qty_per_p
          ,     c_bill.qty_per_type                     AS     c_qty_per_type
          ,     (SELECT c_part.qty_on_hand                
               FROM part c_part
               WHERE c_part.part_nbr=c_bill.comp_part_nbr)      AS     c_qty_on_hand
          ,     c_bill.oper_nbr                     AS     rqd_at_op
          ,     c_bill.comp_off_adj                     AS     rqd_offset
          ,     c_bill.bom_doc_nbr                     AS     p_part_nbr
          ,     (SELECT p_part.qty_on_hand
               FROM part p_part
               WHERE p_part.part_nbr=c_bill.bom_doc_nbr)      AS     p_qty_on_hand
          FROM
               BILL c_bill
          WHERE
                         (c_bill.status           =      'RL')           
                    AND     (c_bill.view_code     IN      ('M','G'))     
                    AND     (c_bill.end_eff_dt     >      SYSDATE)      
                    AND     (c_bill.begn_eff_dt     <=      SYSDATE)
          START WITH c_bill.bom_doc_nbr=RPAD(?,25)
          CONNECT BY PRIOR c_bill.comp_part_nbr=c_bill.bom_doc_nbr
          AND     c_bill.view_code     IN     ('M','G')     
          AND     c_bill.status          =     'RL'
          AND      c_bill.end_eff_dt     >     SYSDATE
          AND     c_bill.begn_eff_dt     <=     SYSDATE     
     ) a
WHERE     c_part_type = 'M'

The outside criterion of part_type='M' isn't my problem. Where I'm actually seeing my issue rear its ugly head is in the criterion:
(c_bill.view_code     IN      ('M','G'))What I'll have happen is that one of the children or grandchildren of the part number I'm querying for (my parameter), will be of some view code that's not 'M' or 'G'. In my sample data below, I have a level 4 part that is part of the 'H' view code, which I don't want, nor do I want it's children. However, its child is in the 'G' view code, and my query returns it anyway.
In my sample data below, I'm assuming that the parameter = 'XYZ-100'
CREATE TABLE part
part_nbr     varchar(25) not null,
part_desc     varchar(25) not null,
part_type     char(1) not null,
qty_on_hand     double(13,4) not null
CONSTRAINT part_pk
PRIMARY KEY (part_nbr),
CONSTRAINT check_part_type
CHECK (part_type IN ('M','P','X','Y')),
CONSTRAINT check_qty_on_hand
CHECK (qty_on_hand >= 0)
CREATE TABLE bill
row_added_ts     char(20) not null,
bom_doc_nbr     varchar(25) not null,
comp_part_nbr     varchar(25) not null,
qty_per          double(9,5) not null,
qty_per_type     char(1) not null,
oper_nbr     char(4) not null,
comp_off_adj     double(3,0),
status          char(2),
view_code     char(1) not null,
end_eff_dt     date() not null,
begn_eff_dt     date() not null
CONSTRAINT bill_pk
PRIMARY KEY (row_added_ts),
CONSTRAINT check_qty_per_type
CHECK (qty_per_type IN ('0','1','2','3')),
CONSTRAINT check_status
CHECK (status IN ('IN', 'RL')),
);     Values for those tables:
INSERT INTO part
VALUES ('xyz-1', 'purchased part', 'P', 5);
INSERT INTO part
VALUES ('xyz-2', 'purchased part', 'P', 1);
INSERT INTO part
VALUES ('xyz-3', 'purchased part', 'P', 1);
INSERT INTO part
VALUES ('xyz-3a', 'manufactured part', 'M', 1);
INSERT INTO part
VALUES ('xyz-4', 'purchased part', 'P', 1);
INSERT INTO part
VALUES ('xyz-9-1', 'manufactured part', 'M', 0);
INSERT INTO part
VALUES ('xyz-9a', 'manufactured part', 'M', 0);
INSERT INTO part
VALUES ('raw-1', 'purchased raw material', 'P', 212);
INSERT INTO part
VALUES ('raw-2', 'purchased raw material', 'P', 75.5);
INSERT INTO part
VALUES ('XYZ-100', 'manufactured part', 'M', 0);
INSERT INTO part
VALUES ('(OPEN)', '(not in use)', 'Y', 0);
INSERT INTO part
VALUES ('XYZ-100-1', 'manufactured part', 'M', 0);
INSERT INTO part
VALUES ('XYZ-100-2', 'manufactured part', 'M', 1);
INSERT INTO part
VALUES ('XYZ-100-3', 'manufactured part', 'M', 0);
INSERT INTO part
VALUES ('XYZ-100-4', 'manufactured part', 'M', 2);
INSERT INTO part
VALUES ('XYZ-100-A', 'manufactured part', 'M', 0);
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100','xyz-1',3,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100','XYZ-100-1',1,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-1','xyz-1',2,'1','****',1,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-1','XYZ-100-2',3,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-2','xyz-2',6,'1','****',2,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-2','xyz-4',6,'1','****',2,'IN','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-2','xyz-100-3',1,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-3','xyz-3',8,'1','****',1,'RL','M','01-Jan-2050','01-Jan-2000');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-3','xyz-3a',8,'1','****',1,'RL','M','01-Jan-2000','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-3','XYZ-100-4',4,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-3','XYZ-100-A',2,'1','****',2,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008071153100150000','XYZ-100-3','(OPEN)',2,'1','****',0,'RL','E','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008071153100150000','XYZ-100-3','xyz-9-1',2,'1','****',0,'RL','H','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-4','raw-1',8.75,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-A','raw-2',3.75,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008075911100150000','xyz-9-1','xyz-9a',1,'1','****',0,'RL','G','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008087711100150000','xyz-9a','raw-2',3.75,'1','****',0,'RL','G','01-Jan-2050','01-Jan-1900');Sample data displayed in table format:
--PART table (from insert statements above)
part_nbr     part_desc          part_type     qty_on_hand
xyz-1           purchased part          P          5
xyz-2           purchased part          P          1
xyz-3           purchased part          P          1
xyz-3a           manufactured part     M          1
xyz-4           purchased part          P          1
xyz-9-1           manufactured part     M          0
xyz-9a           manufactured part     M          0
raw-1           purchased raw material     P          212
raw-2           purchased raw material     P          75.5
XYZ-100           manufactured part     M          0
(OPEN)          (not in use)          Y          0
XYZ-100-1     manufactured part     M          0
XYZ-100-2     manufactured part     M          1
XYZ-100-3     manufactured part     M          0
XYZ-100-4     manufactured part     M          2
XYZ-100-A     manufactured part     M          0
--BILL table (from insert statements above)
row_added_ts          bom_doc_nbr     comp_part_nbr     qty_per     qty_per_type     oper_nbr     comp_off_adj     status     view_code     end_eff_dt     begn_eff_dt
2008072153100150000     XYZ-100          xyz-1          3     1          ****          0          RL     G          01-Jan-2050     01-Jan-1900
2008072223100150000     XYZ-100          XYZ-100-1     1     1          ****          0          RL     M          01-Jan-2050     01-Jan-1900
2008072411100150000     XYZ-100-1     xyz-1          2     1          ****          1          RL     M          01-Jan-2050     01-Jan-1900
2008072459100150000     XYZ-100-1     XYZ-100-2     3     1          ****          0          RL     M          01-Jan-2050     01-Jan-1900
2008072578100150000     XYZ-100-2     xyz-2          6     1          ****          2          RL     M          01-Jan-2050     01-Jan-1900
2008072694100150000     XYZ-100-2     xyz-4          6     1          ****          2          IN     G          01-Jan-2050     01-Jan-1900
2008072786100150000     XYZ-100-2     xyz-100-3     1     1          ****          0          RL     M          01-Jan-2050     01-Jan-1900
2008072865100150000     XYZ-100-3     xyz-3          8     1          ****          1          RL     M          01-Jan-2050     01-Jan-2000
2008073100100150000     XYZ-100-3     xyz-3a          8     1          ****          1          RL     M          01-Jan-2000     01-Jan-1900
2008073159100150000     XYZ-100-3     XYZ-100-4     4     1          ****          0          RL     M          01-Jan-2050     01-Jan-1900
2008073346100150000     XYZ-100-3     XYZ-100-A     2     1          ****          2          RL     M          01-Jan-2050     01-Jan-1900
2008073478100150000     XYZ-100-3     (OPEN)          2     1          ****          0          RL     E          01-Jan-2050     01-Jan-1900
2008073529100150000     XYZ-100-3     xyz-9-1          2     1          ****          0          RL     H          01-Jan-2050     01-Jan-1900
2008073798100150000     XYZ-100-4     raw-1          8.75     1          ****          0          RL     M          01-Jan-2050     01-Jan-1900
2008073811100150000     XYZ-100-A     raw-2          3.75     1          ****          0          RL     M          01-Jan-2050     01-Jan-1900
2008075911100150000     xyz-9-1          xyz-9a          1     1          ****          0          RL     G          01-Jan-2050     01-Jan-1900
2008087711100150000     xyz-9a          raw-2          3.75     1          ****          0          RL     G          01-Jan-2050     01-Jan-1900--What I want to get with my query (branches pruned off my tree)
LEVEL     C_PART_NBR     C_PART_DESC          C_PART_TYPE     C_QTY_PER_P     C_QTY_PER_TYPE     C_QTY_ON_HAND     RQD_AT_OP     RQD_OFFSET     P_PART_NBR     P_QTY_ON_HAND
1     XYZ-100-1     manufactured part     M          1          1          0          ****          0          XYZ-100          0
2     XYZ-100-2     manufactured part     M          3          1          1          ****          0          XYZ-100-1     0
3     xyz-100-3     manufactured part     M          1          1          0          ****          0          XYZ-100-2     1
4     XYZ-100-4     manufactured part     M          4          1          2          ****          0          XYZ-100-3     0
4     XYZ-100-A     manufactured part     M          2          1          0          ****          2          XYZ-100-3     0--What I actually get with my query (includes children of items that don't meet query criteria)
LEVEL     C_PART_NBR     C_PART_DESC          C_PART_TYPE     C_QTY_PER_P     C_QTY_PER_TYPE     C_QTY_ON_HAND     RQD_AT_OP     RQD_OFFSET     P_PART_NBR     P_QTY_ON_HAND
1     XYZ-100-1     manufactured part     M          1          1          0          ****          0          XYZ-100          0
2     XYZ-100-2     manufactured part     M          3          1          1          ****          0          XYZ-100-1     0
3     xyz-100-3     manufactured part     M          1          1          0          ****          0          XYZ-100-2     1
4     XYZ-100-4     manufactured part     M          4          1          2          ****          0          XYZ-100-3     0
4     XYZ-100-A     manufactured part     M          2          1          0          ****          2          XYZ-100-3     0
5     xyz-9a          manufactured part     M          1          1          0          ****          0          xyz-9-1          0Edited by: user11033437 on Jul 30, 2009 7:27 AM (grammar)

Similar Messages

  • TS1389 I need help removing UAC from itunes..

    I need help removing UAC from itunes so it will not allow me to open itunes. Everything I have read from other comments that you shouldn't turn off your user account control. I just to be able to open itunes. Can anyone help me with this problem?? Greg, ogrady612@yahoo,com

    I had this problem too but you do not need UAC to be turned on.
    Click on start and search for 'uac' in the search box at the bottom and click on 'Change User Account Control Settings' when it comes up. Move the slider to the bottom when the window appears and save the changes and your done!
    It's worked for me and my uac has been off for months without causing me any problems!
    Hope this helped

  • Need help coping project from one computer to another.

    I need help coping project from one computer to another.  I loaded all video on computer 1, copied events and project folder to computer 2.  I was told I only needed to copy the project folder back to computer 1 since the events folder is already there.   I copied project folder back to computer 1 but the files wont open.  I dont have computer 2 available. 
    Please help!!!

    Hi
    No that's not the way to do it - iMovie gets confused and in some cases the problems might be un-repairable.
    You've got several problems
    • iMovie'08 - CAN NOT MOVE PROJCTS - You NEED iMovie'09 or iMovie'11 - I see no other working solution
    • Never MOVE or alter any folder named
    iMovie Projects - or -
    iMovie Events
    on DeskTop/Finder - This might be very harmful
    • Moving (Projects) and Events - HAS TO be done within the iMovie Application.
    You've got an Evets window and here You can view Your Events in two ways - Yearly - or - Yearly per Hard disk
    Here You can move within this "window" to another location
    • Projects - NO they do not contain Your full movie - only a document on howto use the material in Event folder
    and there might be worse if You added Photos from iPhoto and Audio from iTunes/Garageband - then You have
    to get this over to the second Mac too, to be able to continue editing.
    So to move Your projects to another Mac You need
    • iMovie'09 or 11
    • an external hard disk -
    MUST BE Mac OS Extended formatted - as UNIX/DOS/FAT32/Mac OS Exchange will not work for VIDEO
    Should be a FireWire one - as UBS/UBS2 performs badly when used for video
    • Then move/copy over within Project resp Events window in iMovie Application
    Hopefully I've been not to confusing or badly structured to be followed.
    Yours Bengt W

  • I need help removing CS3 from Windows 7 so I can reinstall

    I need help removing CS3 from Windows 7 so I can reinstall

    Before trying to remove try re-installing CS3 right on top of the current install.  Often re-installing Photoshop on top of itself fixes the install.  If it does be sure to apply the cs3 updates.
    Download Adobe CS4 and CS3 Free Trials Here (incl. After Effects) | ProDesignTools
    your product key can be retrieved from here https://www.adobe.com/account/my-products-services.html
    use these links for the updates.
    Adobe - Photoshop : For Macintosh
    Adobe - Photoshop : For Windows

  • Please i need help with switch from the us store to malaysian store how i can switch

    Please i need help with switch from the us store to malaysian store how i can switch

    Click here and follow the instructions to change the iTunes Store country.
    (82303)

  • Need help in migration from Layer2 to layer3

    HI Guys
    Need u r help in migration from layer2 switched network to layer3.
    here is the setup there are 9 sites connected with a 10gig backbone in a ring.each site has a 6513 but at the data centre site we having two 6513.we are having a combination of voice and data vlans.at present all the sites are connected with layer2 trunks.all the trunks are teminated at the core ie datacentre site.so how should i procedd and what are the advantages of it ie migration.
    Thanks
    Mahmood

    For this migration you first need to assign IP addresses to your connections between switches. This could be /30 (or /31, if supported) subnets. You should also consider running some dynamic routing protocol such as OSPF between switches.
    Hope this helps.

  • I DESPERATLY NEED HELP TRANSFERING SONGS FROM IPOD TO ITUNES LIBRARY

    hi my computer crashed downstairs and i need help moving all my songs from my ipod to my itunes library, on the other computer...will someone please help me?

    Hello Markatkis,
    Make sure your not connecting it to more than one PC. A new iPOd is set to "Auto Update" by default. With this setting all you do is plug the iPOd into the PC and iTUnes automaticly opens, loads all the songs it has listed in iTunes to the iPod, and after its done, ejects the iPOd.
    If you connect it to another PC tho with iTUnes on it you usually get a promtp that in short says "iPOd library linked to another PC, do you want to link to this one" if you click yes, it wipes the iPOd clean and loads only whats on that PC.
    Since your new to all of this a great place for you may be the "iPod 101" site. It will show you all the bacis ropes of using your iPOd, using iTUnes, and using them both together. http://www.apple.com/support/ipod101/

  • Desperately needs help burning DVD from iPhoto

    I am using iPhoto 6.0.6. I desperately need help burning a DVD of a slide show that I created for my daughter's wedding.
    I put several songs together by opening them and then combining them using QuickTime Pro. I imported the audio into iTunes and created a slide show using iPhoto. The slide show is perfect! The slides are finally in sink with the music just as I want them! But I don't know how to burn the slide show as a DVD.
    I tried exporting the video from iPhoto to my computer, but at the end of the export, I get this message: please note that the music included in the slideshow can only be played on authorized machines. And when I try to play the video (after the export), most of the music on the video cannot be heard. When I try to authorize my machine, I am told that it's already authorized.
    If someone would send detailed instructions on how to proceed, I would greatly appreciate it.
    Greg

    Is your problem the DRM audio tracks you purchased from iTunes store?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. Just put the application in the Dock and click on it whenever you want to backup the dB file. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    Note: There's now an Automator backup application for iPhoto 5 that will work with Tiger or Leopard.

  • I need help restoring data from my time machine.

    1)  On the time machine, where do I find the TRASH file that is located on the dock in my desktop?  I'd like to restore that to a prior date but can't find it.
    2)   I DID A VERY BAD THING & need help to get back to where I was before.   I wanted to delete files that were taking up lots of space.  My OTHER section  was using 160G.  I downloaded OmniDiskSweep and found that 120G was being used by my virtual machine (I run Quicken in Windows, through VMware).  I started to delete files that were called Snapshots assuming these were the snapshots that the program regularly takes of my files. Apparently they were not. I also deleted the program Windows XP Professional because that was never used.  When I try to open VM or quicken program, it says it is missing a particular snapshot, i.e. Snapshot 11104.  I deleted about 20 of these. I left all the other files that said Windows XP Home Edition.  But now it shows that I only have the Professional Edition, even though that's what I deleted.  I'm trying to restore from Time Machine and it looks like the information is not there - I've tried various different backups and nothing seems to have the information I need.  The earliest back up I have is from 5/7 when I started time machine on a new external 1TB HD.  Would that have the information I need since it's the very first back up?  Please Help.

    I am assuming it's real data because it's taking up storage on my HD.  It falls in the category "other" and the total of this section is 160G. Here is a snapshot of the virtual machine.
    I also took a shot of the VM snapshots & it tells how much space is being taken up by the snapshots.
    I've now changed the number of snapshots taken down to 12 (didn't know I had this option) & I can delete alot of the 21 snapshots that have already been saved.  I have no idea how much of the HD was set aside for the VM because someone else installed it for me 5 years ago.  I've had enough problems with it over the years that I've wanted to switch to Quicken for Mac or find another financial program to use. I've upgraded the VM 2x over the years, but didn't want to spend $100 for Version 5.   I understand the concept of a VM but that's about all.
    I did do the disk cleanup in Windows on the C drive.  I deleted 700 MB of temporary files and then compressed 4G of data down to 2G.  While the cleanup was progressing it said that the C drive was 30.99G and 78% of it was free.  That just doesn't make sense to me.  It recommended a defrag, so I did that also.
    I'm pretty sure it's real data because I recently had to switch from a 320G external HD for TM, to a 1T HD.  One TM backup was over 300G which I found to be excessive because I basically use my computer for mail, some word processing, and my financial data.
    Thanks again for all your help. I really appreciate it.

  • I need help please, upgrading from OS 10.6.8...

    Please help me - I'm such a technophobe!! I need help upgrading from OS 10.6.8... I get part way through the process and get a box saying "The link needs to be opened with an application" and I don't know what to do next...

    The only way to upgrade from 10.6.8 (which is high as Snow Leopard goes) is to obtain Lion or Mountain Lion from the Online Apple Store or Yosemite from the Mac App Store.
    The requirements for Lion are:
    Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7, or Xeon processor
    2GB of memory
    OS X v10.6.6 or later (v10.6.8 recommended)
    7GB of available space
    Lion is available in the Online Apple Store ($19.99). Mountain Lion (10.8.x) is also available there at the same price (though it's reported to have been removed from sale in some countries so may well cease to be available generally) but there seems little point as the system requirements are the same for Yosemite (10.10.x) - which is free - unless you need to run specific software which will run on Mountain Lion only. Mavericks (10.9.x) is no longer available.
    The requirements for Mountain Lion and Yosemite are:
    OS X v10.6.8 or later
    2GB of memory
    8GB of available space
      and the supported models are:
    iMac (Mid 2007 or newer)
    MacBook (Late 2008 Aluminum, or Early 2009 or newer)
    MacBook Pro (Mid/Late 2007 or newer)
    Xserve (Early 2009)
    MacBook Air (Late 2008 or newer)
    Mac mini (Early 2009 or newer)
    Mac Pro (Early 2008 or newer)
    Yosemite is available from the Mac App Store (in Applications). Mountain Lion can be obtained the Online Apple Store.
      You should be aware that PPC programs (such as AppleWorks) will not run on Lion or above; and some other applications may not be compatible - there is a useful compatibility checklist at http://roaringapps.com/apps:table

  • Need Help:Reading Data from RU payroll cluster for table GRREC

    Hi...
    I need help on how to read data from RU cluster table for table GRREC for the employee & run date and get the value from structure PC292 .
    Please let me know about the includes and the import and export statements to be used.
    Thanks in advance,
    RAVI.

    Hi,
    Here goes pseudocode
    Includes:
    include: rpppxd00    ,
                rpppxd10     ,
                rpc2cd09     , 
                rpc2rx02_ce , "if ldb pnp_ce is used else use the same include with out _ce
                rpc2rx29      ,  
                rpc2rx39      ,
                rpppxm00    ,
                rpc2ruu0_ce ,
    Declare:
    DATA : i_rgdir   LIKE pc261        OCCURS 0 WITH HEADER LINE     ,
               i_result  TYPE pay99_result OCCURS 0 WITH HEADER LINE ,
               i_grrec   LIKE  pc292           OCCURS 0 WITH HEADER LINE .
    start-of-selection:
    GET pernr.
    Get the RGDIR VALUE for the current PERNR & selected Molga
    get rgdir data TABLES i_rgdir
                          USING pernr-pernr
                                     p_molga " parameter
    CD-KEY-PERNR = PERNR-PERNR.
    RP-IMP-C2-CU.
    i_rgdir [] = rgdir[].
      LOOP AT i_rgdir WHERE fpbeg  LE  pn-endda
                        AND fpend  GE  pn-begda
                        AND srtza  EQ 'A'
                        AND void   NE   'V'.
      get_result_tabs   TABLES i_result
                                   USING 'RU'    "  US cluster
                                         pernr-pernr
                                         i_rgdir-seqnr
          RX-KEY-PERNR = PERNR-PERNR.
          UNPACK i_RGDIR-SEQNR TO RX-KEY-SEQNO.
          RP-IMP-C2-RU.
      i_grrec[] = i_result-inter-grrec[].
      LOOP AT i_grrec.
      case i_grrec.
      use wage types required here and pass the data to output table.
      endcase.
      endloop.
      endloop
    end-of-selction.

  • Need help on emailing  from java

    I need help on how to send an Email from a java application.
    Can any body help me by providing correct code for that?
    Thanks!

    It worked.Thanks!So, are you gonna award the Dukes to prometheuzz or are you donating them to the forum pickle jar?
    db

  • Need help updating records from a subset yielded by a subquery.

    Hi, retired, hobby coder needing (further) help in transact-sql scripting with a view to creating a stored procedure within a Sequel DB.  For the purposes of this investigation I have a table with 23 records.   I am trying to update a specific
    field for 10 of the records based on the (TOP 10) records selected from a sub query where I select the TOP 20 records based upon different field.
    I select my desired 10 records (TOP 10) from a sup query selecting the TOP 20 based upon the date field (latest 20) for a specific user (GID) as follows:
    I then attempt to update only these 10 records as follows:
    As you can see it updated all 23 rows in the table, not just the 10 I yielded by the underlying query.
    In reviewing the documentation it appeared that referencing the Scores_id column and using the 'IN' keyword would work, i.e., UPDATE Scores WHERE Score_id IN (SELECT TOP 10* ..... would be appropriate but I got the an error message, 'Only one expression
    can be specified in the select list when the subquery is not introduced with EXISTS.'
    Can someone assist me with the proper syntax for this script?  Additionally, since there are limitations on the number of variables which can be used any advice on how to structure a stored procedure where the GID is the initial variable and Score_id
    the second would be appreciated also.
    Regards,
    Minuend

    The query you have written will always update all or no rows in the table, since it says
    UPDATE Scores
    SET    ...
    WHERE  EXISTS (...)
    The EXISTS clause is, logically, evaluated for each row. Normally, when you use EXISTS you correlated the subquery with the surrounding query, so that the values the subquery works with are different for each row. But your subquery is uncorrelated, and will
    return the same value, TRUE or FALSE, for each row.
    IN can certainly work, but then you cannot have "SELECT TOP 10 *", but you need to have "SELECT TOP Score_id", since when you use IN, the subquery must be a single-column query.
    Another alternative, which is somewhat difficult to digest the first you see it, but which is more efficient, and more concise, once you have learn it, is to work directly from the query you have:
      WITH CTE AS (
         SELECT TOP 10 *
          FROM (SELECT TOP 20...
     UPDATE CTE
     SET    Used = '*'
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Need help getting contacts from outlook 2010

    I need help getting my contacts from outlook 2010 to icloud and/or my iphone. I have icloud up and logged in on pc. when I go to a contact to import it says there was a problem reading the vcard. any help is welcomed.

    I do have the latest version of DTM and working with OUTLOOK 2000.  I know it is old, but it still does what I need it to. I did try to uninstalland reinstall.  No luck.  The only options listed to sync are yahoo, outlook express, and ASCII inport/export.  Obviously it is not syncing my other data either, but it is my contacts that I am most concerned with at this point.  The calader would be nice too!  Any other suggestions, or is my outlook too old to sync?   

  • NEED HELP GETTING FILES FROM ITUNES ON ONE COMPUTER TO THE OTHER.

    So I was using a PC to backup my iphone 5 to itunes; however, i just bought a macbook pro and it wont let me transfer the files from one computer to the other and i need help!

    Click here and pick the option which best fits your situation.
    (93771)

Maybe you are looking for