Need some kind of Analytical Function

Hi Oracle experts
I need a little help from you experts. I have a PARTY table as listed below
The existing data
Party key     ID_INTERNAL     EID          BID
1          11111          123
1          11111          321
1          22222          321          899
1          66666          ------          888
New records comes
I have to assign a party key to each record based on which attribute is matching
Now the situation is as new records comes.
New records comes
ID_INTERNAL     EID          BID
22222          555
44444          555          
89898          ------          888
If I match on ID_INTERNAL I may not be able to match ID_INTERNAL 44444 and 89898 and if I match EID or BID the same situation.
Is thera any analytical function which helps me assigning a party key to all the recoords. ALl the above records should be assigned PARTY KEY 1 only.
Please help
Thanks
Rajesh

Justin
My main goal is to assign a party key from existing set of records to the new records which are being selected/inserted. I have to write my algoritum in such a way that the new values should match their value in existing records.
Example
my first new record has a value of 11111 under ID_INTERNAL and in the same record it has a value of 555 under EID attribute. so based on matching algoritum for ID INTERNAL it will be assigned existing party key 1.
Similarly second new record has a value of 87777 under ID INTERNAL and has a value of 555 under EID and this ID INTERNAL does not exists in the target table. but the value of 555 is available under EID attribute so I have to write algoritum based on EID.
Now the delima is my target table is as follows
Party key PARTYID PARTYNAME
1 11111 ITSID
1 123 EID
1 321 EID
Now when new records come I have to write match algortium for ID_INTERNAL to PARTYID for Partyname='ITSID'
Once matched this record ID INTERNAL=11111 and EID =555 assigned a party key=1. So after first record the output table slooks like
Party key PARTYID PARTYNAME
1 11111 ITSID
1 123 EID
1 321 EID
1 555 EID
Same way for second new record where the values are ID_INTERNAL=87777 and EID=555. I have to write match algortium based on EID because the EID value of 555 already exists in target tabel with party key.
SO after second record the target table will look like
Party key PARTYID PARTYNAME
1 11111 ITSID
1 123 EID
1 321 EID
1 555 EID
1 87777 ITSID
So this is how I have to solve this match algoritum.
Please help me if you need any information I will be glad to provide you all.
Thanks
Regards
Rajesh

Similar Messages

  • Need some help with a function

    create or replace function do_it(p_val varchar2) return varchar2 is
    x varchar2(100);
    begin
    select 1 into x from dual
    where 'hi' in(p_val);
    return x;
    exception
    when no_data_found then
    return p_val;
    end;
    Above function works fine, except when I pass a string like:
    select do_it('''hi'',''hello''') from dual;
    At runtime, I am expecting the SQL inside the function to appear like:
    select 1 into x from dual
    where 'hi' in('hi','hello');
    I would appreciate any help. the function can take only one parameter.

    The function needs only 1 argument to execute and you are passing 2.
    If I am not wrong, the error should be of kind
    "Invalid number of arguments to function do_it...."

  • Powerbook G3 Needs Some Kind of USB-type backup

    (Please understand I have NO idea about computers, except that I like them and use them.) I have a wonderful old Wallstreet II, it has OS 9.2, it works well, and it is essentially Naked. No backup drive, no CD burner, nothing. I do not want to connect it to the internet. I do want to preserve my files.
    I need to know what to use in order to "convert" the PCMCIA into a USB port. I'd like to back my files up to a USB stick if that's even possible. I'm looking for a very simple and hopefully inexpensive solution.
    I do have a notebook card, but it turns out it is not compatible with this operating system. Also I can't seem to find out if USB sticks will just work with an old Mac. There's all kinds of info on using notebook cards to enhance speed, to plug in to printers (I'd be interested in that too), to connect things to video cameras, etc. I just need basic, hard drive backup to protect my work. That's it. Can anyone help? Thanks in advance.

    You can use a PCMCIA USB card to get USB capability. You may need to reinstall OS 9.2 with the card installed to make sure the USB system files get installed. I did this on my Wallstreet. See http://discussions.apple.com/thread.jspa?threadID=2370293&tstart=25
     Cheers, Tom

  • I need some help starting a function.

    Hello.
    Im new to flash im tring to make my first website after some tutorials but im stuck
    I have this codes on 2 MC's pages
    on first:
    import flash.events.Event;
    import fl.transitions.*;
    import fl.transitions.easing.*;
    import fl.motion.MotionEvent;
    import fl.events.*;
    var myString1:String = "My text 1";
    var myArray1:Array = myString1.split("");
    var myString2:String = "My text 2";
    var myArray2:Array = myString2.split("");
    addEventListener(Event.ENTER_FRAME, maint1);
    function maint1(event:Event):void{
        if (myArray1.length > 0) {
            var moveTween:Tween = new Tween(startarrow_mc,"x",Elastic.easeOut,startarrow_mc.x,27,2,true);
            main_t1.appendText(myArray1.shift());
        }else {
            removeEventListener(Event.ENTER_FRAME, maint1);
            addEventListener(Event.ENTER_FRAME, maint2);
    function maint2(event:Event):void{
        if (myArray2.length > 0) {
            main_t2.appendText(myArray1.shift());
        }else {
            removeEventListener(Event.ENTER_FRAME, maint2);
    and on second is same code as on first
    Ok... the coder are working when i load the flash the text from the codes starts writing on text boxes but starts on both MCs what i want to do is to start the text only when i call that page page 1 and after that page 2.
    i've tryed to add in page2_mc on first keyframe of AS3 stop(); and make anotherone labeled "start" and put there the code and on the button that calls page2_mc to add pageContainer_mc.page2_mc.gotoAndPlay("start"); but i get this error when i click the button
    TypeError: Error #1010: A term is undefined and has no properties.
    at Function/<anonymous>()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at fl.transitions::Tween/set time()
    at fl.transitions::Tween/nextFrame()
    at fl.transitions::Tween/onEnterFrame()
    and the functions are not starting
    Is there any other method to call maint1 from buttons that load the pages?
    thank you

    This is the code that i have in menu:
    var p1:page1_mc = new page1_mc;
    var p2:page2_mc = new page2_mc;
    menu_mc.btnPg1.addEventListener(MouseEvent.CLICK, btn1Click);
    menu_mc.btnPg2.addEventListener(MouseEvent.CLICK, btn2Click);
    function btn1Click(event:MouseEvent):void{
        var btn1Outro:Tween = new Tween(pageContainer_mc,"alpha",Strong.easeOut,1,0,1,true);
        btn1Outro.addEventListener(TweenEvent.MOTION_FINISH, runBtn1Transition);
        function runBtn1Transition(Event:TweenEvent):void{
            pageContainer_mc.removeChildAt(1);
            pageContainer_mc.addChild(p1);
            pageContainer_mc.page1_mc.gotoAndPlay("start");
            var btn1Intro:Tween = new Tween(pageContainer_mc,"alpha",Strong.easeOut,0,1,1,true);
    function btn2Click(event:MouseEvent):void{
        var btn2Outro:Tween = new Tween(pageContainer_mc,"x",Strong.easeIn,pageContainer_mc.x,-1200,1,true);
        btn2Outro.addEventListener(TweenEvent.MOTION_FINISH, runBtn2Transition);
        function runBtn2Transition(Event:TweenEvent):void{
            pageContainer_mc.removeChildAt(1);
            pageContainer_mc.addChild(p2);
            pageContainer_mc.page2_mc.gotoAndPlay("start");
            var btn2Intro:Tween = new Tween(pageContainer_mc,"x",Strong.easeOut,pageContainer_mc.x,217,1,true);

  • Need help with an analytic function I think

    I have a table as such:
    BID, POSITIONDATE
    1 3/10/2009
    1 3/11/2009
    1 3/12/2009
    1 3/13/2009
    1 3/13/2009
    1 3/13/2009
    1 3/14/2009
    I need to select a count(*) from this table for EACH day in MARCH, but the table is missing the days of 3/1 - 3/9
    I need my result set to be:
    BID, POSITIONDATE, COUNT(*)
    1 3/1/2009 0
    1 3/2/2009 0
    1 3/3/2009 0
    1 3/10/2009 1
    1 3/11/2009 1
    1 3/12/2009 1
    1 3/13/2009 3
    1 3/14/2009 1
    I thought LAG would do it but I cannot figure out how to get it to "make up the dates of 3/1-3/9 since those dates aren't actually in the table)
    I also tried creating a "FAKE" table (T1) with the dates of 3/1 -> 3/31 and outer joining to it, but that didn't seem to work either.
    Any tips/suggestions??
    Chris

    with t1
    as
    select to_date('03/01/2009','MM/DD/YYYY')-1 + level as Date1
    from dual
    where (to_date('03/01/2009','MM/DD/YYYY')-1+level) <= last_day(to_date('03/01/2009','MM/DD/YYYY'))
    connect by level<=31
    select * from t1
    DATE1
    3/1/2009     
    3/2/2009     
    3/3/2009     
    3/4/2009     
    3/5/2009     
    3/6/2009     
    3/7/2009     
    3/8/2009     
    3/9/2009     
    3/10/2009     
    3/11/2009     
    3/12/2009     
    3/13/2009     
    3/14/2009     
    3/15/2009     
    3/16/2009     
    3/17/2009     
    3/18/2009     
    3/19/2009     
    3/20/2009     
    3/21/2009     
    3/22/2009     
    3/23/2009     
    3/24/2009     
    3/25/2009     
    3/26/2009     
    3/27/2009     
    3/28/2009     
    3/29/2009     
    3/30/2009     
    3/31/2009     
    31 Rows Selected
    with t1
    as
    select to_date('02/01/2009','MM/DD/YYYY')-1 + level as Date1
    from dual
    where (to_date('02/01/2009','MM/DD/YYYY')-1+level) <= last_day(to_date('02/01/2009','MM/DD/YYYY'))
    connect by level<=31
    select * from t1
    DATE1
    2/1/2009     
    2/2/2009     
    2/3/2009     
    2/4/2009     
    2/5/2009     
    2/6/2009     
    2/7/2009     
    2/8/2009     
    2/9/2009     
    2/10/2009     
    2/11/2009     
    2/12/2009     
    2/13/2009     
    2/14/2009     
    2/15/2009     
    2/16/2009     
    2/17/2009     
    2/18/2009     
    2/19/2009     
    2/20/2009     
    2/21/2009     
    2/22/2009     
    2/23/2009     
    2/24/2009     
    2/25/2009     
    2/26/2009     
    2/27/2009     
    2/28/2009     
    28 Rows Selected
    I probably should change the variable to MM/YYYY and leave out day I guess, because if they put a day larger than 1, then I would end up with less than a full month.

  • HT3180 I turned on my apple tv and there before me on the screen was a picture of the apple tv with the micro usb and power lead in with the usb side pointing to the blue itunes logo! I think its telling me that it needs some kind of update ! help

    I have tried reseting it through itunes ! But it does not recognise the apple tv and the itunes hasnt got any apple tv tabs? help

    It is telling you to restore by connecting to iTunes. Did you follow the steps exactly?
    Unplug all cables, then connect micro usb. Make sure to connect directly to the computer and not a leyboard port or USB hub.
    http://support.apple.com/kb/HT4367?viewlocale=en_US&locale=en_US

  • Problem in discoverer  with analytic function created non-additive YTD

    I have problem with discoverer desktop which show me wrong ytdact, ytdbgt figure after i rollup/pivoting
    on custom folder i did in discoverer admin:
    SELECT a.year, a.month, c.deptno, b.glaccount, bgt.mthbgt, bgt.ytdbgt, bgt.fullbgt, bgt.lastyr_fullbgt,
    act.mthact, act.ytdact
    FROM (
    SELECT
    a.amount mthbgt,
    SUM(a.amount) OVER (PARTITION BY ...) fullbgt,
    SUM(a.amount) OVER (PARTITION BY ...) ytdbgt,
    LAG(SUM(a.amount),1) OVER (PARTITION BY...) lstyr_fullbgt
    FROM gltrans_bgt a, gl_master b, dept c
    WHERE a.glaccount=b.glaccount AND a.deptno=c.deptno GROUP BY a.year, a.month, c.deptno, b.glaccount
    ) bgt
    FULL OUTER JOIN
    SELECT a.year, a.month, c.deptno, b.glaccount,
    a.amount mthact,
    SUM(a.amount) OVER (PARTITION BY...) ytdact,
    LAG(SUM(a.amount),1) OVER (PARTITION BY...) lstyr_ytdact
    FROM gltrans_act a, gl_master b, dept c
    WHERE a.glaccount=b.glaccount AND a.deptno=c.deptno
    GROUP BY a.year, a.month, c.deptno, b.glaccount
    ) act
    ON
    bgt.year=act.year AND
    bgt.month=bgt.month AND
    bgt.deptno=act.deptno AND
    bgt.glaccount=act.glaccount
    In discoverer desktop, sometime i would like to remove deptno or month to see the rollup figure. But it seems discoverer tried to sum the ytd to give me wrong figure.
    I know that to ask oracle rewrite the query in order to roll up the figure, one may need to create dimension and specify the hierarchy for the related .
    Anyway to do on this MV so that oracle can rewrite the query for me automatically?

    I suspect if your FY runs not from Jan - Dec, then someone has had to come to grips with this before and has created some kind of custom FUNCTION to determine the fiscal year from the date entered. Or maybe a table that populated with the same info.
    Nevertheless, if there isn't one, then you'd just change the TRUNC(SYSDATE,'YYYY') logic to your fiscal year with a direct calculation.
    ie:
    calculation: what_fiscal_year
    CASE WHEN to_char(sysdate,'MMM') IN ('JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP') THEN to_char(sysdate,'YY')
    WHEN to_char(sysdate,'MMM') IN ('OCT','NOV','DEC') then to_char(sysdate,'YY')-1
    ELSE '99' END
    Something like that - I haven't tested it so treat as pseudo-code first (ie: the last to_char may need to have a to_char(to_number(to_char instead to substract the 1 but might work - Oracle's good with powerful date functions). It should give you an idea of what I'm referring to.
    So once each record has an associated FY either by a calculation such as shown or by a calculation calling your corporate FY function, you just do the same thing as described early (ie: range between FY and FY-1).
    Russ

  • Analytic Function - Return 2 values

    I am sure I need to use an analytic function to do this, I just cannot seem to get it right. I appreciate the help.
    Table and insert statements:
    create table TST_CK
    DOC_ID NUMBER(6)      not null,
    ROW_SEQ_NBR NUMBER(6) not null,
    IND_VALUE VARCHAR2(2) null
    INSERT INTO TST_CK VALUES ('1','6',NULL);
    INSERT INTO TST_CK VALUES ('1','5',NULL);
    INSERT INTO TST_CK VALUES ('1','4','T');
    INSERT INTO TST_CK VALUES ('1','3','R');
    INSERT INTO TST_CK VALUES ('1','9',NULL);
    INSERT INTO TST_CK VALUES ('1','10',NULL);
    INSERT INTO TST_CK VALUES ('1','7','T');
    INSERT INTO TST_CK VALUES ('1','8','R');
    INSERT INTO TST_CK VALUES ('2','1',NULL);
    INSERT INTO TST_CK VALUES ('2','2',NULL);
    INSERT INTO TST_CK VALUES ('2','3','T');
    INSERT INTO TST_CK VALUES ('2','4','R');
    INSERT INTO TST_CK VALUES ('2','5',NULL);
    INSERT INTO TST_CK VALUES ('2','6',NULL);
    INSERT INTO TST_CK VALUES ('2','7','T');
    INSERT INTO TST_CK VALUES ('2','8','R');
    INSERT INTO TST_CK VALUES ('4','1',NULL);
    INSERT INTO TST_CK VALUES ('4','2',NULL);
    INSERT INTO TST_CK VALUES ('4','3','X1');
    INSERT INTO TST_CK VALUES ('4','4',NULL);
    INSERT INTO TST_CK VALUES ('4','5',NULL);
    INSERT INTO TST_CK VALUES ('4','6',NULL);
    INSERT INTO TST_CK VALUES ('4','7','T');
    INSERT INTO TST_CK VALUES ('4','8','R');
    INSERT INTO TST_CK VALUES ('4','9',NULL);
    INSERT INTO TST_CK VALUES ('4','10',NULL);
    INSERT INTO TST_CK VALUES ('4','11',NULL);
    INSERT INTO TST_CK VALUES ('4','12',NULL);
    INSERT INTO TST_CK VALUES ('4','13','T');
    INSERT INTO TST_CK VALUES ('4','14','R');
    INSERT INTO TST_CK VALUES ('4','15',NULL);
    INSERT INTO TST_CK VALUES ('4','16',NULL);
    COMMIT;Here is what I have tried that gets me close:
    SELECT MAX (TST_CK.DOC_ID), MAX (TST_CK.ROW_SEQ_NBR), TST_CK.IND_VALUE
      FROM ASAP.TST_CK TST_CK
    WHERE (TST_CK.IND_VALUE IS NOT NULL)
    GROUP BY TST_CK.IND_VALUE
    ORDER BY 2 ASCHere is my desired result:
    CV_1      CV_2
    T           ROr even better result would be:
    concat(CV_1,CV_2)With result:
    T,RThanks for looking
    G

    Hi,
    I am sure I need to use an analytic function to do this, I just cannot seem to get it right. I appreciate the help.
    Table and insert statements: ...Thanks for posting the CREATE TABLE and INSERT statements.
    Don't forget to explain how you get the results you want from that sample data.
    GMoney wrote:
    create table TST_CK
    DOC_ID NUMBER(6)      not null,
    ROW_SEQ_NBR NUMBER(6) not null,
    IND_VALUE VARCHAR2(2) null
    INSERT INTO TST_CK VALUES ('1','6',NULL);
    If doc_id and row_seq_nbr are NUMBERs, why are you inserting VARCHAR2 values, such as '1' and '6' (in single-quotes)?
    Here is my desired result:
    CV_1      CV_2
    T           ROr even better result would be:
    concat(CV_1,CV_2)With result:
    T,R
    The results from the query you posted are:
    MAX(TST_CK.DOC_ID) MAX(TST_CK.ROW_SEQ_NBR) IN
                     4                       3 X1
                     4                      13 T
                     4                      14 RWhat do the desired results represent?
    Why do your desired results include 'R' and 'T', but not 'X1'? Why do you want
    'T,R'     and not
    'X1,T,R'     or
    'X1,T'     or
    'T,X1'     or something else?
    Whatever your reasons are, there's a good chance you'll want to use String Aggregation . Your Oracle version is always important, but it's especially important in string aggregation problems, because some helpful new functions have beeen added in recent versions. Always say which version of Oracle (e.g., 11.2.0.3.0) you're using.

  • Looking for some kind of Docking Bar...

    I am not exactly sure what to call the item I am looking for, I can only describe it. I need some kind of small bar to just keep all my coords and wires plugged in at home at my desk so that when i come home I can just slap the bar on the side of my macbook pro and be done with it.
    I know many are going to say to just stop being lazy and plug them in but my roommate has a computer on the same desk and its a pain in the butt fishing for all my wires every time I come home. I also don't have the room nor the money to afford a full docking station.
    Thanks for your advice

    kudagra wrote:
    I am not exactly sure what to call the item I am looking for, I can only describe it. I need some kind of small bar to just keep all my coords and wires plugged in at home at my desk so that when i come home I can just slap the bar on the side of my macbook pro and be done with it.
    I know many are going to say to just stop being lazy and plug them in but my roommate has a computer on the same desk and its a pain in the butt fishing for all my wires every time I come home. I also don't have the room nor the money to afford a full docking station.
    Thanks for your advice
    Will this work for you?
    http://www.cultofmac.com/gorgeous-docking-stations-allow-you-to-easily-use-your- macbook-as-your-main-work-machine/39125

  • HTMLDB 1.6 and "order by" in analytic functions

    In HTMLDB 1.6, oracle 10g, when i enter the string "order by" in the region source of a report of the type "sql query (pl/sql function body returning sql query", I get
    1 error has occurred
    * Your query can't include an "ORDER BY" clause when having column heading sorting enabled.
    I understand the reason for this error, but unfortunately i need this for an analytic function:
    row_number() over (partition by ... order by ...)
    It seems that the check is performed by simply looking for the string "order by" in the "region source" (in fact the error fires even if that string is contained within a comment).
    I know possible workarounds (eg creating a view and select'ing from it), i just wanted to let you know.
    Regards
    Alberto

    Another one under the 'obvious route' category:
    Seems that the ORDER BY check is apparentl for ORDER&lt;space&gt;BY... so simply adding extra whitespace between ORDER and BY bypasses the check (at least in 2.1.0.00.39).
    To make it a bit more obious that a separation is intended, an empty comment, i.e. ORDER/*/BY*, works nicely
    Edited by: mcstock on Nov 19, 2008 10:29 AM

  • [Off topic] Need some hints where to start

    Hi,
    I've been out of C++ for around 9 years. (Doing java since then)
    For an upcoming project I have to get back into it.
    I've already done quite much execise with STL, boost and ICU.
    Now I'm looking for a solution for the following problem:
    I need some kind of RessourceManager, which is able to suspend
    some threads and dump their memory to disk. It must maintain
    dependencies between ressources and should be as transparanet
    as possible to the rest of the source code. It should have some config
    options like amount of memory to use, etc.
    I think a starting point would be an Allocator which is connected to
    a ResourceManager.
    Is there any standard way, which I haven't found, to do this?
    Greetings,
    Markus
    P.S.: Can someone point me which is the right mailing
    list for this kind of questions?

    A good resource for general C++ programming questions like yours is newsgroup
    comp.lang.c++.moderated

  • Some Kind of huge Noise coming from the Disc Drive while inserting and ejecting the disc.

    Some Kind of huge Noise coming from the Disc Drive while inserting and ejecting the disc.
    i have just purchased it before a couple of days a go.

    I just installed a Mac Pro for a client. After a while I noticed this buzzing everyones talking about. It was especially bad after I installed two more internal drives. It seemed to come and go with HD activity. I pulled up the lever on the back of the machine when it was particularly loud and the buzzing went away. So like some others have noticed it's associated with the HD bays. I took the side off and adjusted the seating of the drives so they were exactly centered Now the buzzing is gone. I'll keep an eye on it. Maybe it will need some kind of silicone bumpers where the bay trays are metal to metal.
    More research to come.
    Richard

  • Dv7 beats audio makes a buzzing noise or some kind of speaker feed back

    when i play music speakers sometimes make a buzzing noise seems to happen more on the bass side

    I just installed a Mac Pro for a client. After a while I noticed this buzzing everyones talking about. It was especially bad after I installed two more internal drives. It seemed to come and go with HD activity. I pulled up the lever on the back of the machine when it was particularly loud and the buzzing went away. So like some others have noticed it's associated with the HD bays. I took the side off and adjusted the seating of the drives so they were exactly centered Now the buzzing is gone. I'll keep an eye on it. Maybe it will need some kind of silicone bumpers where the bay trays are metal to metal.
    More research to come.
    Richard

  • I needed the kind of sofware like digital art large collection of everything

    Everytime I ring up the stores they say we dont have that kind of software and they say google images or yahoo images, but I got a professional
    digital printing business I need some kind of software if any to where I get my images from.

    At http://www.istockphoto.com you can get photos up to XXXLarge
    To put this into perspective here is the sizings for each size they offer on the website:
    Size
    Pixels
    Uses
    XSmall
    425x281
    Small web photo
    Small
    850x562
    Large web photo
    Medium
    1710x1140
    Business Card/ Small print piece
    Large
    2730x1800
    Brochure/ Medium print piece
    XLarge
    4200x2790
    Brochure/ Full page brochure
    XXLarge
    4900x3270
    Poster/ Large print piece
    XXXLarge
    5600x3750
    Tradeshow booth/ Large print piece
    Now obviously these photos cost more as you increase in size but the site has a scheme that will save you money the more times you buy.

  • A little help writing an SQL please? May need some advanced functionality..

    Hi All
    I have arequirement to write an SQL that, given a total, and some rows from a table, can return the rows where one of the columns adds up to the total
    These are transactions, so I'll boil it down to:
    TranID, TranAmount
    1, 100
    2, 200
    3, 250
    4, 50
    Suppose I will know that I need to seek 2 transactions totalling 300.
    Possible combinations are ID 1+2, or 3+4. In this case, it is an error that I cannot find a single set of transactions that satisfies the number-of and the sum-of requirements
    Suppose I will know that I need to seek 3 transactions totalling 550.
    Only combination is ID 1+2+3
    The difficulty for me here comes in that the number of transactions hunted will change, possibly without limits but as there will be a factorial element in terms of number of combinations, imposing an upper limit would be sensible.
    I considered one solution within my understanding of SQL, that I can take my rows, and (supposing I enforce a limit of 3.. i.e. I cannot look for any more than a combination of 3 transactions) cross join them to themselves on condition that no tran ID is equal to any other tran ID, I will then get a huge block of cartesian joined transactions. I can then use a where clause to pick out row combinations having the correct sum. If I can use some kind of ID > otherID in my join, then I can make the cartesian a triangle shape which hopefully would prevent essentially duplicated rows of 1,2,3 and 1,3,2 and 3,2,1 and 3,1,2 etc
    If I was only looking for 2 or 1 possible combinations, I would replace the tran amounts with 0 using a case when (because the number of times I'll cross join is fixed; I dont want to get into executing a dynamic sql)
    Lastly I should point out that I'm doing this in PL/SQL or possibly Java so I have the ability to introduce custom logic if needs be
    I would love to hear any other input from the wise and wizened members here as to how they might approach this problem.. Maybe oracle has some cool analytical functionality that I do not know of that will help here?
    Thanks in advance guys n girls!

    >
    Now, as I'll be looking to update another columns on these transactions so that it can be picked up by an external process, can I modify this query so that it produces a list of TranIDs so I can say:
    UPDATE tran SET falg='Y' WHERE tranID IN (<the query>)
    >
    Well if there's a workaround for the NOCYCLE, then the following will give all the transactions as rows for a particular total...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as TranID, 100 as TranAmount from dual union all
      2             select 2, 200 from dual union all
      3             select 3, 250 from dual union all
      4             select 4, 50 from dual)
      5  -- end of test data
      6  select distinct substr( trans
      7                , decode( level, 1, 1, instr(trans,'+',1,level-1)+1)
      8                , decode( instr(trans,'+',1,level), 0, length(trans), instr(trans,'+',1,level) - decode( level, 1, 0, instr(trans,'+',1,level-1))-1)
      9                ) the_value
    10                from (select trans
    11                      from (
    12                            select ltrim(rtrim(comb.trans,'+'),'+') as trans, sum(case when instr(comb.trans,'+'||t.tranid||'+')>0 then tranamount else null end) as sum_tran
    13                            from (select sys_connect_by_path(tranid, '+')||'+' as trans
    14                                  from t
    15                                  connect by nocycle tranid > prior tranid) comb
    16                                 ,t
    17                            group by comb.trans
    18                           )
    19                      where sum_tran = 550)
    20  connect by level < length(replace(translate(trans,'01234567890','00000000000'),'0')) + 2
    21* order by 1
    SQL> /
    THE_VALUE
    1
    2
    3
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as TranID, 100 as TranAmount from dual union all
      2             select 2, 200 from dual union all
      3             select 3, 250 from dual union all
      4             select 4, 50 from dual)
      5  -- end of test data
      6  select distinct substr( trans
      7                , decode( level, 1, 1, instr(trans,'+',1,level-1)+1)
      8                , decode( instr(trans,'+',1,level), 0, length(trans), instr(trans,'+',1,level) - decode( level, 1, 0, instr(trans,'+',1,level-1))-1)
      9                ) the_value
    10                from (select trans
    11                      from (
    12                            select ltrim(rtrim(comb.trans,'+'),'+') as trans, sum(case when instr(comb.trans,'+'||t.tranid||'+')>0 then tranamount else null end) as sum_tran
    13                            from (select sys_connect_by_path(tranid, '+')||'+' as trans
    14                                  from t
    15                                  connect by nocycle tranid > prior tranid) comb
    16                                 ,t
    17                            group by comb.trans
    18                           )
    19                      where sum_tran = 300)
    20  connect by level < length(replace(translate(trans,'01234567890','00000000000'),'0')) + 2
    21* order by 1
    SQL> /
    THE_VALUE
    1
    2
    3
    4
    SQL>

Maybe you are looking for

  • Drill Back from HFM works for one year, not another

    Hello, We are on FDM and HFM 11.1.2.1 and I was doing some reasearch in the system today and for some reason in all periods that were loaded during 2011 in this version (Aug-Dec) I am able to drill back to the FDM source data. However, if I go into 2

  • Sent mail lost. Not in sent, not in draft, not in outbox!

    Hi, I use IMAP with a gmail account. I find myself a few times sending e-mails and a few minutes later I check that the mail has not been sent, and it's not in draft either. There is no outbox either, not even showing an outbox. When I check activity

  • N100 BIOS downgrade (USB voltage problems and charger battery)

    Hello. (Sorry for my English). I have problem with my laptop lenovo n100 3000. I must downgrade my bios to 1.08 version, because I've problem with USB - when i click some button on my keyboard e.g. my pendrive was disconnect. Can someone say to me wh

  • XML Publisher 6.5.2 MS word Template Builder fails

    Dear all, My env is: Oracle DB 10.1.0.5 on redhat Linux, XML publisher 6.5.2 on Windows 2000. While using the XML publisher GUI from the browser, I am able to connect successfully to the database. However, when I try to build a RTF template from MS w

  • Exporting for Web VS exporting for DVD

    So here's the story: I am pretty familiar with exporting my movies for the web and stuff like compression, etc but I was just asked to burn some of my movies for DVD distribution. As stupid as I am, I sent those guys the files that I use for web dist