How to change table but don't touch SQL using it?

we have old_table (date, key, value1, value2, value3)
where we have values on every key for every day
values are changed very rarely, so we are considering to redesign table to slow changing dimension:
new_table (date_start, date_end, key, value1, value2, value3)
where new record with new date_start + date_end + key entry is added only when values are changed
BUT all SQL which used to query old_table:
SELECT ...
from old_table
where date = date '2010-01-01'
- will not work anymore!
We know one straightforward approach - VIEW based multiplication of rows - which will help to use old SQL:
create table table_new(date_start date, date_end date, key number, value1 number, value2 number, value3 number)
Table created
insert into table_new values(date'2010-01-01',date'2010-01-05',1,1,2,3);
1 row inserted
insert into table_new values(date'2010-01-06',date'2010-01-15',1,11,22,33);
1 row inserted
create or replace view old_table as
select trunc(date_start)+rn as date_, key, value1, value2, value3
from table_new tn
, (select rownum-1 rn from all_tables where rownum < 100) p
where p.rn <= trunc(date_end-date_start)
View created
SELECT *
from old_table
where date_ = date '2010-01-01';
DATE_ KEY VALUE1 VALUE2 VALUE3
01/01/2010 1 1 2 3
SELECT *
from old_table
where date_ = date '2010-01-10';
DATE_ KEY VALUE1 VALUE2 VALUE3
10/01/2010 1 11 22 33
But we dont believe than it is efficient on rowcount about a million.
Is there any approach?
ref cursor, pipelined, something else?
the only one requirement is - OLD SQL with "where date = date '2010-01-01'" should work unchanged.

I don't think that helps because it isn't just that there is a different table, but the queries are different. In hindsight, the way to avoid this problem rather than "fix" it is to isolate your queries into packages and then the application is calling the modified (or overloaded?) function or procedure and the impact is minimized.
If the OP is trying to minimize storage by saving only ranges instead of the data for each and every day, then one solution would be to make the new view generate the values for each day within the range on the fly. (There was a similar question in this forum just this week about generating missing data.) The queries think they are going after the original table because there is in fact a row in the view for each day. But that would (possibly) make sense only if it was storage that was being minimized. I don't think this approach would be as efficient as using the actual date ranges if the data is migrated to such a table. I wasn't clear from the OP what the goal was behind the table change.

Similar Messages

  • How to change table of content font in captivate 6

    Hi There,
    Can somebody please suggest me how to change table of Content Text font English to Arabic in Captivate 6 and which font supports Arabic language.
    Please refer below image, highlighted text font should be changed.
    Looking forward for help.
    Thanks,
    Srikanth

    The weird sliding navigation is Apples pride and joy!
    That TOC allows you to slide between chapters, sections and pages.
    iBooks Authjor was designed to do what it does and what Apple wanted it to do.
    Some things can be changed during the books production,  but the " weird navigation"  is not something you can change to do what you want.
    iBooks Author is does not produce ePubs.. at least not as "ePub" is known from Pages, inDesign etc,.
    If you want what is available in ePubs.. then iBooks Author is not the application to produce it.
    You could drag a section page above chapter on and create an index type page using book marks for links - but whats the point? 
    People using iPads and familiar with iBooksAuthors special way of book presentation.. are quite happy its so easy to use.

  • How to change table content ...

    Hi All,
    Pl. give us soltution for the following :
    1. How to change table content of standard table ?
        (eg. mara content not from MM02.).
    2. How to add field in standard table ?
    waiting reply.
    Yusuf

    Hi  Yusuf,
    Modifying a standard table through a program using SQL statements is highly risky. However if u wish to do it programatically and not through MM02, you have the option of using BAPIs.
    Goto transaction BAPI and through the application hirarchy, goto Material Management section. There i am sure u will find some BAPIs to modify material master and they are the most stable mode of update programatically.
    Hope this helps.
    Regards,
    Aditya

  • I can't open video file in the page , i download and install flash many time but don't work , i use firefox 5 and windows 7

    i can't open video file in the page , i download and install flash many time but don't work , i use Firefox 5 and windows 7

    My current version of Chrome is having problems, too! It's so annoying. Anyone have any suggestions now? I basically can't view or download any PDFs because of this.
    Does anyone else think this is a problem not only with Adobe? I would think Apple would have something to do with this? Wouldn't they get some idea from the developer versions that no browser can open PDFs while running Lion!? Pretty bad customer service on the part of a company that prides itself on being VERY customer-friendly. Wouldn't you say?

  • Hello...how to change my iphone registration id because i use same apple id with my brother....anyone help me...thank you...

    hello...how to change my iphone registration id because i use same apple id with my brother....anyone help me...thank you...

    "phone registration ID" - do you mean iTunes Store account ID?  If so:
    Settings > Store > tap ID > Sign Out > Sign In with correct ID and billing info.

  • How to change printer preferences for HP envy 4500 using Google Chromebook HP pavilion 14

    I want to know how to change printer preferences for HP envy 4500 using Google Chromebook HP pavilion 14?
    This question was solved.
    View Solution.

     Hi chefcorbin,
    Welcome to the HP Support forums.  I understand that you would like to learn how to change the printer preferences using your Chromebook.
    I have included a link to Google support on printing a page with Chrome and it lists the print settings that you can adjust.
    Google Chrome Help - Print a Page
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • On my mozilla start page, there is a search bar in the middle of the page. It has always been google, but suddenly it is bing. I hate bing! I've been trying to figure out how to change it but it is beyond me.

    I downloaded a game from msn games a week or so ago, and I'm thinking that is what brought this about. I deleted the game off my computer, but don't know how to fix this...

    If you are talking about the default Firefox 4+ homepage - '''about:home''' - run this code in the Scratchpad to change the '''about:home''' search engine back to Google.
    Firefox button > Web Developer -> Scratchpad - <br /> copy and paste this script into Scratchpad > then hit Execute > Run
    <pre> <nowiki>
    javascript:{localStorage["search-engine"]="{\"name\":\"Google\",\"searchUrl\":\"http://www.google.com/search?q=_searchTerms_&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a\"}";void(0);}
    </nowiki> </pre>

  • How to change Table Cell Field Type Dynamically?

    Hi All,
    I am fetching some news data from backend DB and displaying them in a WD Table. Now one News Item may or may not have a URL behind it. If I find the URL as null then I want to display the news as simple TextView otherwise as LinkToUrl. How can I change this input type dynamically for each row in the runtime?
    If I use LinkToUrl all the time then the items which has URL as null gets displayed as normal text, but they are of very faint color and I can not change the text design. Whether if I user TextView I can set some text design like Header2, Header 3 etc.
    Can anybody please help with some code block? My main requirement is how to change the table cell input type dynamically.
    Thanks in Advance.
    Shubhadip

    Hi Shubhadip,
    This is the sample code for creating and adding a table cell editor table dynamically.
    public static void wdDoModifyView
    (IPrivateDynamicTableCreationView wdThis, IPrivateDynamicTableCreationView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
    //@@begin wdDoModifyView
    /*** 1.Create Table **/
    IWDTable table =
    (IWDTable) view.createElement(IWDTable.class, "table1");
    table.setWidth("100%");
    table.setVisibleRowCount(data.length);
    /*** 2.Create nameColumn **/
    IWDTableColumn nameColumn =
    (IWDTableColumn) view.createElement(IWDTableColumn.class, "Name");
    IWDCaption colHeader =
    (IWDCaption) view.createElement(IWDCaption.class, "NameHeader");
    colHeader.setText("–¼‘O");
    nameColumn.setHeader(colHeader);
    IWDTextView nameViewer =
    (IWDTextView) view.createElement(IWDTextView.class, "NameViewer");
    nameViewer.bindText(nameAtt);
    IWDTableCellEditor editor = (IWDTableCellEditor) nameViewer;
    nameColumn.setTableCellEditor(editor);
    table.addColumn(nameColumn);
    IWDTableColumn nationalityColumn =
    (IWDTableColumn) view.createElement(
    IWDTableColumn.class,
    "Nationality");
    IWDTableCellEditor nationalityEditor =
    (IWDTableCellEditor) nationalityViewer;
    nationalityColumn.setTableCellEditor(nationalityEditor);
    table.addColumn(nationalityColumn);
    /** 3. Bind context to table **/
    table.bindDataSource(nodeInfo);
    //@@end
    Bala
    Kindly reward appropriate points.

  • How to change table border color in DW CS6

    I need to know how to change the color of the border around my tables in Dreamweaver CS6. I saw a article on how to change it on http://forums.adobe.com/message/4451812, but i really couldnt follow because im just starting out using dreamweaver and i dont know anything about code. Is there a simple way to change the border color or can you give me a basic step process on how to change the border color in the code?

    Just an FYI, nobody uses Table-based layouts anymore.  It's much better to use CSS for layouts.  Only use tables for tabular data like spreadsheets and charts.
    Dreamweaver has a bunch of pre-built CSS Layouts for you to use as starter pages.  Just go to File > New > Blank page > HTML.  Pick a layout from the 3rd panel and hit Create button.  See screenshot below.
    Nancy O.

  • Bought Iphone! But don't want to use it for calling! How to activate it ???

    Hi,
    just bought an Iphone but don't want use it for calling is there a way to activate it without having a contract with at&t or so! I mean I am not sure if there is a way to do this if anybody knows if it's possible and knows how to do it, I would be very THANKFULLLLLLLL!!!! I need help prettty fast thanks so much!

    Why start a new thread on the same topic as before the answers will all be the same you have to activate the iPhone through iTunes and sign a contract with AT&T to activate the iPhone otherwise you wont be able to take pictures or listen to music or use other features, didn't you do any research on the iPhone before purchasing it??? Sounds like you need to return your iPhone where you bought it and just pay the restocking fee and call it good.
    Message was edited by: Geffen

  • How to change cancel to done on a UIImagePicker

    How could one change the cancel button (which is confusing) to a Done button.
    I have tried setting the right button to nil and creating a new button with no luck.
    Thanks.

    I actually didn't need to change the button. I needed to change the way the modalView dismissed itself.
    I was using.
    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
    [picker dismissModalViewControllerAnimated:YES];
    I should have been using
    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
    [self dismissModalViewControllerAnimated:YES];
    Dismissing self instead of picker dismissed the whole picker not just the photo chooser.
    I would still like to know how to change that button though.

  • How to change account user on iPod touch 4 itself?

    My friend bought my iPod touch 4 and he told me that he cannot change the username (my username) used. How to change it?

    Go to Settings>Store and sign out of existing account and sign into another account..
    However, you should complety erase/restore the iPod to factoery defaults/new iPod since the contents of the iPod do not transfer with the sale of the hardware.

  • How to make array but don't know the length?

    normally if want want an array is double[] d = new double[6], how if the length still don't know?
    thx..

    eadelarosa wrote:
    String [] myArray1 = new String [] {};the above creates a non-null array of Strings called "myArray".
    ArrayList <String> al = new ArrayList <String> (10);
    String [] myArray2 = null;
    myArray2 = arrayList.toArray();or
    myArray2 = arrayList.toArray(new String [arrayList.size()]);the above creates an array of String for you based on the contents of ArrayList, which in this case is 10 objects of type String.
    of course, there are many ways where you can create array of unknown length.
    Edited by: eadelarosa on May 28, 2009 10:26 PMMy advice is to stick with the list and not convert it to an array unless you have no other choice. Love your collections!

  • DB Tool List Table: How to access tables which are in different SQL database ?

    Hi, All,
    I'm working on a database application (SQL server) and is evaluating the NI DB Tool kit for this project.
    One of the requirement is that I need to access tables which are in two different database
    (say Table A in DB 1 and Table B in DB 2).
    Our IT guys has linked Table A in DB1 to DB 2 and I verfied this when I use the SQL server managment studio.
    When DB 2 tables are populated, Table A from DB1 is also there. I can also do the same thing using MS Access.
    Table A in DB1 is avalaible to me enven though I only connect to DB 2.
    Here comes the problem.
    When I use DB Tool List Table.vi to access DB2, it does NOT list Table A in DB1. It only list the tables in
    the database (DB2) which I make connection to (using DB Tool Open Connection.vi with a file DSN)
    So my work around right now is to open two seperate connection to DB1 and DB2. However, this approach
    obviously creates a problem when I have to access seperate database constantly in my application.
    What would be a solution to this ? I've search the forum but only see one post that's somewhat related to
    my question. (And it was posted on 2004) Perhaps I need to alter the code in the orignial VI (DB Tool List Table.vi)??
    My IT guy told me he has not encountered this scenario since he writes codes in other enviroment such as
    VB and others, and he's always been successful by linking tables to different database. 
    I hope my question is sound and clear since I really don't know much about database terminology.
    Any comment/suggestion is much appreciated !!!
    Thanks
    Chad
    Solved!
    Go to Solution.

    To josborne:
    To answer your question:
    - Are the two databases contained on the same SQL Server instance? 
    Or are the databases on separate instances?  I assume they are on
    separate servers, otherwise this wouldn't really be an issue.  But its
    good to know because it will affect how you build your SQL statements.
    Yes they are on separate instances. 
    - Ask your IT people specifically how they "linked Table A in DB1 to
    DB 2".  I assume they used "linked servers". 
    Maybe I used the wrong terminology "linked." They created a "View of Table A (DB1)" in DB2 using the management studio.
    Here is a screen shot of that. As you can see, dbo.VISUAL_WORK_ORDER is seen under LABVIEW database in the management studio.
    I also see the same table when I make connection to database using MS Access.
    Could you elaborate on "configure your SQL statement correctly" =) ? The purpose of using LabView's took kit is so that I can do
    minimum SQL statements. Are you talking about modifying LabView's native VI (DB Tool List Table.vi) ?
    Thanks for the information. SQL is just something new to me.

  • How to change Bulk Insert statement from MS SQL to Oracle

    Hi All,
    Good day, I would like to bulk insert the content of a file into Oracle db. May I know how to change the below MS SQL syntax to Oracle syntax?
    Statement statement = objConnection.createStatement();
    statement.execute("BULK INSERT [TBL_MERCHANT] FROM '" MERCHANT_FILE_DIR "' WITH ( FIELDTERMINATOR = '~~', ROWTERMINATOR = '##' )");
    Thanks in advance.
    cs.

    Oracle SQL Loader utility allows you to insert data from flat file to database tables.
    Go to SQL Loader links on following url to learn more on this utility
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/server.920/a96652/toc.htm
    Chandar

Maybe you are looking for