mirror of the data in a table separated through trigger

Oracle 11g r2.

Table_account holds public user and professional info for registration (public username, name, address, logo)

(this table can contain 1 million records)

Table_skill(Technician Name), table_skill_child, table_skill_grand_child, table_skill_ext

When the search for technical info, the sql will be executed against the Table_skill.  However, given that I also need to get the company name, address and information of logo with the technician information, there are two approaches:

(1) join Table_account and Table_skill, table_skill_child, table_skill_grand_child, table_skill_ext

Select the name of the technician, name, address, company logo

Table_account Table_skill, table_skill_child, table_skill_grand_child, table_skill_ext

where the...

PRO: simple join

CON: public user info is not necessary at all (this could potentially slow down the query speed?)

(2) reflect the data, that is when the company data to the Table_account, use relaxation to copy the name of the company, save him address and logo on the Table_skill.  When looking for technicians, it will be fast, no need to exclude the public user names the table_account

Select the name of the technician, name, address, company logo

of Table_skill.

table_skill_child, table_skill_grand_child, table_skill_ext

where the...

PRO: table_account, which contains the unwanted public modules is eliminated

CON: deduplication of data for example, the logo in several tables

Want to hear your opinion.

Thank you

Scott

Hi, Scott.

scottjhn wrote:

Oracle 11g r2.

Table_account holds public user and professional info for registration (public username, name, address, logo)

(this table can contain 1 million records)

Table_skill (name)

When the research is done, the sql will be executed against the Table_skill.  However, given that I also need to get the company name, address and logo information, there are two approaches:

(1) join Table_account and Table_skill

Select the name of the technician, name, address, company logo

of Table_account Table_skill

where the...

PRO: simple join

CON: public user info is not necessary at all (this could potentially slow down the query speed?)

(2) reflect the data, that is when the company data to the Table_account, use relaxation to copy the name of the company, save him address and logo on the Table_skill.  When looking for technicians, it will be fast, no need to exclude public usernames

Select the name of the technician, name, address, company logo

of Table_skill

where the...

PRO: a table involved

CON: duplicate data, such as the logo in several tables

Want to hear your opinion.

Thank you

Scott

Another "con" is the difficulty of maintaining the data.  As you say, the performance will be better when doing a query that contains the replicated data, but DML will be slower.  Depending on how often you are DML and how many times you make queries that would benefit the denormalization, the benefit may or may not justify the costs.

There are many problems involved with triggers, in addition to the performance.  A materialized view can be a better option, especially if you can tolerate slightly obsolete results (i.e. ' stale').

This sort of thing is often done in Data Warehouse applications, where DML is frequent.  Search for the words "Data Warehouse", "Denormaliztion" and "Réplication" to learn more about the subject.

Most of the time, people join in situations like yours.

Tags: Database

Similar Questions

  • concatenate the data in 2 tables in a third table as well as in CONCATENATE strings

    Hello. as the title says, I wish to only concatenate the data in 2 tables in a similar third table that concatenate strings don't. All tables should be 1 d. For example, suppose that there is 1 table with the following: 1. 2; 3; 4 and table 2 with:; b; c; d. I would like a table 3 either 1 a, 2 b, 3 c, 4 d. Now this could be done easily with above mentioned concatenate strings, then table construction. but table 1 and 2 have something like 150 items. Rather painful. Any ideas?

    Hold arrays of two strings in a loop for example, concatentate the strings inside the loop and run the result réécrirait array3.

    Autoindexing manages table manipulations.

    MIke...

  • Select the data in a table and update in another table

    Dear experts,

    create the table TB_ENCRYPT

    (

    Identification number,

    Varchar2 (200) KEY

    );

    INSERT INTO TB_ENCRYPT VALUES(1,'HJUVHDUIFBSDGVU');

    SELECT * FROM TB_ENCRYPT;

    1 HJUVHDUIFBSDGVU

    create TABLE users)

    username, NUMBER of

    password VARCHAR2 (200)

    );

    Insert users

    values (1, 123 # "")

    Insert users

    values (2, 456 #')

    Select * from users;

    1 123 #.

    # 2 456

    I want to select the data KEY for table TB_ENCRYPT column and update in the column of tables for the respective key user password

    TB_ENCRYPT table contains only a single key value. Comparing this key, I want to update the old value of the key to the new value.

    For encryption and decryption I followed the java class method.no is worried about that.

    create or replace

    PACKAGE PCK_ENC AUTHID CURRENT_USER AS

    FUNCTION DECRYPT (VARCHAR arg0, arg1 VARCHAR) AS VARCHAR BACK LANGUAGE JAVA NAME 'Encrclass.decrypt (java.lang.String, java.lang.String) return java.lang.String ';

    FUNCTION ENCRYPT (VARCHAR arg0, arg1 VARCHAR) AS VARCHAR BACK LANGUAGE JAVA NAME 'Encrclass.encrypt (java.lang.String, java.lang.String) return java.lang.String ';

    END;

    SELECT PCK_ENC. ENCRYPT('1234','HJUVHDUIFBSDGVU') FROM DUAL;

    HERE,

    1234 - is the password of the users table column data

    HJUVHDUIFBSDGVU - represents the key of table TB_ENCRYPT column data.

    Comparing this key, I want to update the old value of the key to the new value.

    I tried with this method

    declare

    cursor c1 is

    Select the key

    of TB_ENCRYPT

    where id = 1

    update the id;

    Start

    for c1_rec looping c1

    update users

    password is PCK_ENC. Encrypt (Password, Key)

    the location being c1;

    commit;

    end loop;

    end;

    /

    Help, please

    You can use the MERGE statement.

    merge into users
    using tb_encrypt
       on (id = userid)
      when matched then
          update set password = PCK_ENC.ENCRYPT(password,key);
    

    And why you encrypt your password. This isn't a good idea. Just password hash.

  • Delete the data in partitioned tables

    Hello

    Oracle 11.2.0.3.0 version, running on Linux Enterprise.

    I need to remove all the data from two tables (several 100 million lines each) that are partitioned.

    (1) table 1 is a partition table have varied to a DATE column

    (2) Table2 is a partition of reference table; partitioning is referenced on a relationship of foreign key to Table1 (column: key Table1.Primary)

    As I have no need for data, but want to keep the structure of the table, I would ideally like to delete partitions at the same time that the deletion of the data, so that the 2 tables partitioned and empty.

    Additionally, Table1 has some partitioned index I would be rebuilt as an index unpartitioned (given that Table1 will be empty).

    I thought I would start by removing all partitions of Table1 (via "ALTER TABLE DROP PARTITION nom_partition Table1"), but when the script came to the last partition, I got this error message:

    ORA-14083: cannot delete the only one partition of a partitioned table

    ORA-06512: at "SYS." DROP_PARTITIONS', line 46

    If someone could advise as to the best approach to what I want to achieve with regard to the two tables? Two tables down and recreate them then without partitions would be the easiest way?

    Thanks in advance for any guidance.

    If someone could advise as to the best approach to what I want to achieve with regard to the two tables? Two tables down and recreate them then without partitions would be the easiest way?

    Yes - delete the tables and re-create them.

    As says the exception that you cannot delete the last partition. A table is partitioned either or it is not.

    There was no interest at all to use DBMS_REDEFINITION to redefine tables because you do not want the data anyway.

  • Size of the data in a table and the size of the table

    I am trying to determine the size of the data in a table and also the overall table size. I use the following query:

    SELECT BOTTOM (a.owner) as owner,
    LOWER (a.table_name) AS table_name,
    a.tablespace_name,
    a.Num_Rows,
    ROUND ((a.blocks * 8 / 1024)) AS size_mb,
    a.Blocks,
    a.Blocks * 8 Blocks_Kilo_Byte.
    a.PCT_FREE,
    a.compression,
    a.Logging,
    b.bytes / 1024 / 1024
    From all_tables a, dba_segments b
    WHERE the a.owner AS SUPERIOR ("USER_TEST")
    AND a.table_name = "X_TEST_TABLE."
    AND b.segment_name = a.table_name
    AND b.owner = a.owner
    ORDER BY 1, 2;

    Is this the right way to go about finding the size of the data in a table? If this isn't the case, please give your suggestions.

    BTW, this in a 10g version.

    You probably want to use the DBMS_SPACE package. In particular, the procedures SPACE_USAGE and UNUSED_SPACE to get an accurate account of the use of space in a table. Your application may give you a relatively accurate estimate if the optimizer on your table's statistics are reasonably accurate estimates. But there is no guarantee that the optimizer statistics are accurate.

    If you want just an approximate answer and you're comfortable that your statistics are accurate, this query may be close enough. If you want a specific response, however, use the DBMS_SPACE package.

    Justin

  • Kindly help me with the request to find the data in two tables

    Hello Guru

    Kindly help me to recover the data from two tables-

    BASEBALL
    LEGAL_ENT_ID (PK)
    GAME_ID (FK)
    LEGAL_ENT_NM
    INACTIVE_DT
    DATE OF INS_TS
    INS_LOGIN
    DATE OF UPD_TS
    UPD_LOGIN


    FOOTBALL
    GAME_ID (PK)
    BRKR_NM,
    BRKR_ISR_ID
    BROKER_SYMBOL
    INACTIVE_DT
    BRKR_SWIFT_FLG
    BRKR_INTERNAL_FLG
    BRKR_CATEGORY
    UPD_TS
    MINORITY_FLG
    BROKER_TYP
    STATUS
    INS_TS
    INS_LOGIN
    UPD_LOGIN
    APP_USER
    ACTIVE_FLG

    and if I want fecth data from these two tables according to the following condition then it is fine with the suite of applications.

    1 select distinct values only table of BASEBALL by using the following query.

    SELECT DISTINCT B.GAME_ID as 'CLEARING GAME ID', B.BRKR_NM "NAME of THE GAME of COMPENSATION" OF BASEBALL A, FOOTBALL B WHERE A.BROKER_RELATION_CD IN ('FUTBRKR1', 'FUTBRKR2') AND A.GAME_ID = B.GAME_ID

    2 Select all the table BRKR_NM OF FOOTBALL as well by using the query - next

    SELECT GAME_ID "RUNNING GAME ID", 'NAME OF THE GAME OF EXECUTION' BRKR_NM SOCCER

    Now, my query is that--

    I want a query that gives me a combination of above mentioned queries... and if I tried to use Union or Union All, then she is not giving me the result as expected.

    I like the result to look like who has a few conditions such as -
    1 - the records in the table Football are high vs Baseball table because there is no condition to filter the records of the Football.
    2 - football is a superset of records and Baseball is a subset.
    3 - COMPENSATION NOM_JEU and RUNNING NOM_JEU may return the same values as well.

    I want the result to be in the following form-

    EXECUTION ID GAME | NAME OF THE GAME TO RUN. COMPENSATION ID GAME | DELETE THE NAME OF THE GAME.
    2123 test1 2345 test5
    2456 test10 2456 test10


    Thanks in advance. Kindly help me.

    Published by: user555994 on January 4, 2011 23:48

    In the output you want.
    All the values of baseball;
    Values of football that are matched;
    But on what condition you want to match?

  • Inventory of the data of all Tables in a database

    Hello
    We do the analysis of the existing data base (Oracle 10 g) and I want to prepare an inventory of the data of all tables in a database that is

    1. total number of records in a table
    2. total number of records that have null values in a column
    3. total number of standalone tables IE have no connection with other tables
    etc...

    Please let me know if there are tools or query that can do these tasks.

    Thank you and best regards,
    Lokesh
    select owner "Owner",
    table_name "Table_Name",
    column_name "Column_Name",
    initcap(data_type) ||
    decode(data_type,
    'CHAR', '('|| char_length ||')',
    'VARCHAR', '('|| char_length ||')',
    'VARCHAR2', '('|| char_length ||')',
    'NCHAR', '('|| char_length ||')',
    'NVARCHAR', '('|| char_length ||')',
    'NVARCHAR2', '('|| char_length ||')',
    'NUMBER', '('||
    nvl(data_precision,data_length)||
    decode(data_scale,null,null,
    ','||data_scale)||')',
    null) "Type",
    nullable "Nullable",
    decode(to_char(num_distinct),
    0,'No',
    'YES') "Have Data",
    owner sdev_link_owner,
    table_name sdev_link_name,
    'TABLE' sdev_link_type
    from sys.dba_tab_columns
    where (:OWNER is null or instr(owner,upper(:OWNER)) > 0)
    and (:TABLE_NAME is null or
    instr(upper(table_name),upper(:TABLE_NAME)) > 0)
    and (:COLUMN_NAME is null or
    instr(upper(column_name),upper(:COLUMN_NAME)) > 0)
    and substr(table_name,1,4) != 'BIN$'
    and substr(table_name,1,3) != 'DR$'
    order by owner, table_name, column_id
    

    I added a new column with an alias "get data". This new column will display "NO" is the entire column is zero and 'YES' if there is even a value not null in the column. But caution is that statistics table must be updated to get the correct results.

    Thus, it may be useful to gather current statistics before executing the query.

    Exec dbms_stats.gather_schema_stats or even dbms_stats.gather_database_stats.

  • "shuffle" the data in a table...

    Hello world...

    Pleade help me solve this problem.

    Is it possible to combine the data in a table?
    Let say if i have a table with following data..
    
    PERSON_ID    PERSON_LAST_NAME        PERSON_FIRST_NAME        DOB
    
       1             Test1                   Test1              01/01/1970
       2             Test2                   Test2              01/01/1971
       3             Test3                   Test3              01/01/1972
       4             Test4                   Test4              01/01/1973
       5             Test5                   Test5              01/01/1974
    
    I am trying to shuffle the above data so that no person will have their
    "real last,first and dob match".
    
    I need the output like this or in any combinations so that no one can
    identify a person actual "last name,first name and dob"
    
    
    PERSON_ID    PERSON_LAST_NAME        PERSON_FIRST_NAME        DOB
    
       1             Test1                   Test2              01/01/1974
       2             Test2                   Test4              01/01/1975
       3             Test3                   Test5              01/01/1971
       4             Test4                   Test3              01/01/1972
       5             Test5                   Test1              01/01/1973
    
    please help me to solve this issue. Thanks in advance

    Hello

    You can do something like this:

    WITH     got_nums     AS
    (
         SELECT     person_id
         ,     ROW_NUMBER () OVER (ORDER BY dbms_random.value)          AS person_id_num
         ,     person_last_name
         ,     ROW_NUMBER () OVER (ORDER BY dbms_random.value)          AS person_last_name_num
         ,     person_first_name
         ,     ROW_NUMBER () OVER (ORDER BY dbms_random.value)          AS person_first_name_num
         ,     dob
         ,     ROW_NUMBER () OVER (ORDER BY dbms_random.value)          AS dob_num
         FROM     table_x
    --     WHERE     ...     -- Any filtering goes here
    )
    SELECT     id.person_id
    ,     ln.person_last_name
    ,     fn.person_first_name
    ,     db.dob
    FROM     got_nums     id
    JOIN     got_nums     ln     ON id.person_id_num     = ln.person_last_name_num
    JOIN     got_nums     fn     ON id.person_id_num     = fn.person_first_name_num
    JOIN     got_nums     db     ON id.person_id_num     = db.dob_num
    ;
    

    This does not guarantee that no column of the same original line will be on the same line of output. I don't think that you really want it.

  • FFT of the data in a table

    I would like to perform an FFT on a digital signal periodic sampling.  For the moment, my signal is stored as an array of 16-bit integers (0-65534) item 8192.

    I tried to connect this table directly at the entrance of the fft.vi X, but the data that comes out of the FFT {X} seem little logic (table length 8192 with spikes, the beginning and the end of it).

    Any advice would be much appreciated.

    Okay, that's better

    The reason why you don't see the desired result of FFT is easy:

    (a) you have a shift of 8000 to your signal. He is peaking at 0.

    (b) your signal includes approximately 2.6 times. Given that the FFT concatenates virtually your signal from - inf to + inf in the time domain, your signal a 'jump' inside that create spikes in your field of frequency 'somewhere '. To prevent this, you can either use windowing or cut the signal of your time domain to contain a whole number of periods (which would then along 6400 samples).

    hope this helps,

    Norbert

  • Save the data in another table

    Hello, I would like someone to help me with a problem I have in my program.
    What makes the program is, for each iteration, take the data in 'table iter' and recorded in "table of output." But in the second iteration instead of storing the results of the first iteration offer me '1' in the first five lines.

    How can I solve this problem?

    Thank you, Jaime

    Hi pescajaime,

    Please make the change mentioned in the attachments.

    Thank you and best regards,

    srikrishnaNF

  • How to get the default path of the data of a table space file

    I used below the sql statement to create a table space:

    CREATE A TABLESPACE DATAFILE AAA BBB SIZE 10 M AUTOEXTEND OFF...

    Notice, I do not give a full path instead of a file name, and then ask questions relevant to tables

    get the full path of the data file, assume that it's path below:

    d:\oracle\...\BBB

    So I don't think that there is a default path that oracle can use it to create the data file. My question

    is how to get this default path before creating a table space.

    Thank you very much.

    Hello

    I did similar simulations for you, then it could be seen easily:

    SQL > Show parameter db_create_file_dest

    VALUE OF TYPE NAME

    ------------------------------------ ----------- ------------------------------

    db_create_file_dest chain

    SQL > SELECT NAME, VALUE OF V$ PARAMETER

    2 where lower (name) = "db_create_file_dest;

    NAME

    --------------------------------------------------------------------------------

    VALUE

    --------------------------------------------------------------------------------

    db_create_file_dest

    It has the value NULL. Then where my datafile is going?

    SQL > create tablespace TEST datafile 'test01.dbf' size 10 M;

    Created tablespace.

    SQL > select file_name

    2 of dba_data_files

    3 where nom_tablespace = 'TEST ';

    FILE_NAME

    --------------------------------------------------------------------------------

    /U01/app/Oracle/product/12.1.0/Db_1/DBS/Test01.dbf

    When you check the alert logs, it will not show you the location of the data file. It will tell you what exactly you ran.

    ..

    ..

    Completed: drop tablespace test whose content and data files

    create tablespace datafile 'test01.dbf' size 10 M TEST

    Completed: create tablespace TEST datafile 'test01.dbf' size 10 M

    ..

    ..

    You can not SQL user * more? Well, I would say that, when you run the CREATE TABLESPACE command, is where you run the command:

    SQL > select file_name

    2 of dba_data_files

    3 where nom_tablespace = 'TEST ';

    FILE_NAME

    --------------------------------------------------------------------------------

    /U01/app/Oracle/product/12.1.0/Db_1/DBS/Test01.dbf


    So, you should get the location of your data file. Alternatively, you can run the query in the parameter $ v so that you know your default data file location.

    I hope this helps.

    Thank you.

    Kind regards

    Gaetan

  • loading the data into a table

    Hi master,

    I have to use sql loader...!

    The client gave the data format below.

    ****************************************************

    21, 1-Oct-2010, 31-Oct-2010, 49573, 33048, 1000, 11860

    33048 21, 1-Nov-2010, 30-Nov-2010, 49573, 1000, 9408

    1000 21, 1-Dec-2010, 31-Dec-2010, 49573, 33048,

    33048 21, jan-1-2011, 31-Jan-2011, 49573, 1000, 8520

    When I loaded through Sql loader with TOAD...

    I get lines like this...

    ************************************

    21, 1-Oct-2010, 31-Oct-2010, 49573, 33048, 1000, 11860

    TECOM Business Group,

    33048 21, 1-Nov-2010, 30-Nov-2010, 49573, 1000, 9408

    TECOM Business Group,

    21, 1-Dec-2010, 31-Dec-2010, 49573, 33048, 1000, TECOM Business Group.

    33048 21, jan-1-2011, 31-Jan-2011, 49573, 1000, 8520

    TECOM Business Group,

    There are so many (more than 50 columns) columns in my table.

    Please advise...!

    AR

    You can declare the empty fields as fields of FILLING.

    Scott@orcl12c > t DESC

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    COL1                                               NUMBER

    COL2                                               DATE

    COL3                                               DATE

    COL9                                               NUMBER

    Scott@orcl12c > a.ctl TYPE of HOST

    load data

    INFILE *.

    in the t table truncate

    fields ended by ',' possibly framed by "" "

    TRAILING NULLCOLS

    (

    col1,

    col2 DATE 'DD_MON-YYYY. "

    COL3 DATE 'DD_MON-YYYY. "

    COL4 FILLER,

    col5 FILLER,

    col6 FILLER,

    col7 FILLER,

    COL8 FILLER,

    col9

    )

    BEGINDATA

    33048 21, 1-Oct-2010, 31-Oct-2010, 49573,

    33048 21, 1-Nov-2010, 30-Nov-2010, 49573,

    Scott@orcl12c > HOST SQLLDR scott/tiger CONTROL = a.ctl LOG = a.log

    SQL * Loader: release 12.1.0.1.0 - Production on Sun Feb 2 10:23:28 2014

    Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

    Path used: classics

    Commit the point reached - the number of logical records 2

    Table T:

    2 rows loaded successfully.

    Check the log file:

    a.log

    For more information on the charge.

    Scott@orcl12c > select * from t

    2.

    COL1 COL2 COL3 COL9

    ---------- --------------- --------------- ----------

    21 Friday, October 1, 2010 Sunday, October 31, 2010 33048

    21 Monday, November 1, 2010 on Tuesday, November 30, 2010 33048

    2 selected lines.

  • How to find the date of a table Max

    Hello world

    I have two tables in the database. I want to find the maximum routine for a case_id of the lock_date date between jan 20 to January 29, 2012.

    But I don't get real output (output routine_date should be 'January 28, 2012' but I m getting "January 31, 2012" ")

    Can someone help me where I made the mistake


    Master
    case_id lock_date
    101 23 January 2012
    101 January 24, 2012
    102 27 January 2012
    102 January 29, 2012
    101 30 January 2012
    101 January 29, 2012

    Routine (for current work)
    case_id routine_date
    101 23 January 2012
    103 28 January 2012
    102 21 January 2012
    102 January 29, 2012
    101 21 January 2012
    101 28 January 2012
    101 31 January 2012


    Select m.case_id, r.routine_date from master m, systematic r,
    (case_id, max (routine_date) of the systematic group by selecting case_id) rr

    where m.case_id = r.case_id
    and m.case_id = rr.case_id
    and r.routine_date = rr.routine_date

    Hello

    Here are average dradles:

    WITH     universe  AS
    (
         SELECT    m.case_id
         ,        r.routine_date
         ,       MAX (r.routine_date)     OVER (PARTITION BY  m.case_id)
                         AS max_routine_date
         FROM       master       m
         ,        routine       r
         WHERE        m.case_id       = r.case_id
         AND       m.lock_date       >= TO_DATE ('20-Jan-2012', 'DD-Mon-YYYY')
         AND       m.lock_date       <  TO_DATE ('30-Jan-2012', 'DD-Mon-YYYY')
    )
    SELECT       case_id
    ,       routine_date
    FROM       universe
    WHERE       routine_date     = max_routine_date
    ;
    

    You only want to view rowss whose routine_date is the maximum date in a subset. First get this subset
    If the universe of data that you are interested in is just the period from January 20 to January 29, then you can start by getting all the data in this range. This is what the above subquery universe.
    Now, you want to see only the rows where routine_date is the max_routine_date within this universe, for each case_id. You can use the analytic MAX function to find out what this max_routine_date.
    Published by: Frank Kulash, March 2, 2013 11:59

  • display the data in two tables.

    Hi considers the following data
    WITH table1 AS
    (
      SELECT 111 userid,  To_Date('7/31/2010','mm/dd/yyyy') dt  FROM dual UNION ALL
      SELECT 111 userid,  To_Date('8/1/2010','mm/dd/yyyy') dt  FROM dual UNION all
      SELECT 111 userid,  To_Date('8/2/2010','mm/dd/yyyy') dt FROM dual UNION ALL
      SELECT 111 userid,  To_Date('8/3/2010','mm/dd/yyyy') dt  FROM dual UNION ALL
      SELECT 111 userid,  To_Date('8/4/2010','mm/dd/yyyy') dt FROM dual UNION ALL
      SELECT 111 userid,  To_Date('8/5/2010','mm/dd/yyyy') dt  FROM dual UNION ALL
    
      SELECT 222 userid,  To_Date('2/28/2010','mm/dd/yyyy') dt  FROM dual UNION all
      SELECT 222 userid,  To_Date('3/5/2010','mm/dd/yyyy') dt  FROM dual UNION all
    
    ),
     mydates AS
    (
     SELECT To_Date('7/31/2010','mm/dd/yyyy') dt1, To_Date('8/4/2010','mm/dd/yyyy') dt2 FROM dual  UNION ALL 
     SELECT To_Date('2/28/2010','mm/dd/yyyy') dt1, To_Date('3/5/2010','mm/dd/yyyy') dt2 FROM dual 
    )
    I want to join these two tables and result the following
    DT        DT2
    7/31/2010 8/04/2010
    8/01/2010  8/01/2010
    8/02/2010  8/02/2010
    8/03/2010  8/03/2010
    8/04/2010  8/04/2010
    8/05/2010  8/05/2010
    
    2/28/2010  3/5/2010
    3/5/2010   3/5/2010
    Basically, I join two tables, take dt from table1 and look into mydates. If the data match then display dt and DM2.
    If the date in table1 does not match date in t1d in mydates, then display the data but dt and DM2 there same date.

    for example,.

    7/31 in table1 is 7/31 in mydates so I show 7/31 dt and DM2 as 8/4(from mydates).
    now 8/01 does not match all lines in my dates so dt should be 8/01 and T2D should be 8/01. same logic applies to the other lines

    can someone write a query that gives the above result? Thank you

    Hello

    If you want all lines of table1 (attached to mydates when this is possible, but even when there is no match) then use an outer join:

    SELECT     t.dt
    ,     NVL (m.dt2, t.dt)     AS dt2
    FROM          table1     t
    LEFT OUTER JOIN     mydates     m     ON     t.dt     = m.dt1
    ORDER BY     t.dt
    ;
    
  • Storage of the data in a table problem

    Hi guys,.

    I have the following schema:

    < xsd: element name = "Details" type = "DetailsType" / >
    < xsd: complexType name = "DetailsType" >
    < xsd: SEQUENCE >
    < xsd: element name = "count" type = "xsd: Integer" / >
    < xsd: element name = "loop" type = "xsd: Integer" / >
    < xsd: element name = "test" type = "xsd: Integer" / >
    < xsd: element name = "test2" type = "xsd: String" / >
    < xsd: element name = "test3" type = "xsd: String" / >
    < xsd: element name = "ReceiptArr" type = "xsd: String" maxOccurs = "unbounded" / >
    < / xsd: SEQUENCE >
    < / xsd: complexType >

    where I said ReceiptArr in a table.

    I try to copy the data in the table, but it does not work.

    I want the data to be like that

    ReceiptArr [1] = 12345
    ReceiptArr [2] = 23456
    ReceiptArr [3] = 78900
    .
    .
    .
    etc.


    Here is my statement copy of bpel


    < copy >
    < expression = "ora:getNodes ('receiveInput_Get_InputVariable', 'CashReceipt', concat ('/ ns2:CashReceipt / ns2:Detail [', bpws:getVariableData('DebtorVar','/ns9:Details/ns9:loop'),'. / ns2:receipt_number'))" / >
    < variable = "DebtorVar."
    Query = "Concat ('/ NS9:Details / NS9:ReceiptArr [', bpws:getVariableData('DebtorVar','/NS9:Details/NS9:loop'),']')" / >
    < / copy >

    and it fails, does anyone know how I can complete my table in bpel?

    Thank you
    K

    Hello
    I had to do in the past, and this is the approach I used. Create two variables, one for a number of records and the other as an index of the loop. The index of the loop the value 1 and get a number of nodes in the xml data in the entry for the second variable. Then the loop through the input xml data while the loop index is less than the record number, set the value of your table and incrementing the index of the loop, the use of brackets around the loop index (i.e. open close bpws:getVariableData('Variable_loopIndex') of the angle. I see that when I post this message, this part of the code is eating, and in my browser at least when I replace the ASCII for support, it is displayed instead of the media.

    There might be better ways to address the issue, but it worked for my process. I have not tested the below with your types to xml schema, but here's an example of how this can stand as a model using my code:











    condition = "bpws:getVariableData('Variable_loopIndex') < = bpws:getVariableData('Variable_recordCount')" > "

              


    Query = "/ ns2:CashReceipt / ns2:Detail / ns2:receipt_number [bpws:getVariableData('Variable_loopIndex')]" / > ""

    Query = "/ ns9:Details / ns9:ReceiptArr [bpws:getVariableData('Variable_loopIndex')]" / > ""









    Hope this helps
    Candace

    Published by: cmcavaney on June 25, 2009 08:26

Maybe you are looking for