Select from 4 tables but include data from 3 even if 4th is null

Hello -
I'm quite new to oracle and apex, but enjoying learning - but sometimes I need a gentle nudge to know what I need to learn about.
I have a select statement that works - selecting specific columns from 3 tables:
SELECT
"TERRITORIES"."TER_NAME" "TER_NAME",
"TERRITORY_TYPES"."TTP_DESCRIPTION" "TTP_DESCRIPTION",
"COUNTRIES"."CNT_DESCRIPTION" "COUNTRY"
FROM
"TERRITORIES", "TERRITORY_TYPES","COUNTRIES"
WHERE
"TERRITORIES"."TER_TTP_ID"="TERRITORY_TYPES"."TTP_ID"
and
"COUNTRIES"."CNT_TER_ID"="TERRITORIES"."TER_ID"
I want to add in a 4th table for, you guessed it, States.
However, many of the countries do not yet have states in the states table (and may never have any). Therefore, they do not appear in the results. I want them included in the query, so that I'll have the opportunity to add in the data via Apex.
Is there a phrase I can insert in the 1st query so that I'll get data for Territory Type, Territory and Country, even if the State table is null?
Or, do I need to insert records into the state table, such as: insert into states (state_ID, STATE_CNT_ID) values (state_seq.nextval,2). If so, do I just do that over and over, replacing the value? Or is this where I need to learn about bind variables? Or some other command?
Thank you-
Marion in NY
Edited by: mtpaper on Oct 24, 2009 12:54 PM
I FIGURED IT OUT! I DID IT! How do I mark myself as helpful???
insert INTO states
(state_ID, STATE_CNT_ID)
SELECT state_seq.nextval, cnt_id
FROM countries
WHERE not exists (select * from states where states.state_cnt_id = countries.cnt_id)
Edited by: mtpaper on Oct 24, 2009 1:10 PM

You certainly could insert data into the STATES table, but I generally wouldn't advise inserting rows into a STATES table for states that don't actually exist. It would seem to make far more sense to just do an outer join when you include the STATES table in your query
SELECT "TERRITORIES"."TER_NAME" "TER_NAME",
       "TERRITORY_TYPES"."TTP_DESCRIPTION" "TTP_DESCRIPTION",
       "COUNTRIES"."CNT_DESCRIPTION" "COUNTRY",
       s.state_name
  FROM TERRITORIES t ,
       TERRITORY_TYPES tt,
       COUNTRIES c,
       states s
WHERE "TERRITORIES"."TER_TTP_ID"="TERRITORY_TYPES"."TTP_ID"
   and "COUNTRIES"."CNT_TER_ID"="TERRITORIES"."TER_ID"
   and c.cnt_id = s.state_cnt_id(+)The {noformat}(+){noformat} operator indicates that you want to do an outer join. So if there is no row in the STATES table that matches the join condition, a NULL is returned.
From a purely stylistic standpoint, I would generally suggest using aliases (i.e. the T, TT, C, and S in the FROM clause) rather than having to constantly write out all the table names. And I wouldn't suggest putting double-quotes around everything-- that forces all your identifiers to be upper case and case sensitive.
Justin

Similar Messages

  • Populate a table reading the data from a TXT file

    how can I populate a table reading the data from a TXT file?
    thanks

    Hey Kevin!
    Using FORMS.TEXT_IO to bulk load data from a file strikes me as re-inventing the wheel. It is just about justifiable in a self-service environment, but I regard the EXTERNAL TABLE is a better solution for that situation as well.
    The same applies to UTL_FILE. I think the ability to read text with UTL_FILE is primarily intended for read file-based configuration or file manipulation/processing rather than data loading.
    Re-writing a text file into SQL statements is too much like hard work (even with an editor that supports macro definition and regular expressions) for no real benefit. You lose all the bulk load peformance you would get from SQL*Loader. But for QAD I'd probably let you off with it.
    You missed out one obvious alternative: using Java to turn the contents of an XML file into a CLOB and inserting it into a table which is read by a PL/SQL procedure that parses the XML records and insert the retrieved data into a table.
    Stay lucky, APC

  • How can I join 3 tables while extracting data from SAP R/3?

    I have 3 tables with the following columns
    Emp table (emp)
      emp_id
      emp_name
      emp_add
    Dept table (dept)
      dept_id
      dept_name
      dept_loc
    Location table (loc)
      loc_id
      loc_name
    Now. If I want to select data from loc_id = 10 and emp_id between 2000 and 3000
    How to join these three tables while extracting data from R/3
      join condition
       loc.loc_id = dept.loc_id
    and dept.dept_id = emp.dept_id
    and loc.loc_id =10
    and emp.emp_id between 2000 and 3000.
    Could any one let me know the procedure to extract this data into BW system.

    Hi,
    shouldn't your join condition be:
    loc.loc_id = dept.DEPT_LOC
    and dept.dept_id = ??
    If you can join the three tables then create a generic datasource (RSO) based on a view (create your view with your join in SE11).
    Enable the loc_id and the emp_id as selectable in the datasource so you can then select the values from a BW IPack.
    hope this helps...
    Olivier.

  • When target DB is down in which table is the data from source is stored, also where are the error messages stored in ODI

    When target DB is down in which table is the data from source is stored, also where are the error messages stored in ODI( I am not getting any error message in E$_TARGET_ANI_TEST).
    When i am running the interface i am getting the below error against the errored step
    "ORA-01045: user ABC lacks CREATE SESSION privilege; logon denied."
    Only E$_TARGET_ANI_TEST  is created with no data. No such tables like C$_0TARGET_ANI_TEST, I$_TARGET_ANI_TEST are created and also data is not inserted in the target table TARGET_ANI_TEST.

    Hi,
    I have checked that only E$ table is created. C$ and I$ table are not created ( I have selected my target schema as the part for the staging table).
    All the parameters for dropping the tables are selected as "<default>:false".
    I am importing the following KMs with the following parameters:
    1) CKM Oracle
    DROP_ERROR_TABLE
    :false
    DROP_CHECK_TABLE
    :false
    CREATE_ERROR_INDEX
    :true
    COMPATIBLE
    :9
    VALIDATE
    :false
    ENABLE_EDITION_SUPPORT
    :false
    UPGRADE_ERROR_TABLE
    :false
    2) LKM SQL to SQL
    DELETE_TEMPORARY_OBJECTS
    :true
    3) IKM SQL Incremental Update
    INSERT
    :true
    UPDATE
    :true
    COMMIT
    :true
    SYNC_JRN_DELETE
    :true
    FLOW_CONTROL
    :true
    RECYCLE_ERRORS
    :false
    STATIC_CONTROL
    :false
    TRUNCATE
    :false
    DELETE_ALL
    :false
    CREATE_TARG_TABLE
    :false
    DELETE_TEMPORARY_OBJECTS
    :true 

  • Dynamic Internal Table for reading data from external file

    Hello All,
    The task was to create a internal table with dynamic columns,
    Actually this is my first task in the WebAS 6.20, my program is based on input file provided by user with certain effort. this file can have different effort for a one yr to five year frame..
    I needed to read the raw data from file, based on months create a internal table to hold the data, after this i need to validate the data...
    I have browsed thru dynamic internal table topic, but couldn't find any dynamic appending structure, the dynamic structure would contains 12 month fileds.
    can any one help me in getting my task completed..
    Thanks
    Kumar

    Hi,
    I see that you posted the same question a couple of days ago at Dynamic Internal Table for reading data from external file Didn't Charles's response address your problem?
    Regards

  • I dont have data in "Client status summary" report for servers in server collection, but get data from our Windows 7?

    Hi,
    I dont have data in "Client status summary" report for servers in server collection, but get data from our Windows 7?
    So and idea of way I dont get data from or servers? Missing client setting for servers?
    /SaiTech

    Hi,
    I do see the server in Server collections in "Monitoring--Client Status--Client Activity" but not in reports like "Clients with failed client check details" i get "No Data Available"?
    /SaiTech

  • 3.1EA2 simple table copy including data - gives error

    hi
    3.1EA2 simple table copy including data - results in error-message "Ora-01403 data not found Ora-06512 line 1 ....."
    ..... copy failed
    although the copy did succeed and the table including data was copied.
    regards Karsten

    Hi Brian,
    3.1EA2 shows a little bit improvement on the copy paste from grid.
    However, these are another cases which I found :
    1. This happens everytime
    -invoke any select
    select sysdate
    from dual;
    - leave the cursor position on after semicolon
    - copy and paste the grid result, unto worksheet, so it will become like this
    select sysdate
    from dual;17-NOV-2011 10:42:29
    - now, again copy the grid result using (ctrl + C)
    - the selection on grid suddenly loose its focus (the yellow rectangle is disappear), instead the cursor on SQL worksheet makes selection.
    - therefore the clipboard does not store the grid value
    2. Intermittently, usually happens on the third attempts
    - invoke any select
    - copy and paste any cell into worksheet, press Enter
    - copy and paste different cell into worksheet, press Enter
    - copy and paste another different cel into worksheet, press Enter
    - you'll notice the copy does not copy the correct value
    - the workaround for this problem is to press Ctrl + C several times on the cell before pasting.
    Regards,
    Buntoro

  • Deleting rows from table based on value from other table

    Hello Members,
    I am struck to solve the issue said below using query. Would appreciate any suggestions...
    I have two tables having same structures. I want to delete the rows from TableA ( master table ) with the values from TableB ( subset of TableA). The idea is to remove the duplicate values from tableA. The data to be removed are present in TableB. Catch here is TableB holds one row less than TableA, for example
    Table A
    Name Value
    Test 1
    Test 1
    Test 1
    Hello 2
    Good 3
    TableB
    Name Value
    Test 1
    Test 1
    The goal here is to remove the two entries from TableB ('Test') from TableA, finally leaving TableA as
    Table A
    Name Value
    Test 1
    Hello 2
    Good 3
    I tried below queries
    1. delete from TestA a where rowid = any (select rowid from TESTA b where b.Name = a.Name and a.Name in ( select Name from TestB ));
    Any suggestions..
    We need TableB. The problem I mentioned above is part of process. TableB contains the duplicate values which should be deleted from TableA. So that we know what all values we have deleted from TableA. On deleted TableA if I later insert the value from TableB I should be getting the original TableA...
    Thanks in advance

    drop table table_a;
    drop table table_b;
    create table  table_b as
    select 'Test' name, 1 value from dual union all
    select 'Test' ,1 from dual;
    create table table_a as
    select 'Test' name, 1 value from dual union all
    select 'Test' ,1 from dual union all
    select 'Test' ,1 from dual union all
    select 'Hello' ,2 from dual union all
    select 'Good', 3 from dual;
    /* Formatted on 11/23/2011 1:53:12 PM (QP5 v5.149.1003.31008) */
    DELETE FROM table_a
          WHERE ROWID IN (SELECT rid
                            FROM (SELECT ROWID rid,
                                         ROW_NUMBER ()
                                         OVER (PARTITION BY name, VALUE
                                               ORDER BY NULL)
                                            rn
                                    FROM table_a a
                                   WHERE EXISTS
                                            (SELECT 1
                                               FROM table_b b
                                              WHERE a.name = b.name
                                                    AND a.VALUE = b.VALUE))
                           WHERE rn > 1);
    select * from table_a
    NAME     VALUE
    Test     1
    Hello     2
    Good     3Edited by: pollywog on Nov 23, 2011 1:55 PM

  • Hi, i've a iphone 5s and i wanted to know that I bought my iphone from india but it came from usa but i have an indian bill will it be covered in warranty, like if i go to the apple service centre?

    Hi, i've a iphone 5s and i wanted to know that I bought my iphone from india but it came from usa but i have an indian bill will it be covered in warranty, like if i go to the apple service centre?

    If it was originally sold in the U.S, then the warranty is only good in the U.S

  • I have recently purchase a iphone4 from market but its lock from at

    I have recently purchase a iphone4 from market but its lock from at&t can I unlock the same because its useless for me and also my money also waste for the same
    i can got unlock code from apple if its
    Chargeable so I am ready to pay

    Only the carrier can unlock it.  AT&T will not unlock an iPhone.  You need to return your iPhone and buy an unlocked one.

  • Selecting from Multiple Tables but requiring data to match from a 3rd table

    Hello Everyone,
    I'm having alot of trouble with this select
    I have three tables:
    prod_poured, conc_test, and cyl_breakTo put together my report, I need to grab this data:
    cyl_break.pour_no "Pour Number", cyl_break.cyl_id "Cylinder ID", cyl_break.pour_d "Pour Date", conc_test.mix "Mix #", conc_test.amb_t "Ambient Temperature", conc_test.conc_t "Concrete Temperature", conc_test.air "Air %", cyl_break.break_d "Break Date", cyl_break.age "Age (Days)", cyl_break.spec_str "Specified Strength", cyl_break.str "Specimen Strength"and I need it to grab all data in those two tables when one column in the prod_poured table meets a certain condition
    This is what I have so far:
    select cyl_break.pour_no "Pour Number", cyl_break.cyl_id "Cylinder ID", cyl_break.pour_d "Pour Date", conc_test.mix "Mix #", conc_test.amb_t "Ambient Temperature", conc_test.conc_t "Concrete Temperature", conc_test.air "Air %", cyl_break.break_d "Break Date", cyl_break.age "Age (Days)", cyl_break.spec_str "Specified Strength", cyl_break.str "Specimen Strength"
    from conc_test inner join cyl_break on conc_test.pour_no = cyl_break.pour_no, prod_poured
    where conc_test.pour_no = prod_poured.test_id and prod_poured.job_no = '9-12-821';It gives me the right results but wayyy too many of them so obviously I've got something wrong.
    the results it gives are this:
    Pour Number     Cylinder ID     Pour Date     Mix #     Ambient Temperature     Concrete Temperature     Air %     Break Date     Age (Days)     Specified Strength     Specimen Strength
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100324A     100324A3     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     51.9
    100324A     100324A3     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     51.9
    100324A     100324A3     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     51.9
    100324A     100324A3     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     51.9
    100324A     100324A4     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     50.8
    100324A     100324A4     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     50.8
    100324A     100324A4     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     50.8
    100324A     100324A4     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     50.8
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49
    100324E     100324E3     24-MAR-10     10     10     15     6     21-APR-10     28     35     50.7
    100324E     100324E3     24-MAR-10     10     10     15     6     21-APR-10     28     35     50.7
    100324E     100324E3     24-MAR-10     10     10     15     6     21-APR-10     28     35     50.7
    100324E     100324E3     24-MAR-10     10     10     15     6     21-APR-10     28     35     50.7
    100324E     100324E3     24-MAR-10     10     10     15     6     21-APR-10     28     35     50.7
    100324E     100324E4     24-MAR-10     10     10     15     6     21-APR-10     28     35     51.6
    100324E     100324E4     24-MAR-10     10     10     15     6     21-APR-10     28     35     51.6
    100324E     100324E4     24-MAR-10     10     10     15     6     21-APR-10     28     35     51.6
    100324E     100324E4     24-MAR-10     10     10     15     6     21-APR-10     28     35     51.6
    100324E     100324E4     24-MAR-10     10     10     15     6     21-APR-10     28     35     51.6The results I need it to give are this:
    100322A     100322A3     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.6
    100322A     100322A4     22-MAR-10     10     16     16     4.2     19-APR-10     28     35     50.4
    100324A     100324A3     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     51.9
    100324A     100324A4     24-MAR-10     10     9     15     5.8     21-APR-10     28     35     50.8
    100324E     100324E3     24-MAR-10     10     10     15     6     21-APR-10     28     35     50.7
    100324E     100324E4     24-MAR-10     10     10     15     6     21-APR-10     28     35     51.6
    100326B     100326B3     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     48.3
    100326B     100326B4     26-MAR-10     10     9     15     5.7     23-APR-10     28     35     49As you can see my query provides the right results, just way too many of them. I only need to have one result per cylinder id.
    I can't seem to wrap my mind around this one and if somebody could put together a proper select based on what I need that would be extremely helpful. If you need any more data to provide help just ask and I'll paste it.
    Thanks,
    dtr
    Edited by: dtr on Apr 26, 2010 11:12 AM

    dtr wrote:
    Hi,
    Here are the create table statements:
    create table conc_test
    (p_date date, job_no varchar, mix varchar, pour_no varchar, amb_t varchar, conc_t varchar, slump varchar, air varchar, density varchar, cyl_cast_time timestamp)
    create table cyl_break
    (job_no varchar, pour_no varchar, cyl_id varchar, pour_d varchar, break_d varchar, age varchar, spec_str varchar, str varchar, mix);
    create table prod_poured
    (prod_id varchar, pour_id varchar, test_id varchar);
    Great!
    Don't forget to post the INSERT statements, and the output from that data (if it is different from what you posted in your first message).
    Basically I need to pull the data I showed above out of conc_test and cyl_break, but only data that has the proper job_number which is retrieved from the prod_poured table. The prod_poured test_id for everything that has the proper prod_poured job_no So an IN-subquery, like Sudhakar and I suggested, should work.
    What was the problem when you tried them? Post the query you ran, even if you just copied and pasted it from this thread: there may have be an editing error.
    prod_poured test_id is the same thing as conc_test pour_no and cyl_break pour_noExactly! But that doesn't answer the question: Is that value unique in all the tables? If not, in which tables can it be duplicated?

  • Deny user from seeing/selecting from tables but allow access to certain view

    Need some assistance. I have a database on SQL Server 2008 R2. Using windows authentication and a custom group, I control who can access the database and serve up the data via a web application.
    I now have a requirement to allow users to connect to the data using Power Pivot, but do not want to allow users to see all tables/views, I want explicitly control what they see.
    How do  I lock everything down so that users can still view the data from a defined view but limit access to the other tables and views ?
    In essence, my users should not be able to see/select from any of the tables or views except for a specific view that I want them to have access to.
    Thanks

    If the View and the Table are in the same database and have the same owner, then a user who has SELECT permission on the View does not require any permissions on the table.
    See
    Ownership Chains
    David
    David http://blogs.msdn.com/b/dbrowne/
    http://blogs.msdn.com/b/dbrowne/

  • Select data from table depending on date range

    i have first table with following data, This is calender for a year
    I have 2nd table , user created period from 1st table
    I want to select acctstartdate from 1st tale which are not within 2nd table period.
    I want to select acctstartdate as jan to aug only. I dont want to select acctstartdate for sept and oct-dec.
    Same with acctenddate. I want to select Jan-aug only
    How to do this ??
    h2007

    Do you mean this?
    SELECT *
    FROM Table1 t1
    WHERE NOT EXISTS (SELECT 1
    FROM Table2
    WHERE ACCTYRID = t1.ACCTYRID
    AND ACCTYR = t1.ACCTYR
    AND (t1.ACCTSTARTDATE BETWEEN ACCTSTARTDATE AND ACCTENDDATE
    OR t1.ACCTENDDATE BETWEEN ACCTSTARTDATE AND ACCTENDDATE
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • SQL Select Performance - Approached to fetch data from big table

    Hi
    I just wanted to know view on different approached to fetch data from a table which has 40 billion records and which joined to another table which has 1 million record.
    e.g.
    I have two tables TableA and TableB
    TableA has 40 Billion records has 6 columns
         TableA has partitions on Date
         TableA has required indexes
    TableB has 1 Milluion record and has 10 columns
         Table A has indexes
    Now I have written query like
    select distinct TableA.column1,TableA.column2,TableB.columnA
    FROM TableA join TableB
    ON TableA.Column1=TableB.Column2
    WHERE TableA.DateColumn between StartDate and EndDate
    for a given date range it will fetch 5 billion of records which takes around 40 minutes.
    I just wanted to know what all tuning approaches I can follow. What would be the best approach to make record retrieval faster in such a scenario.
    Just wanted to know your vies/experience in such a scenario

    Sufficiently large array fetchsize
    and,
    possibly using parallel query,
    pop into my mind.
    I would be interested though in the business requirement that asks for you to write a program that gets 5 billion (!) rows out of the database...

  • Using SELECT INTO statement to transfer data from one DB to another?

    Hello,
    I need to move data from an SAP table to another downstream SQL server box without flat file in between. I have set up the DBCON interface, so that my ABAP code on SAP can connect to the remote SQL Server, then I can run INSERT command as Native SQL inside the ABAP.
    However, INSERT has performance problem. The best performer as I can find is SELECT INTO statement. But then I am stuck at how to use SELECT INTO to query my local SAP table and send (via INTO) to remote database. I am not even sure whether I should use Open SQL or Native SQL.
    Any suggestion? BTW, I understand the limitation of Native SQL, but we are OK to use it.
    Thanks!

    It appears that this is some kind of migration project due to the scope of the data contained in the single file? If so whatever you do is like ly to be trow away once the migration of data is completed.
    You have a couple of options:
    1) Get the data extracted from HFM in multiple files instead of one bulk file, broken down by scanario,year & period
    2) Take the single data dump file produced by FDM and manipulate it yourself to get the data in a more usuable format for processing through FDM.
    Option 2 could be achieved via any ETL tool or a custom file parsing script. What may be more attractive to you and allow you to fully leverage your investment in FDM is that you could use the PULL adapter that ships as part of the FDM adapter suite to perform this transformation exercise. The PULL adapter takes a flat file input and allows you to use all the in built functionality of FDM to transform it and output a modified flat file (or series of flat files). You could use it to produce multioload files or a series of files broken down by scenario,year,period.
    Whatever you do I would suggest that break the single data file down into smaller chunks as this will help with the iterative debugging process you will inevitably have to undetake whislt migrating the data to the new application.

Maybe you are looking for

  • Bluetooth broken? I have a fix.

    Bluetooth is still broken in version 4.0.0.19550.  Not surprising.  Thankfully, unlike previous versions of Skype, there is a way to make Skype THINK it's a professional app in this version!  You heard it here first, folks!  The Skype Gods really hav

  • Error downloading purchased tv shows.

    This is the error recieve after I "check for purchases" "THERE WAS AN ERROR DOWNLOADING YOUR PURCHASED MUSIC. THE DISK COULD NOT BE READ FROM OR WRITTEN TO. use the check purchases commmand in the advanced menu to try again later." I've upgraded, dow

  • Apex_util.get_blob_file?

    Dears , i want to display the image in sidebar region , i make all steps : 1- add column in the table ( FLAG   blob , FILENAME  varchar2(4000), MIMTYPE  varchar2(4000), FILESIZE   varchar2(4000) )2- create new region html type and but in condition PL

  • Cancellation of Invoice And Taxes

    Hi, SD Gurus Scenario 1 While creating the customer master my client forget to give the account assignment group in the billing tab of the sales area data. Because of this it did not hit the proper G/L Account. Automatically it went to some other  ac

  • IPhoto 11 book order problem

    I have created a Photobook in iPhoto 11 but cannot order the book as the button in the bottom-line seems to be disabled. Checked the Firewall and everything should be ok. The Phozobook was started in iPhoto 8 but completed after upgrading to iPhoto 1