Better way of populating Z-Table....

Hi
I am loading delta from Customer data file to BI DSO & also populating this delta records to some Z-Table (say: Shadow Table) like follows:
1st way)
Loopu2026
  u2026..
  u2026u2026     
MODIFY ZMD_MANUFACTURER FROM WA_SHADOW.
Endloop.
2ND Way) We can also follow this method instead of following above mentioned 1st way as:
Loopu2026u2026
     u2026u2026u2026u2026.
     u2026u2026u2026u2026u2026
     APPEND WA_SHADOW TO ITAB_SHADOW.
ENDLOOP.
MODIFY ZMD_MANUFACTURER FROM TABLE ITAB_SHADOW.
Which is better way in terms of Performance?
Thanks...

Hi Harpal,
The 2nd way should be good in terms of performs and the simple reason behind that is, in first approach everytime you want to update record it will hit to database but in second approach it will hit database only once.
So 2nd approach would be better from perfromance point of view.
Regards,
Durgesh.

Similar Messages

  • A better way than a global temp table to reuse a distinct select?

    I get the impression from other threads that global temp tables are frowned upon so I'm wondering if there is a better way to simplify what I need to do. I have some values scattered about a table with a relatively large number of records. I need to distinct them out and delete from 21 other tables where those values also occur. The values have a really low cardinality to the number of rows. Out of 500K+ rows there might be a dozen distinct values.
    I thought that rather than 21 cases of:
    DELETE FROM x1..21 WHERE value IN (SELECT DISTINCT value FROM Y)
    It would be better for performance to populate a global temp table with the distinct first:
    INSERT INTO gtt SELECT DISTINCT value FROM Y
    DELETE FROM x1..21 WHERE value IN (SELECT value FROM GTT)
    People asking questions about GTT's seem to get blasted so is this another case where there's a better way to do this? Should I just have the system bite the bullet on the DISTINCT 21 times? The big table truncates and reloads and needs to do so quickly so I was hoping not to have to index it and meddle with disable/rebuild index but if that's better than a temp table, I'll have to make do.
    As far as I understand WITH ... USING can't be used to delete from multiple tables or can it?

    Almost, but not quite, as efficient as using a temporary table would be to use a PL/SQL collection and FORALL statements and/or referencing the collection in your subsequent statements). Something like
    DECLARE
      TYPE value_nt IS TABLE OF y.value%type;
      l_values value_nt;
    BEGIN
      SELECT distinct value
        BULK COLLECT INTO l_values
        FROM y;
      FORALL i IN 1 .. l_values.count
        DELETE FROM x1
         WHERE value = l_values(i);
      FORALL i IN 1 .. l_values.count
        DELETE FROM x2
         WHERE value = l_values(i);
    END;or
    CREATE TYPE value_nt
      IS TABLE OF varchar2(100); -- Guessing at the type of y.value
    DECLARE
      l_values value_nt;
    BEGIN
      SELECT distinct value
        BULK COLLECT INTO l_values
        FROM y;
      DELETE FROM x1
       WHERE value = (SELECT /*+ cardinality(v 10) */ column_value from table( l_values ) v );
      DELETE FROM x2
       WHERE value = (SELECT /*+ cardinality(v 10) */ column_value from table( l_values ) v );
    END;Justin

  • Is there any better way for updating table other than this?

    Hi all, I need to update a row in the table that require me to search for it first (the table will have more than hundred thousands of row). Now, I am using a LOV that will return the primary key of the row and put that primary key to DEFAULT_WHERE property in the block and execute query command to fetch the row that need updating. This works fine except that it require 2-query-trip per update (the lov and the execute_query). Is there any better way to doing this? This update is the main objective for my application and I need to use the most effective way to do it since we need to update many records per hour.

    Thanks Rama, I will try your method. Others, how to query row instead of primary key? I thought that querying primary key is faster due to the index?
    BTW, what people do if you need to update a table using Form? I have been using the LOV then execute query since I first developing form. But I am building a bigger database recently that I start worrying about multiple query trip to dbms.
    FYI my table will have up to million rows on it. Each row will be very active (updated) within 1-2 weeks after it creation. After that it will exist for records purposes only (select only). The active rows are probably less than 1% of all the rows.

  • Need help to get alternate or better way to write query

    Hi,
    I am on Oracle 11.2
    DDL and sample data
    create table tab1 -- 1 millions rows at any given time
    id       number       not null,
    ref_cd   varchar2(64) not null,
    key      varchar2(44) not null,
    ctrl_flg varchar2(1),
    ins_date date
    create table tab2 -- close to 100 million rows
    id       number       not null,
    ref_cd   varchar2(64) not null,
    key      varchar2(44) not null,
    ctrl_flg varchar2(1),
    ins_date date,
    upd_date date
    insert into tab1 values (1,'ABCDEFG', 'XYZ','Y',sysdate);
    insert into tab1 values (2,'XYZABC', 'DEF','Y',sysdate);
    insert into tab1 values (3,'PORSTUVW', 'ABC','Y',sysdate);
    insert into tab2 values (1,'ABCDEFG', 'WYZ','Y',sysdate);
    insert into tab2 values (2,'tbVCCmphEbOEUWbxRKczvsgmzjhROXOwNkkdxWiPqDgPXtJhVl', 'ABLIOWNdj','Y',sysdate);
    insert into tab2 values (3,'tbBCFkphEbOEUWbxATczvsgmzjhRQWOwNkkdxWiPqDgPXtJhVl', 'MQLIOWNdj','Y',sysdate);I need to get all rows from tab1 that does not match tab2 and any row from tab1 that matches ref_cd in tab2 but key is different.
    Expected Query output
    'ABCDEFG',  'WYZ'
    'XYZABC',   'DEF'
    'PORSTUVW', 'ABC'Existing Query
    select
       ref_cd,
       key
    from
        select
            ref_cd,
            key
        from
            tab1, tab2
        where
            tab1.ref_cd = tab2.ref_cd and
            tab1.key    <> tab2.key
        union
        select
            ref_cd,
            key
        from
            tab1
        where
            not exists
               select 1
               from
                   tab2
               where
                   tab2.ref_cd = tab1.ref_cd
        );I am sure there will be an alternate way to write this query in better way. Appreciate if any of you gurus suggest alternative solution.
    Thanks in advance.

    Hi,
    user572194 wrote:
    ... DDL and sample data ...
    create table tab2 -- close to 100 million rows
    id       number       not null,
    ref_cd   varchar2(64) not null,
    key      varchar2(44) not null,
    ctrl_flg varchar2(1),
    ins_date date,
    upd_date date
    insert into tab2 values (1,'ABCDEFG', 'WYZ','Y',sysdate);
    insert into tab2 values (2,'tbVCCmphEbOEUWbxRKczvsgmzjhROXOwNkkdxWiPqDgPXtJhVl', 'ABLIOWNdj','Y',sysdate);
    insert into tab2 values (3,'tbBCFkphEbOEUWbxATczvsgmzjhRQWOwNkkdxWiPqDgPXtJhVl', 'MQLIOWNdj','Y',sysdate);
    Thanks for posting the CREATE TABLE and INSERT statments. Remember why you go to all that trouble: so the people whop want to help you can re-create the problem and test their ideas. When you post statemets that don't work, it's just a waste of time.
    None of the INSERT statements for tab2 work. Tab2 has 6 columns, but the INSERT statements only have 5 values.
    Please test your code before you post it.
    I need to get all rows from tab1 that does not match tab2 WHat does "match" mean in this case? Does it mean that tab1.ref_cd = tab2.ref_cd?
    and any row from tab1 that matches ref_cd in tab2 but key is different.
    Existing Query
    select
    ref_cd,
    key
    from
    select
    ref_cd,
    key
    from
    tab1, tab2
    where
    tab1.ref_cd = tab2.ref_cd and
    tab1.key    <> tab2.key
    union
    select
    ref_cd,
    key
    from
    tab1
    where
    not exists
    select 1
    from
    tab2
    where
    tab2.ref_cd = tab1.ref_cd
    Does that really work? In the first branch of the UNION, you're referencing a column called key, but both tables involved have columns called key. I would expect that to cause an error.
    Please test your code before you post it.
    Right before UNION, did you mean
    tab1.key    != tab2.key? As you may have noticed, this site doesn't like to display the &lt;&gt; inequality operator. Always use the other (equivalent) inequality operator, !=, when posting here.
    I am sure there will be an alternate way to write this query in better way. Appreciate if any of you gurus suggest alternative solution.Avoid UNION; it can be very inefficient.
    Maybe you want something like this:
    SELECT       tab1.ref_cd
    ,       tab1.key
    FROM           tab1
    LEFT OUTER JOIN  tab2  ON  tab2.ref_cd     = tab1.ref_cd
    WHERE       tab2.ref_cd  IS NULL
    OR       tab2.key     != tab1.key
    ;

  • Can some one tell me a better way...

    Hi All..
    I work on a web application. I create user ids for people logging into my application. here I have a small problem.. This is what I am currently doing...
    When I create a new user, I assign a new user id to the user and store all hi info.
    All our user ids are stored in User_ID table and user info in User_Info table.
    First I get the max user id from the User_Id table.
    int iuserid = select max(User_ID) from User_ID;
    Then I add ' 1 ' to this and assign it to new user.
    iuserid = iuserid+1;
    insert into User_id values(iuserid, <ssn> );
    Then I store all user info in User_info table..
    insert into User_info(iuserid, <first_name>, <last_name>,...);
    Both these SQLs are executed as a transaction.
    The problem that I have...
    It works fine in a normal environment and in my testing.
    But when the load inceases, before I insert into the User_info, another user tries to get the max User_id from User_ID table, then it conflicts..
    I have seen occurences of User_Info storing the info of a different user against the User_id when many people are accessing the app at the same time.
    Can some one tell me a better way to handle this scenario..
    Appreciate all you help..
    TIA..
    CK

    Hi,
    assuming that the requirement for user_id is only for uniqueness (primary key requirement) not continuosly.
    perhaps can try this,
    1) create a table to keep the max id for each table's key.
    e.g.
    create table key_id_lookup
    key_name char(n),
    current_value number(m)
    where n & m is the size of the field
    2) for each creation of entry in the user_id table, lookup the value in the key_id_table and increment it after retrieval.
    e.g. current_id = select current_value from key_id_lookup where key_name = 'user_id_key';
    current_id+=1;
    update key_id_lookup set current_value = current_id where key_name = 'user_id_key';
    something similar to use of sequence if your database support it.
    3) continue with the creation of record in other tables. now obtain the time stamp of creation and append with the current_id obtained. e.g. timestamp = 132456872; size of m is 5, user_id = 132456872 x 100000 + current_id;
    this should give you a unique key at creation time.
    There should be other better ways of resolving this(like locking the table for the update operation but affect performance, etc), depending on the feature supported by the database in use.
    Hope this can help as last resort if other options not available.

  • A better way to do this ?

    where does the sql stuff excute in the following stored procedure, directly in the database or it goes through the oracle VM first ?
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "CustomExport" AS
    import javax.sql.Connection;
    import oracle.jdbc.OracleDriver;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class CustomExport
    public void do() throws SQLException{
    OracleDriver oracle = new OracleDriver();
    DriverManager.registerDriver(oracle);
    Connection conn = oracle.defaultConnection();
    PreparedStatement st = conn.prepareStatement("select from table where col=?");
    st.setString(1,"value");
    ResultSet rs = st.execute();
    and is there a better way to read and parse an xml document with PL/SQL.what i've read about is the ability to parse an XML file to load its data directly into a database table.What i was looking for was just a way to parse XML without having to load any data into tables so i did it with java.
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "CustomParser" AS
    import javax.xml.prasers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    public class CustomParser
    private static CustomParseHandler handler = new CustomParseHandler();
    public static void parseXMLFile(String fileName) throws FileNotFoundException,IOException,SAXException
    SAXParserFactory saxFactory = SAXParserFactory.newInstance();
    SAXParser parser=saxFactory.newSAXParser();
    parser.parse(new FileInputStream(fileName)),handler);
    private class CustomParseHandler extends DefaultHandler{
    StringBuffer buff;
    public CustomParseHandler()
    this.buff = new StringBuffer();
    public void startElement (String uri, String localName,
    String qName, Attributes attributes)
    throws SAXException
    buff.append("<").append(qName).append(">");
    public void endElement (String uri, String localName, String qName)
    throws SAXException
    buff.append("</").append(qName).append(">").append(newLine);
    public void characters (char ch[], int start, int length)
    throws SAXException
    String fieldName = new String(ch,start,length);
    if(fieldName==null || "".equals(fieldName.trim()))
    return;
    public void clearBuffer(){
    buff.delete(0, buff.length());
    public String getXMLString(){
    return buff.toString();
    }

    PLSQL does not go through Java to access the database. The actual access to the database is via the same mechanism for both, so in some sense, both perform about the same. However, PLSQL datatypes have the same representation as database datatypes so there is no conversion. Java datatypes have different representations than database datatypes so there is a conversion cost associated with moving data between Java and the database.
    If your processing is simple and you are moving a lot of data, PLSQL is likely the better choice. If your processing is more complex and you are moving less data, Java is likely the better choice. There are other things such as portability you should consider, but the amount of data and complexity of the code are the first considerations.
    Douglas

  • A better way to generate the needed XML?

    I am working on a 10.2 system and looking to see if there is a better way to generate the resulting XML than what I have come up with. Here is a test case and the output it generates. I don't really like querying the table for each column needed as the real table has eight columns I am pulling. I would like to make one pass on person_h and get the info needed instead of making eight passes, but not sure if it is possible.
    with person_h as
       (select 1 id, 'M' gender, 'W' race, '170' weight from dual union all
        select 1, 'M', 'W', '170' from dual union all
        select 1, 'M', 'W', '180' from dual union all
        select 1, 'M', NULL, '175' from dual union all
        select 1, NULL, 'W', NULL from dual
    select xmlelement("Person",
             (select xmlagg(xmlelement("Sex", gender))
                from (select distinct gender
                        from person_h
                       where id = 1
                         and gender is not null) pg),
             (select xmlagg(xmlforest(race as "Race"))
                from (select distinct race
                        from person_h
                       where id = 1) pg),
             (select xmlagg(xmlforest(weight as "Weight"))
                from (select distinct weight
                        from person_h
                       where id = 1) pg)
           ).getstringval()
      from dual;
    Output
    <Person>
      <Sex>M</Sex>
      <Race>W</Race>
      <Weight>170</Weight>
      <Weight>175</Weight>
      <Weight>180</Weight>
    </Person>Note: Previously posted on the XML DB forum at A better way to generate the needed XML? but still looking for other solutions so putting in front of more eyes here. I have considered using a WITH statement to do the initial query on person_h but haven't tested that yet to see what Oracle really will do as just getting back around to this lower priority task of mine.

    I'm using the WITH statement to simulate a table and DUAL/UNION ALL to create data in that "table". I've seen it used plenty of times in this forum so not sure why a problem for this example. The actual SQL/XML statement hits that "base table" three times, so I didn't include all eight columns because three columns is sufficient to show the problem in the way I coded the SQL. Following the SQL is the sample OUTPUT that SQL statement generates and that is the output I created and need. I'm just looking for other options to achieve the listed output.

  • A better way to Re-Order the Sort in Pivot view ?

    Hello,
    Question first- Is there a better way to do this?
    Background- Have a simple pivot table w/ requirements to put the Status column in order that makes sense to the business not alphabetical.
    Example, # of Service Req with Status needs to be listed as Assigned, Accepted, Completed, Closed, Re-assigned.
    My solution was to create a column iin table view, use a CASE statement to say when Accepted =1 etc. I then sorted ASC, hid the column in table view and then pivot view I added Status column and hid the new CASE column. I am getting the results I expected but I was wondering if there was a better way to do this?
    Thanks- Neally

    As far as the Presentation Layer is concernd (i.e., in Answers) your way is the best I can think of. The only way you can sort a list of values apart from a way the system could automatically determine (e.g., alphabetically, chronologically, numerically, etc.) is to create your own definition. Without human intervention or customized rules, there is no way any system would know that "C" should come before "S" (as in "Assigned" and "Accepted", or that "O" should come before "L" as in "Completed" and "Closed").
    Since the system knows how to order numbers (e.g., 1,2,3, etc.), it makes sense to create your "rule" (using your CASE statement) to assign each status level to the appropriate "number" in the sequence.
    That's what I would do. The only addition I can add is you could do this in the rpd by adding an "order" column to your LOVs in the table and exposing that as a column in the Presentation Layer. Then you can use that order column as the sort.

  • Looking for a better way to utilize streams to track deletes in the db.

    I'm trying to figure out a way to track deletes in the database using streams. I found that a dml_hander for deletes could satisfy my needs but it appears I would need to create a dml_handler for each table in the schema. Since I have ~250 tables I'm thinking there has to be a better way to do this. I simply need a way to capture all deletes and insert them into a table before they are deleted from the db. Is there a better way then creating a handler for each table?
    Thanks,
    Doug

    So far you haven't posted a version number or any information about the use of any auditing tool, whether FGA or other auditing so it is impossible to either comment or advise you further.
    If you want help you are going to need to do something you did not do in your original post and that is provide a description of your environment, your business rules, how you have attempted to use FGA or standard auditing, etc. Streams is for replication not auditing so perhaps you mean AQ but so far you haven't said that yet either.
    The more information you can provide, and perhaps some code or clear descriptions of what you've attempted, the better the help possible.

  • Looking for a better way to count responses to survey questions

    Hello all - I've created a survey for a site and now want to display the results for the site admins. I am simply trying to display the counts - the number of times a question has been answered a certain way. I realize that I may need to construct the survey itself differently and how it stores the data, but here's how it goes so far.
    There are 10 questions, each with 4 options in radio button groups. The database table has a column for each question and stores the value of the selected radio button. So that's pretty simple.
    Now on the results page this is the only way I can think of doing it, but there has to be a better way. For each response, I create a recordset filtered on the question and option value, then display the total record count. That works just fine, but to count each option, that means 40 recordsets on the page - al to merely determine "How many times was Question 1, Option A selected, and How many times was Question 1, Option B selected, and so on.
    The only other thing I can think of, there perhaps is a better way to count the occurrences of these values in the table either with PHP or in the SQL itself.  Or, perhaps if the values themselves are all numeric and follow some sort of pattern I can use a math solution.
    Any thoughts, solutions and ideas are welcome!  Thanks. 

    THANK YOU!!
    I used this format before actually for an exam in an online training program, and I don't know why I didn't make the connection.
    I also want to connect the responses to the participant, but I think that would even be secondary to the survey itself.
    So just to clarify, if you would, I would have a survey table l like I do now, with each survey generating an ID with each one and perhaps the user info or a column for User ID. Then, the questions table each with an ID to populate the questions, a options table, each with its own ID and linked to the questions that populate the options.
    Finally a responses table that records the Survey ID, Question ID and Option ID with each record.
    In the exam I did before, the questions and responses were in the same table, so I suppose I could make it work that way too. But, now I know why I didn't think of this - unlike the exam where each question was presented one at a time, the survey is on a single page and would require a multiple record insert - which I haven't done as much as single inserts, so it didn't pop into the head.
    L

  • Is there better way to write SQl Insert Script

    I am running out of ideas while working on one scenario and thought you guys would be able to guide me in right way.
    So, the scenario is I have a Table table1 table1(fieldkey, DisplayName, type) fieldkey - pkey   This table have n number of rows. The value of fieldkey in nth row is n. So if we have 1000 record, then the last row has a fieldkey = 1000.
    Below is my sample data.
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1001, 'COfficer',100);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1002, 'PData',100);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1003, 'EDate',100);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1004, 'PData',200);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1005, 'EDate',300);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1006, 'Owner',400);This way of inserting the row with hardcoded value of fieldkey was creating the problem when the same table was used by other developer for their own new functionality.
    So, I thought of using the max(fieldkey) +1 from that table and use it in my insert script. This script file runs every time during software installation.
    I thought of using count to see if the row with same displaytype and type exists in that table or not. If exisits do not insert new row, if not insert new row.
    It looks like i will have to query the count statement everytime before I insert the row.
    select max(fieldkey) +1 into ll_fieldkey from table1
    select count(*) into ll_count from table1 where display ltrim(upper(name)) = 'COFFICER' and type =100)
    if ll_count >0 then
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    ( ll_fieldkey, 'COfficer',100);
    ll_fieldkey := ll_fieldkey +1
    end if;
    select count(*) into ll_count from table1 where display ltrim(upper(name)) = 'PData' and type =100)
    if ll_count >0 then
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    ( ll_fieldkey, 'PData',100);
    ll_fieldkey := ll_fieldkey +1
    end if;
    ... and so on for all the insert statement. So, i was wondering if there is some better way to handle this situation of inserting the data.
    Thank you

    Hi !
    For check if the same display name and type already exists in table i would use Unique Key , but then again instead of if statement you should code some exception handlers. ... Hm .. Unque key is by may opinion better solution as
    codeing checks .
    For faster inserts that is , smaller code .. if there is no rules for values and the values are fixed , in any case you have to do this 100 inserts. If you can "calculate" values then maybe you can figure out some code .. but effect will be the same as hundred insert stetements one after another .. Procedure with this 100 inserts is not so bad solution.
    You can fill with values a nested table and then use forall ... save exceptions insert and with above mentioned UK , maybe this will be better.
    T
    Edited by: ttt on 10.3.2010 13:01

  • Is there a better way to do this with Flash?

    I am new to Flash but am slowly teaching myself via Lynda.com etc
    I have an image that I have added to a website via a content management system and want to make certain areas of that image into links to other sites.
    I found this page that does the kind of thing I want to do, but it appears from looking at the source code that the person who has done this has cut the image up into several sections in order to fit it into a table: http://www3.imperial.ac.uk/staffdevelopment/postdocs1/guidance
    Is there a better way to achieve the same kind of effect using Flash by making ares of an image into links and keeping the image as a whole?

    There are ways to keep the image whole and have portions of it linking to different places both in HTML and in Flash.  In HTML you can use an image map.  In Flash, you can just lay invisible buttons atop the image and use those to link.

  • Better way to change telephone, fax and emails in mass?

    Hi,
    What's the better way to change telephone, fax number and emails in mass in ISU and CRM?
    ADDR_COMM_MAINTAIN and ADDR_PERSONAL_COMM_MAINTAIN functions seems to work fine for ADR2, ADR3 and ADR6.  But it does'nt update telephone in KNA1 and LFA1 tables.

    HI EMANUEL
    We to are Implemen SAP IS u
    could u please help us to configure fact sheets
    in SAP CRM interaction centre....
    Which actually contains object like premise,
    installation,meter etc..
    could you please help out in how to replicate fact sheet
    from SAP IS to SAP CRM ...
    or you suggest any alternative

  • Is there better way?

    Hi! To check which input for the population is lower I used double min and double max. But while loop for counting years is not working. What is better way to do it?
    I'd appreciate any help you can give.
    Thanks.
    Program asks for data on two species and has to respond by telling how many years it will
    take for the species with lower
    population outnumber the species that starts with higher population.
    class SpeciesTry
    private String name1;
    private String name2;
    private int population1;
    private int population2;
    private double growthRate1;
    private double growthRate2;
    public void readInput( )
    System.out.println("What is the first species' name?");
    name1 = SavitchIn.readLine( );
    System.out.println("What is the population of the species?");
    population1 = SavitchIn.readLineInt( );
    while (population1 < 0)
    System.out.println("Population cannot be negative.");
    System.out.println("Reenter population:");
    population1 = SavitchIn.readLineInt( );
    System.out.println("Enter growth rate (percent increase per year):");
    growthRate1 = SavitchIn.readLineDouble( );
    System.out.println("What is the second species' name?");
         name2 = SavitchIn.readLine( );
         System.out.println("What is the population of the species?");
         population2 = SavitchIn.readLineInt( );
         while (population2 < 0)
         System.out.println("Population cannot be negative.");
         System.out.println("Reenter population:");
         population2 = SavitchIn.readLineInt( );
         System.out.println("Enter growth rate (percent increase per year):");
    growthRate2 = SavitchIn.readLineDouble( );
    public void writeOutput( )
    System.out.println("Name of the species' = " + name1);
              System.out.println("Population = " + population1);
              System.out.println("Growth rate = " + growthRate1 + "%");
              System.out.println("Name of the species' = " + name2);
              System.out.println("Population = " + population2);
    System.out.println("Growth rate = " + growthRate2 + "%");
    public void outnumbersPopulation()
    double max=0; double min=0; double minGrowthRate=0; double maxGrowthRate=0;
    String maxName=null; String minName=null;
    int years=0;
    if ((population1<=population2)&(growthRate1<=growthRate2))
    System.out.println("The species " + name1 + " will never outnumber the species " + name2 );
    System.exit(0);
    else if ((population2<=population1)&(growthRate2<=growthRate1))
    System.out.println("The species " + name2 + " will never outnumber the species " + name1 );
    System.exit(0);
    if((population1>population2)&(growthRate1<growthRate2))// this is to determine which population is smaller
    max=population1;
    maxName=name1;
    maxGrowthRate=growthRate2;
    min=population2;
    minGrowthRate=growthRate1;
    minName=name2;
    if ((population2>population1) &(growthRate2<growthRate1))
    max=population2;
    maxName=name2;
    maxGrowthRate=growthRate1;
    min=population1;
    minName=name1;
    minGrowthRate=growthRate2;
    while ( (min <=max) & (years > 0) )
    min= (min +((minGrowthRate/100) * min));
    max=(max + ((maxGrowthRate/100) * max));
    years ++;
    System.out.println("The species " + minName + " will outnumber the species " + maxName +
    " in " + (years+1) + " years");
    public class Species
         public static void main(String[] args)
         SpeciesTry s1= new SpeciesTry();
         s1.readInput();
         s1.writeOutput();
         s1.outnumbersPopulation();
    }

    I'm new to Java and posting. So, here's my program again with outnumberPopulation() method formated. Is there any hope for this program?
    class SpeciesTry
    private String name1;
    private String name2;
    private int population1;
    private int population2;
    private double growthRate1;
    private double growthRate2;
    public void readInput( )
    System.out.println("What is the first species' name?");
    name1 = SavitchIn.readLine( );
    System.out.println("What is the population of the species?");
    population1 = SavitchIn.readLineInt( );
    while (population1 < 0)
    System.out.println("Population cannot be negative.");
    System.out.println("Reenter population:");
    population1 = SavitchIn.readLineInt( );
    System.out.println("Enter growth rate (percent increase per year):");
    growthRate1 = SavitchIn.readLineDouble( );
    System.out.println("What is the second species' name?");
         name2 = SavitchIn.readLine( );
         System.out.println("What is the population of the species?");
         population2 = SavitchIn.readLineInt( );
         while (population2 < 0)
         System.out.println("Population cannot be negative.");
         System.out.println("Reenter population:");
         population2 = SavitchIn.readLineInt( );
         System.out.println("Enter growth rate (percent increase per year):");
    growthRate2 = SavitchIn.readLineDouble( );
    public void writeOutput( )
    System.out.println("Name of the species' = " + name1);
              System.out.println("Population = " + population1);
              System.out.println("Growth rate = " + growthRate1 + "%");
              System.out.println("Name of the species' = " + name2);
              System.out.println("Population = " + population2);
    System.out.println("Growth rate = " + growthRate2 + "%");
       public void outnumbersPopulation()
            double max=0;  double min=0; double minGrowthRate=0; double maxGrowthRate=0;
            String maxName=null; String minName=null;
                    int years=0;
            if( population1>population2)// this is to determine which population is smaller
            {    max=population1;
                maxName=name1;
                maxGrowthRate=growthRate2;
                min=population2;
                minGrowthRate=growthRate1;
                minName=name2;
             else
                    max=population2;
                    maxName=name2;
                    maxGrowthRate=growthRate1;
                    min=population1;
                    minName=name1;
                    minGrowthRate=growthRate2;
           if (minGrowthRate<=maxGrowthRate)
              System.out.println(minName+" will never grow larger than "+maxName);
              return;
             while ( (min <=max) & (years > 0) )
                 min= (min +((minGrowthRate/100) * min));
                   max=(max + ((maxGrowthRate/100) * max));
                               System.out.println("Check" + max + min);
                               years ++;
            System.out.println("The species " + minName + " will outnumber the species " + maxName +
            " in " + (years+1) + " years");
    public class Species
         public static void main(String[] args)
         SpeciesTry s1= new SpeciesTry();
         s1.readInput();
         s1.writeOutput();
         s1.outnumbersPopulation();
    }

  • Populating Fact tables

    Hi,
    First time working on DW. Have got my staging and Dimension table setups.
    About to start working on Fact tables and all examples I see online are using SSIS packages with several lookup tables.
    Is there any reason that this cannot be done using Stored procedure or I have to develop SSIS package to populate fact tables.
    Thanks,

    Hello,
    In fact we are using stored procedure for all our manipulations and populating fact table. The fact table is partitioned and works great with no issues.
    We are calling the stored procedure and PL/SQL procedure from Informatica. I don't find any issue in processing but I feel difficulty in debugging 5000 lines of code.
    If the transformation are simple and it can be handle in stored procedure than you can go for it But SSIS is designed for ETL. 
    In considering maintenance overhead SSIS gives better control over the data flow because business logic and debugging is much easier than doing the same in stored procedure. 
    If you've partitions and properly designed data structures definitely you can think of using SP. 
    -Prashanth

Maybe you are looking for

  • Multiple ipads and Iphone with one apple ID.

    My wife and I share a apple ID for our iPads.  She just got the IPhone 4s. We don't want to share contact. Just apps and music.  Can we still access the same music off itunes?  Any suggestions?

  • Ipod playlists not showing, yet music remains on ipod

    my 160gb ipod classic all of a sudden says no music no playlists no videos etc after a reboot of my imac restarted after installing updates while ipod was left on dock connected to computer. i can see the music on the ipod using ipod access and play

  • Problem when using f:invoke or f:invokeUrl over OBPM Enterprise

    Hi All, I am installing a new environment of Oracle BPM 10.3.1 Enterprise for Weblogic (and using Weblogic Server 10.3.2), and I have creates a small project to test the funcionality of OBPM Tag Library, invoking from custom JSP. However, I test my p

  • Report destype and parameters

    hi, i m running report through following method... but it does take parameters. declare us varchar2(20); pas varchar2(10); ser varchar2(10); begin us := get_application_property(username); pas := get_application_property(password); ser := get_applica

  • Attaching word documents with process intsnace??

    Hi All, Iam using WLI 8.1. One of our reqmqnt is such that we need to attach many word documents with process instances. I believe this is possible using a data type as RawData. Can somebody confirm this?? Thanks, Prashanth Bhat.