How to compare data between two tables?

Hi,
My team is trying to develop a SAP data migration tool (DMT) using ABAP.
One of the functionalities in the DMT is to validate the data in the staging area against the loaded SAP data.
The tables in the stagin area are customer tables (i.e. user-defined tables starting with Y, Z).
How do I compare the data in the staging area against data that are loaded into SAP tables? Are there some built-in SAP functions to do this? Or, are there some better ways of doing this (e.g. instead of comparing against data in the SAP tables, we compare with some INTERNAL tables)?
Any help would be greatly appreciated, thanks!

Hi Kian,
Use <b>SCMP</b> transaction to compare data between two tables and you can not use this for comparing internal tables.
Thanks,
Vinay

Similar Messages

  • Compare data between two tables

    Hey Experts
    I am having two tables both are having same structure.
    Both r having 210 columns
    I want to compare data between these two tables.
    I used follwoing query
    select * from t1
    MINUS
    select * from t2but even if thr is diff in 1columns .. i need to search 210 columns which is the exact columns and data
    how can i find the exact columns out of these 210 columns ?

    SShubhangi wrote:
    but even if thr is diff in 1columns .. i need to search 210 columns which is the exact columns and data
    how can i find the exact columns out of these 210 columns ?This is not a trivial problem to solve. Consider a much simpler data set. In table 1 (four columns) we have
    1 A B C
    2 D E F
    3 A B Dand in In table 2 (four columns) we have
    2 X Y Z
    3 A B ENow
    select * from table1 minus select * from table2gives
    1 A B C
    2 D E F
    3 A B Dwhereas
    select * from table2 minus select * from table1gives
    2 X Y Z
    3 A B ENow clearly the first row in Table1 (ID=1) doesn't match any row in Table2 but it's only two columns out from the last row in Table2 (ID=3). However, the row in Table1 with ID=3 only doesn't match on one column.
    So, how do you represent the output?
    Clearly what you want can only be achieved if there are some columns which ought to be the same in both tables i.e. key columns. In which case you can use a full outer join link teh two tables, and case statements to display only the values which don't match:
    select t1.id as t1_id
             , t2.id as t2_id
             , case when t1.col1 != t2.col1 then r1.col1 end as t1_col1
            , case when t1.col1 != t2.col1 then r1.col1 end as t2_col1
            , case when t1.col2 != t2.col2 then r1.col2 end as t1_col2
            , case when t1.col2 != t2.col2 then r1.col2 end as t2_col2
            , case when t1.col3 != t2.col3 then r1.col3 end as t1_col2
            , case when t1.col3 != t2.col4 then r1.col4 end as t2_col2
    from table1 t1
          full outer join table2 t2
         on t1.id = t2.id;Handling nulls is left as an exercise for the reader :)
    I agree that typing all this would be extremely tedious for a table with 210 columns, but that's why Nature gave us the ability to generate SQL statements from teh data dictionary.
    Cheers, APC

  • Compare data between two tables of same schema

    Folks,
    I have one very intresting query which i would like to share with you all and looking forward for the solution asap.
    Scenario
    I have two table say TableA and TableB, both having same structre say as below
    TableA
    Col1 Var(10)
    Col2  INT
    TableB
    Col1 Var(10)
    Col2  INT
    I want to compare data between these two tables and store compared data into third table, let me expalin the whole scenario.
    TableA
    ColA          ColB
    INDIA          1
    PAKistan      2
    TableB
    ColA          ColB
    INDIA          1
    PAK             3
    I want result like
    Difference
    ColA          ColB
    True            0
    False           -1
    I want to store this difference in thrid table.
    i.e. when comparing text, i need TRUE when compare 100% else False, Caption is not considered.
         When comparing numeric value, simple sub is requried , TableA-TableB
    Note - I dont want to use any external tool to compare the table data, i required sql query to do the same.
    Thanks
    Amit Srivastava
    Amit
    Please mark as answer if helpful
    http://fascinatingsql.wordpress.com/

    Whereas the abbreviation of countries that exist in Table2 table are the first three letters of the name of the country*, here's a suggestion:
    -- code #1 v2
    INSERT into [Difference] (Col1, Col2, ACol1, BCol1)
    SELECT case when A.Col1 = B.Col1 then 'true' else 'false' end,
    (IsNull(A.Col2, 0) - IsNull(B.Col2, 0)), A.Col1, B.Col1
    from TableA as A full outer join
    TableB as B on (A.Col1 = B.Col1
    or Left(A.Col1, 3) = B.Col1);
    Is the COLLATE database case insensitive? If not, the code #1 above will have to be modified, using the upper () function or using COLLATE case insensitive in A.Col1 and B.Col1 columns.
    But if the abbreviation of the country follow the
    ISO 3166-1 alpha-3 standard, will require a fourth table containing the symbol and name of countries.
    -- code #2 v2
    ;with
    TableB_2 as (
    SELECT case when Len(Col1) = 3
    then (SELECT Country_name from [ISO 3166-1 a3] where Cod = Col1)
    else Col1 end as Col1, Col2
    from TableB
    INSERT into [Difference] (Col1, Col2, ACol1, BCol1)
    SELECT case when A.Col1 = B.Col1 then 'true' else 'false' end,
    (IsNull(A.Col2, 0) - IsNull(B.Col2, 0)), A.Col1, B.Col1
    from TableA as A full outer join
    TableB_2 as B on A.Col1 = B.Col1;
    Structure and data to test:
    use tempdb;
    CREATE TABLE TableA (Col1 varchar(10), Col2 int);
    CREATE TABLE TableB (Col1 varchar(10), Col2 int);
    CREATE TABLE [Difference] (Col1 varchar(10), Col2 int, ACol1 varchar(10), BCol1 varchar(10));
    INSERT into TableA values ('INDIA', 1), ('PAKistan', 2), ('China', 12);
    INSERT into TableB values ('INDIA', 1), ('PAK', 3), ('Bhutan', 3);
    go
    CREATE TABLE [ISO 3166-1 a3] (Cod char(3) primary key, [Country_name] varchar(30));
    INSERT into [ISO 3166-1 a3] values
    ('IND', 'India'), ('PAK', 'Pakistan'), ('CHN', 'China'), ('BGD', 'Bangladesh'),
    ('BTN', 'Bhutan'), ('MMR', 'Myanmar'), ('NPL', 'Nepal');
    go
    (*) If the short form of the country name using the first three letters of the country name,
    false positives can occur. For example,
    Mali and Malta or
    Angola and Anguilla.
    José Diz     Belo Horizonte, MG - Brasil

  • How to compare dates between two items

    Hello all,
    I am trying to compare dates in two items.
    The first item is a computation P45_PAGE_LOADED_TIME
    select sysdate from dual;
    This essentially keeps track of when the user opened the form. They are accessing data that may become obsolete while they are in the form.
    So we have a dynamic action that finds the last_update date from a table. This field is of type date. It is placed in a text field called P45_STATUS.
    We then have a notification which we want to fire when P45_PAGE_LOADED_TIME is before P45_STATUS. We tried the following condition
    declare
    least_date date;
    begin
    SELECT LEAST(TO_DATE(:P45_STATUS),TO_DATE(:P45_PAGE_LOADED_TIME)) into least_date
    from dual;
    if least_date = to_date(:P45_STATUS) then
    return false;
    else
    return true;
    end if;
    end;
    Any guidance would be most appreciated.
    Thanks

    Maybe your better off putting your anonymous block into a plsql function.
    A function that you can test. If it works in plsql then you must call it in APEX.
    I kinda get a headache when I see that least, to_date, to_date query (although I've seen worse :p)
    Make it like:
    create or replace function fun_least_date(in_status in varchar2,
                                                               in_page_loaded_time varchar2) return boolean
    is
      l_status date;
      l_page_loaded_time date;
      least_date date;
      l_return boolean;
    begin
      l_status := to_date(in_status, 'FORMAT MASK!!!');
      l_page_loaded_time := to_date(in_page_loaded_time, 'FORMAT MASK!!!!');
      least_date := least(l_status, l_page_loaded_time);
      if least_date = l_status then
        l_return := false;
      else
        l_return := true;
      end if;
      return l_return
    end fun_least_date;If your sure that your function is correct then use it as a condition for your dynamic action.
    Regards
    Nico
    ps: I haven't tested that function. Be aware that you most correctly enter the format mask you use in APEX. Also before APEX may know about these variables you should set a dynamic action on your items to always submit their value to the server when they change!!!

  • How to compare data between two worksheet in Excel for applescript

    Hi All,
    How to compare the data from two different worksheet in Excel and set the value into one worksheet according to the same name? Here is the example. Worksheet 1 & 2 current we have, the final worksheet is the result we want and the value can be input in worksheet 1. Much appreciate if you can help on it.
    Worksheet 1:
    Name          Number
    Leo                 25
    Jame               55
    Leo                 30
    Jame               60
    Tim                 44
    Tomas             77
    Lyne                35
    Tonny              66
    Jame               22
    Game              88
    Worksheet  2:
    Name          Number  2
    Leo                60
    Jame             150
    Tim                66
    Tomas            88
    Lyne               55
    Tonny            99
    Game             111
    Rusult in Worksheet 1
    Name          Number        Total Number per name in Worksheet 1         Number 2 in Worksheet 2
    Leo                 25                          55                                                        60
    Jame               55                         137                                                       150
    Leo                 30                           55                                                        60
    Jame               60                         137                                                       150
    Tim                 44                          44                                                         66
    Tomas             77                          77                                                        88
    Lyne                35                          35                                                        55
    Tonny              66                          66                                                        99
    Jame               22                         137                                                       150
    Game              88                          88                                                        111

    I'd probably use a database for this, if there's any quantity of data involved here.  Import from Excel into {SQLite, MySQL, PostgreSQL, FileMaker, maybe Core Data}, or pick your preferred key-value store, keep your data in the database, then export or (via ODBC/JDBC) then access live database data from within the spreadsheets.
    Alternatively and if you're looking at small quantities of data (say, less than 10,000 entries, or less than a thousand depending on the language), then just use whatever passes for a key-value store in your preferred scripting language {Python, bash, Lua, or maybe php, AppleScript or Java} and use that.  Export Excel to CSV {gag} or XML, then load that into Python and process as needed, then write out CSV {gag} or XML.
    AppleScript is a scripting language for GUI applications, and also useful for processing events.  If you're not doing that sort of stuff, then there can be other choices, and other choices can often have extensive frameworks and libraries for common tasks.
    Sooner or later, most everybody runs into a wall when using a spreadsheet...  Various folks have encountered those limits and have migrated from spreadsheets to FileMaker databases, and now use a database as the central store for their operations — and that's the other issue that can arise with spreadsheets... Where's the canonical data?

  • Compare data between two tables all coullms

    Hi All,
    I have a task to compare data for the dev and prod data for the same table ,can some one please help me with the script for this ...
    Thanks in Advance..

     SELECT Foo.*, Bar.*
       FROM Foo
            FULL OUTER JOIN
            Bar
            ON Foo.c1 = Bar.c1
               AND Foo.c2 = Bar.c2
               AND Foo.cn = Bar.cn
     WHERE Foo.key IS NULL 
        OR Bar.key IS NULL; 
    Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
    Blog : MS SQL Development and Optimization
    Blog : Large
    scale of database and cleansing

  • How to transfer data between two tables

    Hi friends i have got a new problem actually i'm a fresher in this SAP so i have a doubt in SAP Smart Forms the problem is like this
    I have a data element common in both of the tables BSEG and KNA1 and the common data element is KUNNR so i want to transfer all the data in the table BSEG to KNA1 of the same data element(KUNNR) in which there is data regarding customer information so i want to transfer the single customer data into another table KNA1 and i want to display the data in the output plz any one can help me.

    hi.
    the below metjhod u can adopt.
    1)
    select data from 1st zable to internal table.
    2)insert data from internal table to 2nd ztable simple.
    data:begin of itab occurs 0.
    include structure ztable_structure1.
    data:end of itab.
    select * from ztable into table itab.
    modify ztable1 FROM TABLE itab.
    3 ) ike that u can catch date from other table.
    4) if any condition is there u can check it in the internal table.
    Rgds
    Anver
    if hlped pls mark points

  • Comparing Data between two tables with different structure

    Hi,
    I have 2 tables T1 and T2. Both tables have different structure. I have to check for rows missing in T1 which exist in T2 and vice-versa. I can do that using MINUS operator. But the part where the data exists in both T1 and T2, I have to compare some columns (9 columns the names of this column coming from a meta-data table) if they have same values. If not an exception has to be generated.
    Any help is appreciated.
    Thanks

    Hi,
    Whenever you need help on this forum, post:
    (1) The version of Oracle (and any other relevant software) you're using
    (2) A little sample data (just enough to show what the problem is) from all the relevant tables
    (3) The results you want from that data (4) Your best attempt so far
    Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
    Formatted tabular output is okay for (3). Type before and after the tabular text, to preserve spacing.
    What do you mean by "an exception has to be generated"?
    Do you want to raise an error?
    Do you want something to appear in the result set?
    MINUS finds rows that are in one result set, but not in another.
    INTERSECT finds rows that are in both result sets.
    Column names have to be hard-coded into the SQL statement.  If you want to write something now that will get column names from a metadata table sometime in the future, then you have to use dynamic SQL.  SQL*Plus sometimes has quick and dirty ways of doing dynamic SQL, so say whether you're using SQL*Plus or not.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to copy data between two tables row by row

    Hi All,
    I have three tables TableA and TableB and TableC
    I wanted to write a stored procedure to copy data row by row from TableA to TableB and then update TableC by replacing any record that has the old id (before copying) to the new id after copying the data.
    here is the steps 
    iterate throw all the rows in tableA ( probably with a foreach)
    in each iteration we will do the following:
    Get current ID (identity) for each record in TableA ( will call it @oldID)
    Insert the row in TableB
    Get the new ID for the row from TableB will call it (@NewID)
    find rows in tableC that has the (@oldID)
    replace all ids in tableC with @oldID to @NewID
    Thanks in advance

    0
    TableA and TableB are identical they should have the same columns 
    TableC columns will be ( ID, TableA_ID , Notes)

  • How to pass data between two internal sessions using ABAP memory?

    Hi,
    How to pass data between two internal sessions using ABAP memory?
    It would be fine if you could explain with an example.
    And also let me clear about the data passing between two main sessions and two external sessions with specific examples.
    Thanks.

    Hi ,
      check the example.
    Reading Data Objects from Memory
    To read data objects from ABAP memory into an ABAP program, use the following statement:
    Syntax
    IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.
    This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.
    In this statement, the system does not check whether the structure of the object in memory is compatible with the structure into which you are reading it. The data is transported bit by bit. If the structures are incompatible, the data in the target field may be incorrect.
    PROGRAM SAPMZTS1.
    DATA TEXT1(10) VALUE 'Exporting'.
    DATA ITAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
    DO 5 TIMES.
      ITAB-BOOKID = 100 + SY-INDEX.
      APPEND ITAB.
    ENDDO.
    EXPORT TEXT1
           TEXT2 FROM 'Literal'
      TO MEMORY ID 'text'.
    EXPORT ITAB
      TO MEMORY ID 'table'.
    SUBMIT SAPMZTS2 AND RETURN.
    SUBMIT SAPMZTS3.
    The first part of this program is the same as the example in the section Saving Data Objects in Memory. In the example, the programs SAPMZTS1 and SAPMZTS2 are called using SUBMIT. You can create and maintain the programs called using the SUBMIT statement by double-clicking their names in the statement. For further information about the SUBMIT statement, refer to Calling Executable Programs (Reports)
    Example for SAPMZTS2:
    PROGRAM SAPMZTS2.
    DATA: TEXT1(10),
          TEXT3 LIKE TEXT1 VALUE 'Initial'.
    IMPORT TEXT3 FROM MEMORY ID 'text'.
    WRITE: / SY-SUBRC, TEXT3.
    IMPORT TEXT2 TO TEXT1 FROM MEMORY ID 'text'.
    WRITE: / SY-SUBRC, TEXT1.
    Example for SAPMZTS3:
    PROGRAM SAPMZTS3.
    DATA JTAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
    IMPORT ITAB TO JTAB FROM MEMORY ID 'table'.
    LOOP AT JTAB.
      WRITE / JTAB-BOOKID.
    ENDLOOP.
    The output is displayed on two successive screens. It looks like this:
    and
    The program SAPMZTS2 attempts to read a data object TEXT3 from the data cluster "text", which does not exist. TEXT3 therefore remains unchanged. The existing data object TEXT2 is placed in TEXT1. In both cases, SY-SUBRC is 0, since the cluster "text" contains data.
    The program SAPMZTS3 reads the internal table ITAB from the cluster "table" into the internal table JTAB. Both tables have the same structure, namely that of the ABAP Dictionary table SBOOK.
    Pls. reward if useful.....

  • Query the data between two tables

    Need help for query the data between two tables
    Table 1: Time sheet
    P.ID      P.Name EmpID HoursSpend DateTime
    c12234  Test      25        4                06/12/2013
    c12234  Test      25        7                06/13/2013
    c12234  Test      25        8                06/15/2013
    c12234  Test      5          3                06/21/2013
    c12234  Test      2          5                07/15/2013
    c12234  Test      25        4                07/21/2013
    Table 2: cost table
    EmpID  FromDate       ToDate         Rate
    25         05/01/2013    06/30/2013    250
    2         04/01/2013    05/31/2013      150
    25         07/01/2013     09/30/2013    300 
    Output
    P.ID      P.Name EmpID HoursSpend DateTime       Rate   Total (HoursSond x Rate)
    c12234  Test      25        4                06/12/2013    250     1000 (4*250)
    c12234  Test      25        7                06/13/2013    250      1750
    c12234  Test      25        8                06/15/2013    250      
    2000
    c12234  Test      25        4              07/21/2013     300       
    1200
    c12234  Test      2          5              07/15/2013    150          
    750
    ===========================================     
    Total                           28                                                 
    6700
    ============================================
    Here EmpID =2 don't have rate in the cost table on july month should be pick from last entry from cost table.

    Hi Gopal,
    According to your description, it seems that the output needn’t include the row when EmpID=2. Because the DateTime for it in Table1 doesn’t included between FromDate column and ToDate column. After testing the issue in my environment, we can refer to the
    query like below to achieve your requirement:
    SELECT time.*,cost.EmpID,cost.Rate,(time.HoursSpend * cost.Rate)as [Total (HoursSond x Rate)]
    FROM [Time sheet] as time
    INNER JOIN
    [cost table]as cost
    ON time.EmpID = cost.EmpID
    AND time.DateTime BETWEEN cost.FromDate AND cost.ToDate
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to check relation between two tables in same database

    How to check relation between two tables in same database using Oracle SQL developer. Version 2.1.1.64

    Hi,
    Try this,
    SELECT   cons.owner AS child_owner, cons.table_name AS child_table,
             cons.constraint_name constaint_name,
             cons.constraint_type constraint_type, col.owner parent_owner,
             col.table_name parent_table, col.column_name column_name
        FROM dba_cons_columns col, dba_constraints cons
       WHERE cons.r_owner = col.owner
         AND cons.r_constraint_name = col.constraint_name
         AND col.owner = 'MY_USER'
    ORDER BY child_table;Thanks,
    Shankar

  • Transaction to see common data between two tables

    Is there any transaction to see common data between two tables with out creating views.
    what is the transaction to see the link between two tables
    regards
    pavan

    Hi,
            Go to a transparent table for which you want to know the common fields, from there click the button GRAPHICS (shortcut Ctrl + Shift + F11) in the application tool bar. Then you are redirected to a list containing the tables belonging to the same group. There select whatever tables you would like to see and click COPY. A window will pop-up and will show the relationship between the fields of the tables in a flow chart format.
    see to this link also.
    Common fields b/w  tables
    Regards,
    Revathi Bhoopal.

  • How to insert data into two tables linke with foreign key..

    I have two tables
    1)EMP(emp_ID,username,emp_type_code)
    emp_ID is primary key, emp_type_code is a foreign key references emptype table.
    2)emptype(emp_type_code,emp_type_descripton)
    emp_type_code is primary key
    Could anyone help me ..how to insert data into EMP table. How to insert data into two tables linke with foreign key..

    CREATE TABLE "CATDB"."DWDIMUSER"
    "USER_ID" NUMBER(10,0) NOT NULL ENABLE,
    "SPECIALTY_ID" NUMBER(10,0),
    "FULLNAME" VARCHAR2(20 BYTE),
    "FNAME" VARCHAR2(20 BYTE),
    "LNAME" VARCHAR2(20 BYTE),
    "USER_SUBTYPE" VARCHAR2(20 BYTE),
    CONSTRAINT "DIMUSER_PK" PRIMARY KEY ("USER_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE,
    CONSTRAINT "DIMUSER_DIMSPECIALTY_FK" FOREIGN KEY ("SPECIALTY_ID") REFERENCES "CATDB"."DWDIMSPECIALTY" ("SPECIALTY_ID") DISABLE
    CREATE TABLE "CATDB"."DIMSPECIALTY"
    "SPECIALTY_ID" NUMBER(10,0) NOT NULL ENABLE,
    "SPECIALTY_NAME" VARCHAR2(100 BYTE),
    CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("SPECIALTY_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
    INSERT INTO DIMUSER (FullName, FNAME, LNAME, USER_TYPE, USER_SUBTYPE)
    SELECT DISTINCT
    Engineer AS FullName,
    regexp_substr(Engineer , '[^,| ]+', 1, 1) as FName,
    regexp_substr(Engineer , '[^,| ]+', 1, 2) as LName ,
    'Engineer'
    FROM EMPLOYEELOOKUP;
    INSERT INTO DIMSPECIALTY (SPECIALTY_NAME)
    SELECT DISTINCT SPECIALITY
    FROM EMPLOYEELOOKUP;
    COMMIT;
    CREATE TABLE employeelookup ...IS A TABLE THAT HAS ALL THE DATA NEDED TO BE FILLED IN BOTHE TABLES...
    CREATE TABLE "CATDB"."EMPLOYEELOOKUP"
    "EMPLOYEELOOKUP_ID" NUMBER(10,0) NOT NULL ENABLE,
    "ENGINEER" VARCHAR2(25 BYTE),
    "SPECIALTY" VARCHAR2(20 BYTE),
    CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("EMPLOYEELOOKUP_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
    DATA IN EMPLOYEELOOKUP
    Engineer, Specialty,
    John, Dow, Electronis,
    Dow, Jons, Technician
    Stan Smithers Sales
    Mark, Richards Marketing
    Jenny, Lane Marketing
    John, Lee Sales
    I NEED TO LOAD THE FOREIGN KEY IN DIMUSER FROM THE DIMSPECIALTY TABLE?
    BY USING THE LOOKUP TABLE TO MARCH THE NAMES UNDER THE Engineer COLUMN, SPECIALTY COLUMNE DISTICTIVLY BY JOINING THE DIMSPECILTY TO RISTIVE THE PRIMARY KEY AND FILL IT IN THE DIMUSER TABLE AS A FOREIGNE KEY.

  • How to separate data between two colons

    Hi,
    how to separate data between two colons?
    ex: 'ABC:1234:1-ss-2:0:0:0:0-DEF:5678:0:0:0:0'
    how to access these 1234, 5678 and 1-ss-2 ?
    there may be any string.
    please help

    Hi,
    The string 'ABC:1234:1-ss-2:0:0:0:0-DEF:5678:0:0:0:0' contains 11 colons, and 10 sub-strings that are between colons. How do you distinguish the ones you want,
    (1) 1234
    (7) 5678
    (2) 1-ss-2
    from the ones you don't want
    (3) 0
    (4) 0
    (5) 0
    (6) 0-DEF
    (8) 0
    (9) 0
    (10) 0
    Anyhow, in Oracle 10 (and up) you can easily get the n-th item from a :-delimited list by saying:
    REGEXP_SUBSTR ( txt
                  , '[^:]+
                  , 1
                  , n
                  )First use REGEXP_REPLACE to remove anything before the first colon and anything after the last one.

Maybe you are looking for