How to join two arrays together?

I have the following type
    type TVarcharArr is table of varchar(4000) index by binary_integer;I have a procedure that passes in two separate arrays as:
    p_account_number                 in TVarcharArr,
    p_product_system_code          in TVarcharArrThese arrays are related (they will have the same number of elements), the contents would be as follows:
    Account Number    Product System Code
    123                      ABC
    456                      DEF
    789                      GHII can use TABLE(CAST to turn each of these arrays into a table, but how do I join these two arrays together so that they become a single table with two columns? Or if I CAST them as TABLEs, how can I join these two tables together - is there some way of using the index to facilitate the join?
Cheers
Richard

You are right, I do need to convert the arrays first to use TABLE(CAST, and I do have my concerns about the use of rownum.
Here's the test case I built to test what I'm doing, incorporating the rownum solution:
declare
    type TVarcharArr is table of varchar(4000) index by binary_integer;
    v_arr   TVarcharArr;
    v_tab  tchartab := tchartab();
    v_arr2   TVarcharArr;
    v_tab2  tchartab := tchartab();   
begin
    v_arr(1) := 'ABC';
    v_arr(2) := 'DEF';
    v_arr(3) := 'GHI';
    v_arr2(1) := '123';
    v_arr2(2) := '456';
    v_arr2(3) := '789';   
    v_tab.extend(v_arr.Count);   
    for i in v_arr.first .. v_arr.last
    loop
        v_tab(i) := v_arr(i);
    end loop;   
    v_tab2.extend(v_arr2.Count);   
    for i in v_arr2.first .. v_arr2.last
    loop
        v_tab2(i) := v_arr2(i);
    end loop;   
    for rec in (with w_acct as
                (select rownum rn, a.column_value acol
                from table(cast(v_tab as tchartab)) a
                     w_prod as
                (select rownum rn, b.column_value bcol
                from table(cast(v_tab2 as tchartab)) b
                select acol,bcol
                from w_acct a,
                     w_prod b
                where a.rn = b.rn) loop
        DBMS_OUTPUT.PUT_LINE ( 'rec = ' || rec.acol || '|'|| rec.bcol );
        null;
    end loop;
end;It does return the correct result - but can it be trusted to be consistent - does the rownum in an array suffer the same problems as the rownum from a regular select? I'm guessing it's too risky to find out.
In essence, I'm getting two arrays and I'm trying to join them together so that I can CAST them as a table. (And I know the real question is why isn't it just one array of records with two elements - but sometimes you have to work with what you're given)

Similar Messages

  • How to join two similar layers together?

    Hey all! Please help me out, It is a little thing to do, but I am really stocked at this. How to join two layers together?? For example two Text layers or anything. Pleas can you describe the way to do it and write (if it exist) the shortcut for it?
    Now I know, that layers in AAF can't be joined, there is just a "Pre-Compose". But this function is disabled the FX colone, and I have to have it there.
    In this tut http://www.videocopilot.net/tutorials/shatterize/ he joined two text layers. But with some shortcut so I don't know, how he did it.
    Can anyone help me plz?
    THX for reply

    Lufty09 wrote:
    Yes, but this is disabled the Fx button :/
    Now you need to look up precomposing in the help system. It's all explained there.
    Nesting and precomping are advanced functions and require careful planning or inspired improvisation within the limits of the software. You also need to look up how the rasterization button works in its two operation modes.
    bogiesan

  • How to join two distribution rule together in one distribution rule

    how to join two distribution rule together in one distribution rule,and every dist. rule has many cost center.

    Hi,
    Welcome you post on the forum.
    You can create a new rule to include these two rules.
    Thanks,
    Gordon

  • Adding two arrays together

    I am trying to add two arrays together, it does not seem as if the arrays are broken up into more than one index. I have attached my code. If the array is broken up into indexes I would like to add each corresponding index, but I think the array is all in just one index and if so I was wondering how would I break it into indexes. Thanks
    Attachments:
    SimpleTest x1.vi ‏336 KB

    Since you are "transposing" and later work with 1D array, I assume you want to read the first column of the file.
    Why do you need a sequence stacked 5 frames deep, local variables, 5 instances of the same boolean diagram constant and 5 path conststants of which some are identical??? None of this is needed!
    All you need is probably something along the lines of the following picture, which probably does something similar to what you want. Still, we are probably still jumping through too many flaming hoops. Note that the execution order is uniquely defined by the wiring alone, no sequence needed! Can you take a step back and tell us what you are actually trying to achieve with all this? How many columns are in the file? Only one?
    Message Edited by altenbach on 01-27-2009 04:02 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    AddArraysFromFile.png ‏13 KB

  • How to join two MP4 movies with iMovie '11?

    Just after a quick bit of help here.  I'm not a movie making enthusiast so never used iMovie before and never will again most likely.  However I do have 2 mp4 movies about 4 minutes each that I SIMPLY want to join together.
    I've searched and seen reference to dragging the fils into a project then just export as one but for the life of me if import the files I can't seem to find anywhere that provides a view of the two files as thumbnails so I can just drag them to say this one first, this one second.  Join please.  I seem to get streams and streams of individual frames with sliding lines and what not and the best I seem to be able to get is about 4 seconds at a time.  Surely ther MUST be an easy way to just join two movies together without going into advanced frame by frame editing.
    It's not the most intuitive piece of software and I don't have any desire to learn it.  Problem is I am in a **** of rush with this and at the end of a 14 hour image managament day which is making me less than patient with iMovie. 

    QuickTime X can join your two files. Edit menu "Add Clip to End..."

  • How to join two internal table rows in alternative manner into one internal table?

    How to join two internal table rows in alternative manner into one internal table?
    two internal tables are suppose itab1 &  itab2 & its data
    Header 1
    Header 2
    Header 3
    a
    b
    c
    d
    e
    f
    g
    h
    i
    Header 1
    Header 2
    Header 3
    1
    2
    3
    4
    5
    6
    7
    8
    9
    INTO itab3 data
    Header 1
    Header 2
    Header 3
    a
    b
    c
    1
    2
    3
    d
    e
    f
    4
    5
    6
    g
    h
    i
    7
    8
    9

    Hi Soubhik,
    I have added two additional columns for each internal table.
    Table_Count - It represents the Internal Table Number(ITAB1 -> 1, ITAB2 -> 2)
    Row_Count  - It represents the Row Count Number, increase the row count value 1 by one..
    ITAB1:
    Header 1
    Header 2
    Header 3
    Table_Count
    Row_Count
    a
    b
    c
    1
    1
    d
    e
    f
    1
    2
    g
    h
    i
    1
    3
    ITAB2:
    Header 1
    Header 2
    Header 3
    Table_Count
    Row_Count
    1
    2
    3
    2
    1
    4
    5
    6
    2
    2
    7
    8
    9
    2
    3
    Create the Final Internal table as same as the ITAB1/ITAB2 structure.
    "Data Declarations
    DATA: IT_FINAL LIKE TABLE OF ITAB1.          "Final Internal Table
    FIELD-SYMBOLS: <FS_TAB1> TYPE TY_TAB1,     "TAB1
                                   <FS_TAB2> TYPE TY_TAB2.     "TAB2
    "Assign the values for the additional two column for ITAB1
    LOOP AT ITAB1 ASSIGNING <FS_TAB1>.
         <FS_TAB1>-TABLE_COUNT = 1.             "Table value same for all row
         <FS_TAB1>-ROW_COUNT = SY-TABIX. "Index value
    ENDLOOP.
    "Assign the values for the additional two column for ITAB2
    LOOP AT ITAB2 ASSIGNING <FS_TAB2>.    
         <FS_TAB2>-TABLE_COUNT = 2.                  "Table value same for all row
         <FS_TAB2>-ROW_COUNT = SY-TABIX.      "Index value
    ENDLOOP.
    "Copy the First Internal Table 'ITAB1' to Final Table
    IT_FINAL[] = ITAB1[].
    "Copy the Second Internal Table 'ITAB2' to Final Table
    APPEND IT
    LOOP AT ITAB2 INTO WA_TAB2.
    APPEND WA_TAB2 TO IT_FINAL.
    ENDLOOP.
    "Sort the Internal Table based on TABLE_COUNT & ROW_COUNT
    SORT IT_FINAL BY  ROW_COUNT TABLE_COUNT.
    After sorting, check the output for IT_FINAL Table, you can find the required output as shown above.
    Regards
    Rajkumar Narasimman

  • How to join two tables

    hi
    how to join two tables using inner join  if the first table has two primary keys and second table has 3 primary keys

    Would describe type of joins in ABAP, which might differ with other joins.
    The join syntax represents a recursively nestable join expression. A join expression consists of a left-hand and a right- hand side, which are joined either by means of INNER JOIN or LEFT OUTER JOIN. Depending on the type of join, a join expression can be either an inner (INNER) or an outer (LEFT OUTER) join. Every join expression can be enclosed in round brackets. If a join expression is used, the SELECT command circumvents SAP buffering.
    On the left-hand side, either a single database table, a view dbtab_left, or a join expression join can be specified. On the right-hand side, a single database table or a view dbtab_right as well as join conditions join_cond can be specified after ON. In this way, a maximum of 24 join expressions that join 25 database tables or views with each other can be specified after FROM.
    AS can be used to specify an alternative table name tabalias for each of the specified database table names or for every view. A database table or a view can occur multiple times within a join expression and, in this case, have various alternative names.
    The syntax of the join conditions join_cond is the same as that of the sql_cond conditions after the addition WHERE, with the following differences:
    At least one comparison must be specified after ON.
    Individual comparisons may be joined using AND only.
    All comparisons must contain a column in the database table or the view dbtab_right on the right-hand side as an operand.
    The following additions not be used: NOT, LIKE, IN.
    No sub-queries may be used.
    For outer joins, only equality comparisons (=, EQ) are possible.
    If an outer join occurs after FROM, the join condition of every join expression must contain at least one comparison between columns on the left-hand and the right-hand side.
    In outer joins, all comparisons that contain columns as operands in the database table or the view dbtab_right on the right-hand side must be specified in the corresponding join condition. In the WHERE condition of the same SELECT command, these columns are not allowed as operands.
    Resulting set for inner join
    The inner join joins the columns of every selected line on the left- hand side with the columns of all lines on the right-hand side that jointly fulfil the join_cond condition. A line in the resulting set is created for every such line on the right-hand side. The content of the column on the left-hand side may be duplicated in this case. If none of the lines on the right-hand side fulfils the join_cond condition, no line is created in the resulting set.
    Resulting set for outer join
    The outer join basically creates the same resulting set as the inner join, with the difference that at least one line is created in the resulting set for every selected line on the left-hand side, even if no line on the right-hand side fulfils the join_cond condition. The columns on the right-hand side that do not fulfil the join_cond condition are filled with null values.
    Note
    If the same column name occurs in several database tables in a join expression, they have to be identified in all remaining additions of the SELECT statement by using the column selector ~.
    Example
    Join the columns carrname, connid, fldate of the database tables scarr, spfli and sflight by means of two inner joins. A list is created of the flights from p_cityfr to p_cityto. Alternative names are used for every table.
    PARAMETERS: p_cityfr TYPE spfli-cityfrom,
    p_cityto TYPE spfli-cityto.
    DATA: BEGIN OF wa,
    fldate TYPE sflight-fldate,
    carrname TYPE scarr-carrname,
    connid TYPE spfli-connid,
    END OF wa.
    DATA itab LIKE SORTED TABLE OF wa
    WITH UNIQUE KEY fldate carrname connid.
    SELECT ccarrname pconnid f~fldate
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM ( ( scarr AS c
    INNER JOIN spfli AS p ON pcarrid = ccarrid
    AND p~cityfrom = p_cityfr
    AND p~cityto = p_cityto )
    INNER JOIN sflight AS f ON fcarrid = pcarrid
    AND fconnid = pconnid ).
    LOOP AT itab INTO wa.
    WRITE: / wa-fldate, wa-carrname, wa-connid.
    ENDLOOP.
    Example
    Join the columns carrid, carrname and connid of the database tables scarr and spfli using an outer join. The column connid is set to the null value for all flights that do not fly from p_cityfr. This null value is then converted to the appropriate initial value when it is transferred to the assigned data object. The LOOP returns all airlines that do not fly from p_cityfr.
    PARAMETERS p_cityfr TYPE spfli-cityfrom.
    DATA: BEGIN OF wa,
    carrid TYPE scarr-carrid,
    carrname TYPE scarr-carrname,
    connid TYPE spfli-connid,
    END OF wa,
    itab LIKE SORTED TABLE OF wa
    WITH NON-UNIQUE KEY carrid.
    SELECT scarrid scarrname p~connid
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM scarr AS s
    LEFT OUTER JOIN spfli AS p ON scarrid = pcarrid
    AND p~cityfrom = p_cityfr.
    LOOP AT itab INTO wa.
    IF wa-connid = '0000'.
    WRITE: / wa-carrid, wa-carrname.
    ENDIF.
    ENDLOOP.

  • How to join two ITAB

    Hai
             i have created an program using ALV and i had created two internal tables namely ITAB and ITAB1.But i wasn't unable to get an output.so i like to know how to join two ITAB in ALV.

    MAhesh,
    Check this ex:
    ITAB1 is having fields  "A","B", "C".
    ITAB2 is having fields  "A","D", "E".
    Create i_final internal table to have all fields of 2 internal tables.
    i_final is having "A","B","C","D","E".
    SORT itab1 ,itab2 by A
    LOOP AT ITAB1.
      READ TABLE itab2 WITH KEY a = itab1-a BINARY
                                                                  SEARCH.
       IF SY-SUBRC EQ 0.
         MOVE : itab1-a  TO i_final-a,
                      itab1-b  TO i_final-b,
                      itab1-c  TO i_final-c,
                      itab2-d  TO i_final-d,
                      itab2-e  TO i_final-e.
        APPEND i_final.
       ENDIF.
    ENDLOOP.
    Don't forget to reward if useful.....

  • How to join two open endpoints?

    How to join two open endpoints?
    I keep getting this error message even though the endpoints do not have this: "To join, you must select two open endpoints. If they are not the same path, they cannot be on text paths nor inside graphs, and if both of them are grouped, they must be in the same group."
    I've ungrouped everything.
    I've tried using the pen tool to manually join.
    I've moved the endpoint, then tried joining them.
    I've tried command+J.
    Same message everytime.
    And if I use the Pathfinder, I'll get unwanted results (i.e. a new path going right though the art)
    What's going on!?

    blueribb,
    While uploading an AI file is unsorted, you may consider at least one option:
    One is that you have at least one hidden extra Anchor Point, either on one of the paths or as stray or belonging to a third path.
    You may find out by:
    1) Using the Direct Selection Tool to click, not drag over, both end Anchor Point and then Cmd+J, and/or
    2) Using the Direct Selection Tool to click, not drag over, each end Anchor Point by itself and then move it a bit.

  • How to Join two diff pl/sql table  ???

    i have three queries
    1.One Query returns office and city
    2.Second Query return City - State
    3.Third Query returns State and Sub region
    I use three cursors and i want the output as Office -City -State -Sub region
    city is the joining for 1 and 2
    state is the joining for 2 and 3
    I am thinking of putting into pl/sql table .if it is okay tell me by giving how u will join the two pl/sql tables and if there is any other way kindly let me know .It is urgernt and please give me the code logic so that i can proceed

    First thing why are you using cursors? You can do it
    using SQL.Agreed, it can all be specified in a single SQL statement.
    Secondly I don't think there is some as Pl/Sql TableThere used to be something called a PL/SQL Table, but these have now, thankfully, been renamed to Associative Arrays, because that is what they are, Arrays, not tables. You can't treat Assoc. Arrays as database tables so you can't do Joins in the same way as you would with an SQL statement. To implement a join using arrays would require some (possibly recursive) loops to process each of the arrays to get the required data. This would of course be a lot slower than just using SQL on database tables.
    ;)

  • How to join two pl/sql tables .,.,,Urgent pls help

    Hi,
    Please tell me how to join to pl/sql tables with example
    thanks
    asp

    If your main intention is to get the common records/or getting whole records from the 2 different pl/sql arrays then , pls check this piece of code & explanation
    The SQL language has long offered the ability to apply set operations (UNION, INTERSECT, and MINUS) to the result sets of queries. In Oracle Database 10g, you can now use those same high-level, very powerful operators against nested tables (and only nested tables) in your PL/SQL programs and on nested tables declared as columns inside relational tables.
    Let's take a look at some of the syntax needed to do this, starting with UNION.
    First, I create a schema-level nested table type:
    CREATE OR REPLACE TYPE strings_nt
    IS TABLE OF VARCHAR2(100);
    Then I define a package and within it create and populate two nested tables of this type, each containing some of my father's and my favorite things:
    CREATE OR REPLACE PACKAGE favorites_pkg
    IS
    my_favorites strings_nt
    := strings_nt ('CHOCOLATE'
    , 'BRUSSEL SPROUTS'
    , 'SPIDER ROLL'
    dad_favorites strings_nt
    := strings_nt ('PICKLED HERRING
    , 'POTATOES'
    , 'PASTRAMI'
    , 'CHOCOLATE'
    PROCEDURE show_favorites (
    title_in IN VARCHAR2
    , favs_in IN strings_nt
    END;
    In this package, I also include a procedure to show the contents of a strings_nt nested table. This will come in very handy shortly.
    By defining these collections in a package, outside any program, they persist (they maintain their state and values) for the duration of my session or until I change or delete them. This means that I can now write programs outside the package to manipulate the contents of those collections.
    Note that this package has been simplified for the purposes of presenting collection functionality. In a production application, you should always take care to "hide" your package data, as with these collections, in the package body, and then provide procedures and functions to manage the data.
    Suppose, for example, that I would like to combine these two collections into a single collection of our favorites. Prior to Oracle Database 10g, I would have to write a loop that transfers the contents of one collection to another. Now, I can rely on the MULTISET UNION operator, as shown below:
    DECLARE
    our_favorites
    strings_nt := strings_nt ();
    BEGIN
    our_favorites :=
    favorites_pkg.my_favorites
    MULTISET UNION ---- Use INTERSECT , if you want to know common records
    favorites_pkg.dad_favorites;
    favorites_pkg.show_favorites (
    'ME then DAD', our_favorites);
    END;
    The output from this script is:
    ME then DAD
    1 = CHOCOLATE
    2 = BRUSSEL SPROUTS
    3 = SPIDER ROLL
    4 = PICKLED HERRING
    5 = POTATOES
    6 = PASTRAMI
    7 = CHOCOLATE
    ------------------------------

  • How to join two lists and display the results in datasheet view.?

    hello,
    i have two lists that i would like to join, i know a method that has been described  in the link below
    http://www.codeproject.com/Articles/194252/How-to-Link-Two-Lists-and-Create-a-Combined-Ciew-i
    however, here the data view is only limited to 30 rows and my resultant list is huge. I would like to know if there is a possibility to view the resultant list in a data sheet view ?

    I don't believe you can use the OOTB Datasheet view when joining lists. However, you should be able to increase your limit from 30 items to as many as you need (that doesn't trip the threshold set in Central Admin).
    Dimitri Ayrapetov (MCSE: SharePoint)

  • Join two sites together

    Hi, i have two dynamic websites each connecting to two
    separate databases via separate connections. I have tried merging
    the two sites into one, but i get a problem because the database
    connection for one of the sites dont work after i join them. Can
    anyone please tell me the best way to join two dynamic sites
    together, so that both their databases work.
    thank you

    the best way to do it is to create a DSN connection but you
    have to make
    sure that they are on the same server
    if both the websites are on the same server that it can be
    easily done using
    DSN connection

  • Joining two files together

    I'm kinda new to Java, but i'm trying to create a program which joins 2 files together. It works fine with .txt files, but when i try to join two .wmv files, only the one it processes first will show, though the output file will have the size of the two files together. Here's my code for joining them together:
    try {
                        JFileChooser location = new JFileChooser();
                        location.showDialog(this, "Save file");
                        File videoout = location.getSelectedFile();
                        OutputStream os = new FileOutputStream(videoout);
                        BufferedOutputStream out = new BufferedOutputStream(os);
                        InputStream is = null;
                        BufferedInputStream in = null;
                        ListIterator pathsIterator = paths.listIterator();
                        while(pathsIterator.hasNext()) {
                            File part = new File(pathsIterator.next().toString());
                            is = new FileInputStream(part);
                            in = new BufferedInputStream(is);
                            int line;
                            while((line = in.read()) != -1) {
                                out.write(line);
                        in.close();
                        out.close();
                        JOptionPane.showMessageDialog(this, "Done");
                    } catch(IOException io) {
                        System.out.println("IO: " + io);
                    }Any idea what i'm doing wrong?
    Thanks

    Just because you put 2 files in the same file doesn't mean some application can understand that it's 2 files in 1. Meaning, the player of the merged WMV can't know that there's 2 files and that it should play both back to back. You have to read the WMV files knowing the WMV format and then generate 1 file that combines the 2, which typically would include updating header information in the file. Java's I/O classes are not going to provide that sort of thing for you.

  • How to blend two photos together ?

    Hi Everyone,
    I'm an intermediate Photoshop user and this is my first post.  I'm hoping to get some advice from an advanced user to achieve the following:
    1)  I have two seperate images...one of a scenic background and another of a person's face.  I want to place the image of the person's face on top of the scenic background and blend them together so the person's face looks like a soft silhouette on the scenic background. I want to do this in an 'artful' way where the two images blend together with real chemistry.  I tried using "overlay" mode on the facial image and fiddling with its layer opacity (which I thought would work) but the results look very contrived to me.  Anyone know how to do this ?
    Thank you very much for your time !
    Jay

    Thank you John for the quick reply.  I actually excerpted the facial image fairly well and I did use a feathered edge as well as a layer style called "Outer Glow".  Both of these techniques helped.  I'm just looking a way for these two images to have real chemistry together.  I am designing a series of sympathy cards for a memorial service and I'm looking to marry these two images together in an artful way.  Are there any 3rd party filters that combine photos together in a collage like this ?  Although my collage is very simple (just two images).  I have attached one sample background image here if you'd like to see what it looks like.  I have the image of the Woman's face already cut out on a transparent background in a .psd file.  I can't seem to post a PSD file here in the forum.  So, I uploaded it to a website where it can be downloaded from the following location:
    Woman's Face: http://www.fileuploadcenter.com/BettyWilson-sm.psd
    2nd Sample Background: http://www.fileuploadcenter.com/MystyForestPath508293.jpg
    Thank you,
    Jay

Maybe you are looking for

  • ITunes 10.3.1 64bit hangs and freezes constantly

    Ever since I downloaded iTunes 10.3.1 on my Windows 7 machine I can barely use it!  Everything I tell iTunes to do, whether its adding a song to a playlist, or playing a song, is met with a good 30-60 second "hang" before it performs that command. I

  • Adobe flash player for mac book pro

    Hi, This is my first mac book but i need help to download & use adobe flash player to watch some of our streaming videos. Need advice. Thanks bpsai

  • Picture gallery

    Hi all, I'm trying to set up a picture gallery in DW8 but the option isn't there for me to "Insert a Rollover Image". I would like to put back a forward buttons aswell. Can someone guide me on what to do please. thanks, banawaz

  • How can I completely and totally destroy these processes?

    Once a minute these two processes (one for Boxee and one for Glims) will run. Both have been uninstalled as completely as I can see how (ran the uninstaller for Glims, nothing in Application Support, all related .plist files), but launchd apparently

  • Implement business delegate as a singleton.

    Anyone have any comments regarding implementing the bussiness delegate as a singleton? I currently have something like this. public class ClientUserManager { public ClientUserManager() { public void deleteUser(Long userid) throws RemoteException, Cre