create repatriated to convert a column with interval into two columns

Hello

I am creating a query in order to adapt the results of a table to get a double interval, but I'm not be able to operate.

I have a table with the structure and the following values:
select 
key,
Key2,
Value
 from PARAMETERS
where key ='OFFSET'

Key           Key2          OFFSET
OFFSET     20110201         +4
OFFSET     20110601        +5
OFFSET     20111001              +3
OFFSET     20120201        +4
I have a client tool that I can't change and need to receive these values in the format:
START         END          OFFSET
20110201    20110601          +4
20110601    20111001          +5
20111001    20120201          +3
any idea on how I can do this?
I use a database 11.2.

Thank you
Ricardo Tomas
with parameters as (
                    select 'OFFSET' key,to_date('20110201','yyyymmdd') key2,'+4' val from dual union all
                    select 'OFFSET',to_date('20110601','yyyymmdd'),'+5' from dual union all
                    select 'OFFSET',to_date('20111001','yyyymmdd'),'+3' from dual union all
                    select 'OFFSET',to_date('20120201','yyyymmdd'),'+4' from dual
                   )
-- end of on-the-fly data sample
select  startdt,
        enddt,
        offset
  from  (
         select  key2 startdt,
                 lead(key2) over(order by key2) enddt,
                 val offset
           from  parameters
        )
  where enddt is not null
/

STARTDT  ENDDT    OF
-------- -------- --
20110201 20110601 +4
20110601 20111001 +5
20111001 20120201 +3

SQL> 

SY.

Tags: Database

Similar Questions

  • How to create drop down menus in Muse with more than two tabs

    The widget menu pullsown does only two tabs. How do you do this more than two tabs?

    By default, the tabs in the menu widget are generated in Muse based on the site map, that you define in outline view. This is configurable based on the Menu type setting you choose in the options Menu If you wish, only, upper level pages subpages too or manual. So in order to add a third menu tab, you simply add a third upper level page.

    I would like to know if it's not what you're looking for and what exactly you're trying to reach.

    Thank you

    Vinayak

  • Why can't I create a table or a column whose name begins with a number?

    Why can't I create a table or a column whose name begins with a number?  I can't seem to find an answer when I Googled it.

    Thank you

    Yoann

    Hello

    jimmy437 wrote:

    Why can't I create a table or a column whose name begins with a number?  I can't seem to find an answer when I Googled it.

    Thank you

    Yoann

    You can;  Simply enclose it quotation marks name whenever you use it.

    For example:

    CREATE TABLE '3-26.
    (
    'name 1' VARCHAR2 (10)
    );

    INSERT INTO '3-26' ('1 St Name') VALUES ('FUBAR');

    SELECT '1 name '.
    "3-26;

    Remember, what inside quotes is case-sensitive, so you can't refer to that column as "1st NAME.

    Using quotation marks (and capitalizing exactly as expected) is such a pain that most people don't bother.

  • I created a document in Photoshop CC with URLS and hyperlinks.  I want to take this document and convert it to PDF AND I wan't these URLS and hyperlinks to be clickable.  How do I do that?

    I created a document in Photoshop CC with URLS and hyperlinks.  I want to take this document and convert it to PDF AND I wan't these URLS and hyperlinks to be clickable.  How do I do that?

    It works very well.  Use the screening of high printing quality, but think about what resolution for your graphics card.  In fact if you have higher res images online versions, you can hot link to them from the PDF file.  I used to publish a magazine of the club until a couple of years, and while I've used InDesign, output to PDF format was exactly the same process

    http://www.marlboroughcameraclub.org.nz/photo-news/Arti/photo-news-2013/

    If you want to go one step further, take a look at this example, which uses the SWF to the page turn effect

    http://www.f11magazine.com/current.html

    I assume that your document is a good single page?  Photoshop is a clumsy tool for multi-page documents.

  • How to create measures of County on columns of flag in FACT with a CONDITON

    I have about 6 flag columns in my table of facts, and I would like to create measures in my report with County as aggregation on these flag columns in a group by on a condition.
    I am able to do this very easily with SQL query but am really stuck with on how to achieve this in OBIEE.


    Each of my measure should be to make a count aggreagation in the column of flag with a condition such as true/false flag.
    For example:
    Measure1 - Select (INV_ID) count of payments_f of the pavilion where 1 = 'TRUE' and Flag2 = 'FALSE' GROUP_BY (COLUMN1)
    Date2 - Select (INV_ID) count of payments_f of the pavilion where 2 = 'TRUE' and Indicateur3 = 'FALSE' GROUP_BY (COLUMN1)
    -----
    -----
    similar conditions for all columns of flag.

    I tried to write the where condition in the tab content of the logical table, but unfortunately it only on the level of the table - which was not very helpful for me

    I'm really grateful if someone can help me on how to do this.

    Thanks in advance

    You must create a new existing logical column in your logical table. Then you must set the physical mapping:
    BOX WHEN FLAG1 = 'TRUE' AND FLAG2 = 'FALSE' THEN ENDS UP 1 0 OTHERWISE.
    Defined sum aggregation rule.

    Kind regards
    Stijn

  • How to convert .vi .exe with the student LabView version

    Hello

    I would like to know if it is possible to convert .vi .exe with the student Labview version.

    Thank you

    N ° if I remember correctly, your license agreement specifically prohibits this. You would have to buy the professional version of LabVIEW. No real need for a student to create an exe file.

  • Zoo Tycoon 2 error: Zoo Tycoon 2 could not create a graphics converter. Your provider of graphic adapter to ensure that you have the latest driver. »

    I am running Zoo Tycoon 2 on Windows 8 with a Nvidia GeForce GTX645.  I installed ZT2 and get the following error when you try to play: Zoo Tycoon 2 could not create a graphics converter. Your provider of graphic adapter to ensure that you have the latest version of the driver.

    I already did so that my drivers are up to date.  Any ideas?  Thank you!

    Hi Luanne,

    The problem is specific to a Zoo Tycoon 2?

    This problem may occur if the graphics drivers are damaged. I suggest to uninstall and reinstall graphics card drivers and check if it helps.

    To uninstall the device drivers, follow these steps:

    a. drag the mouse down to the left and right click on the Start icon.

    b. Select Device Manager.

    c. right-click on the device driver, and then click Uninstall.

    See the link to download the drivers:

    http://www.GeForce.com/drivers

    I hope this helps. If you have additional questions on the computer, please ask your question about Windows and we will be happy to help you.

  • Creating a view and replacing id with strings of text values

    This can be a pretty basic question, but I'm a newbie so any advice is appreciated.

    Here's my data:

    create table user_attributes (id NUMBER, attr1 number, attr2 number, attr3 number, attr4 number, attr5 number);
    create table tag_values (tag_id number, tag varchar2(30));
    
    
    insert into user_attributes (id, attr1, attr2, attr3, attr4, attr5) values (1, 101, 105, 102, null, null);
    insert into user_attributes (id, attr1, attr2, attr3, attr4, attr5) values (2, 105, null, 101, 105, null);
    insert into user_attributes (id, attr1, attr2, attr3, attr4, attr5) values (3, 102, null, null, 105, 103);
    
    
    insert into tag_values (tag_id, tag) values (101, 'blue');
    insert into tag_values (tag_id, tag) values (102, 'red');
    insert into tag_values (tag_id, tag) values (103, 'green');
    insert into tag_values (tag_id, tag) values (104, 'orange');
    insert into tag_values (tag_id, tag) values (105, 'black');
    

    I want to create a view and the column id and the text of the tag instead of the ID.

    That's what I use so far (just showing three columns of attribute for example):

    SELECT a.id,
      b.tag ATTR1,
      c.tag ATTR2,
      d.tag ATTR3
    FROM user_attributes a
    LEFT JOIN tag_values b
    ON a.attr1 = b.TAG_ID
    LEFT JOIN tag_values c
    ON a.attr2 = c.TAG_ID
    LEFT JOIN tag_values d
    ON a.attr3 = d.TAG_ID
    ORDER BY 1;
    

    Result:

      ID        ATTR1                          ATTR2                          ATTR3                        
    ---------- ------------------------------ ------------------------------ ------------------------------
             1 blue                           black                          red                            
             2 black                                                         blue                           
             3 red        
    

    That's what I want, but I have a lot of data and I want to just make sure that I do things properly. Is there a more efficient way to build this application?

    Hello

    It would be so much easier if you had only 1 column to search, not 5.  We will therefore unpivot the table so there is only 1 column to search; then we can switch it to display as you wish:

    WITH unpivoted_data AS

    (

    SELECT ua.id, ua.col, tv.tag

    Of user_attributes

    UNPIVOT (attr

    FOR the collar (attr1, attr2, attr3, attr4, attr5)

    )                ua

    JOIN tag_values tv ON tv.tag_id = ua.attr

    )

    SELECT *.

    Of unpivoted_data

    PIVOT (MIN (tag)

    At THE neck ('ATTR1' AS attr1

    'ATTR2' attr2 VALUE

    'ATTR3' attr3 AS

    'ATTR4' AS attr4

    'ATTR5' AS attr5

    )

    )

    ORDER BY id

    ;

    Output:

    ID ATTR1 ATTR2, ATTR3 ATTR4 ATTR5

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

    1 red blue black

    2 black blue black

    3 black red green

    .

    It is better to have the attributes in a dynamic no cross-form for this problem, it is perhaps better to have the attributes of the dynamic non cross-shape for most other uses, too.  Consider to permanently store the attributes with only 1 attribute per line.

  • Creating INDEX on a BLOB column in a separate tablespace

    Hello


    Our database contains 2 storage spaces :

    -Tablespace DATA : is reserved to hold the data.

    -Tablespace INDX: is reserved to hold the index.


    For some reason, that we must create the indexes on columns of type blob and the pending order are:

    SQL > CREATE INDEX my_index ON DOC_CONTENTS (doc_content) INDEXTYPE IS CTXSYS. CONTEXT;  / / doc_content a blob type.

    SQL> index created

    Now, all indexes are created in the tablespace for DATA that is not good, they should be created in the tablespace INDX (now is empty)

    For this reason, and after a search, I specified the tablespace INDX , which will contain the index, and the used command is:

    SQL > CREATE INDEX my_index ON DOC_CONTENTS (doc_content) INDEXTYPE IS CTXSYS. CONTEXT TABLESPACE INDX;

    *

    ERROR on line 1:

    ORA-29850: invalid option for creating domain index

    NB: also, when I try to use the same command with varchar column, it works.

    SQL > CREATE INDEX my_index ON DOC_CONTENTS (doc_name) TABLESPACE INDX;  / / doc_content a type VARCHAR2.

    SQL> index created


    Do you have an idea on how to create indexes on a blob column in a different tablespace?

    This question has nothing to do with the Oracle objects, but is related to Oracle Text, then perhaps that some moderator moves text objects.

    To specify a storage space for a ctxsys.context Oracle Text index domain index tables, you must create a storage preference, specify storage spaces in attributes of this preference, then use this preference in settings of creating index.  Please see the example below which shows first create domain index tables in the default users tablespace, then the creation of the field tables to be indexed in the example tablespace.

    Scott@orcl_11gR2 >-test environment:

    Scott@orcl_11gR2 > doc_contents CREATE TABLE

    2 (doc_content BLOB)

    3.

    Table created.

    Scott@orcl_11gR2 > INSERT INTO doc_contents VALUES

    2 (UTL_RAW. CAST_TO_RAW ("test data"))

    3.

    1 line of creation.

    Scott@orcl_11gR2 >-create domain index tables in default users tablespace:

    Scott@orcl_11gR2 > my_index CREATE INDEX

    2 doc_contents (doc_content)

    3 INDEXTYPE IS CTXSYS. FRAMEWORK

    4.

    The index is created.

    Scott@orcl_11gR2 > SELECT index_name, nom_tablespace

    2 FROM user_indexes

    3. WHERE index-name LIKE '% MY_INDEX % '.

    4.

    INDEX_NAME TABLESPACE_NAME

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

    MY_INDEX

    DR.$ MY_INDEX$ X USERS

    2 selected lines.

    Scott@orcl_11gR2 > SELECT table_name, nom_tablespace

    2 FROM user_tables

    3 WHERE table_name LIKE '% MY_INDEX % '.

    4.

    TABLE_NAME, TABLESPACE_NAME

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

    DR. MY_INDEX$ I HAVE USERS

    USERS R DR$ MY_INDEX$

    DR.$ MY_INDEX$ N

    DR.$ MY_INDEX$ K

    4 selected lines.

    Scott@orcl_11gR2 >-creating the tables index field in example of tablespace:

    Scott@orcl_11gR2 > my_index DROP INDEX

    2.

    The index is deleted.

    Scott@orcl_11gR2 > start

    2 ctx_ddl.create_preference ("mystore', 'BASIC_STORAGE'");

    3 ctx_ddl.set_attribute ("mystore', 'I_TABLE_CLAUSE',")

    4 "tablespace storage example (original 1 K) ');

    5 ctx_ddl.set_attribute ("mystore', 'K_TABLE_CLAUSE',")

    6 "tablespace storage example (original 1 K) ');

    7 ctx_ddl.set_attribute ("mystore', 'R_TABLE_CLAUSE',")

    8 ' lob tablespace storage example (original 1 K)

    9 (data) store as (storage off in row cache)');

    10 ctx_ddl.set_attribute ("mystore', 'N_TABLE_CLAUSE',")

    11 "tablespace storage example (original 1 K) ');

    12 ctx_ddl.set_attribute ("mystore', 'I_INDEX_CLAUSE',")

    13 ' example of tablespace storage (initial 1 K) compress 2 ');

    14 ctx_ddl.set_attribute ("mystore', 'P_TABLE_CLAUSE',")

    15 "tablespace storage example (original 1 K) ');

    16 ctx_ddl.set_attribute ("mystore', 'S_TABLE_CLAUSE',")

    17 "tablespace storage example (original 1 K) ');

    18 end;

    19.

    PL/SQL procedure successfully completed.

    Scott@orcl_11gR2 > my_index CREATE INDEX

    2 doc_contents (doc_content)

    3 INDEXTYPE IS CTXSYS. FRAMEWORK

    4 PARAMETERS ('STORAGE mystore')

    5.

    The index is created.

    Scott@orcl_11gR2 > SELECT index_name, nom_tablespace

    2 FROM user_indexes

    3. WHERE index-name LIKE '% MY_INDEX % '.

    4.

    INDEX_NAME TABLESPACE_NAME

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

    MY_INDEX

    DR.$ MY_INDEX$ X FOR EXAMPLE

    2 selected lines.

    Scott@orcl_11gR2 > SELECT table_name, nom_tablespace

    2 FROM user_tables

    3 WHERE table_name LIKE '% MY_INDEX % '.

    4.

    TABLE_NAME, TABLESPACE_NAME

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

    DR. MY_INDEX$ I EXAMPLE

    DR.$ MY_INDEX$ R EXAMPLE

    DR.$ MY_INDEX$ N

    DR.$ MY_INDEX$ K

    4 selected lines.

    Post edited by: BarbaraBoehmer (corrected for error due to the already existing preference)

  • How to convert a SQL with variable

    Can Hello, please how I convert the underside with a dominant

    I need to be able to generate a plan to explain it, I think I should use cast.



    SELECT TO_NUMBER (OIL. REBALANCE_ORDER_ID UNIQUE_ID),
    OIL. ORDER_QTY,
    OIL. ORDER_TYPE,
    OIL. ORDER_SIDE,
    OIL. POSITION_TYPE,
    OIL. AVAILABLE_QTY AVAILABLE_QUANTITY,
    OIL. GROSS_AMOUNT ORDER_AMT,
    OIL.NET_AMOUNT NET_AMOUNT,
    OIL. FEE_AMT FEE_AMOUNT,
    OIL. ACCRUED_INTEREST_AMT ACCRUED_INTEREST
    TABLE (: B6) OIL

    >
    I need to be able to generate a plan to explain it, I think I should use cast.

    SELECT TO_NUMBER (OIL. REBALANCE_ORDER_ID UNIQUE_ID),
    OIL. ORDER_QTY,
    OIL. ORDER_TYPE,
    OIL. ORDER_SIDE,
    OIL. POSITION_TYPE,
    OIL. AVAILABLE_QTY AVAILABLE_QUANTITY,
    OIL. GROSS_AMOUNT ORDER_AMT,
    OIL.NET_AMOUNT NET_AMOUNT,
    OIL. FEE_AMT FEE_AMOUNT,
    OIL. ACCRUED_INTEREST_AMT ACCRUED_INTEREST
    TABLE (: B6) OIL
    >
    You're right - mount the bind as the appropriate type. I have a SQL type named emp_table_type so that it works

    explain plan for select * from table(cast (:e1 as emp_table_type))
    

    The models involved are

    CREATE OR REPLACE TYPE SCOTT.emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
      )
    /
    
    CREATE OR REPLACE TYPE SCOTT.emp_table_type as table of emp_scalar_type
    /
    
  • convert the column to a string name

    pls help me.

    I need to know how can I convert the column to a string name because I can not insert the column name into my table.


    for matrix (SELECT nom_de_colonne
    OF all_col_comments@myDBLink
    WHERE UPPER (trim (table_name)) = "ROLEMATRIX")
    loop
    INSERT INTO myTABLE (myColumn)
    VALUES (matrix.column_name);
    end loop;


    my error:
    ORA-00984: column not allowed here

    which line you are confronted with error, because I've also tested this, his work on my side!

  • Convert the column values into buckets

    Hello

    Please help me to convert the column values into buckets.
    I have the values of the columns in the following way.


    Age of Orderdate * 9 10 12 14 15 18 19 20 21 22 26 27 28 29 33 34 40 45 * and so on



    But the requirement is the column values should be displayed in form

    Age by order date * 15 1 2 3 4 5 6 7 8 9 10 11 - 16-20 21-25, 26-30 30 + *.


    Please someone give me the solution.

    Thanks in advance.

    Hervé Rama

    Hi Richard,

    Just to double check, you have Setup buckets for 1, 2, 3, 4, 5, 6, 7 and 8 individually (each with a fair value). The problem is that you simply do not have all data fall into buckets above, correct?

    If this is the case, it looks like has been answered your original question. If so, the label would assign 'Proper' points by clicking on the button label correct next to the appropriate response and open a new thread with your new question. The reason why I say this is it will help other people who have a similar bucket question to your solution, without complicating the issue with subsequent questions.

    If you can post a separate thread, I'd be more than happy to help you with your secondary problem.

    Best regards

    -Joe

  • ITunes, create playlists in doubles when syncing with iPod

    iTunes has started to create playlists duplicates when I sync with my iPod Touch 5th generation and does not sync songs to the iPod.

    What can I do on this issue. I tried to reset the iPod, but this does not seem to make a difference. I'm absolutely sick of remove duplicate playlists.

    Any help much appreciated.

    Thank you

    Vivien

    The following steps should solve the problems around the synchronization, assuming that all the content you want in your library.

    (If it isn't see recover your iTunes from your iPod or an iOS device)

    1. Backup device.
    2. Restoration as a new device.
    3. Restore the backup that you made earlier.

    NB. A feature introduced with iOS 9 called thinning or slicing app app allows each device to download just the code and resources required by this device, resulting in smaller downloads and a better use of the storage on the device. Therefore the device is no longer the universal version of the application that can be installed on any device to transfer applications is no longer supported. I hope that Apple will bring some changes to how it works, but in the meantime, you can download past purchases from iTunes or activate the automatic shopping app downloads to ensure that iTunes has always the apps you want on your device. As long as you make sure that all of the apps are present and updates in iTunes before you attempt a restore there should be no loss of data. I cannot confirm, but it seems a way to recent update all data are restored and apps that are not in the library are waiting to download from the iTunes Store over Wi - Fi, in a similar way to the restoration of the iCloud way works.

    TT2

  • Can we create backup files to another folder with timestamp of a file in another folder?

    Original title: automate the process to create backup files.

    Can we create backup files to another folder with timestamp of a file in a different folder.
    My goal is: when I dump/copy the files in the folder 1, saving the same file must be created in the folder with timestamp 2.
    This will apply even if I change the file existing on the record 1 (i.e. If I change an exixting file in folder 1, this change should reflect by creating a new file with timstamp)

    Hi Dhawal02,

    This option is no longer available in Windows XP.

    You can use your favorite search engine and download & install any third party software that can serve the purpose.

    Note: This response contains a reference to third party World Wide Web site. Microsoft provides this information as a convenience to you. Microsoft does not control these sites and no has not tested any software or information found on these sites; Therefore, Microsoft cannot make any approach to quality, security or the ability of a software or information that are there.

    Hope the helps of information.

  • Several BSOD in an interval of two hours due to 'atikmdag.sys' and NTFS.sys with BlueScreenView

    Hello

    So I have recently reinstalled Windows 7 and I got those BSOD in an interval of two hours. The space between the first and the second was almost an hour and a half and the space between the second, third and fourth was five minutes from each other. I'll post the DMP files for anyone to look at to see what you make of it... I used them for BlueScreenView check and in the two first, I found "tcpip.sys" in the third, I found "NTFS.sys" and the fourth, I found "atikmdag.sys" contributing... I also noticed that one particular exe file appeared in all four defective BSOD "ntoskrnl.exe". Could someone help with this? Another thing I noticed, I don't seem to have problems with Safe Mode with networking.

    The four dump files in RAR herefile.

    I think you have brewing here is conflict between AVAST and Malwabytes Pro. You can have more than one AV product with real-time protection (RTP) real installed.

    Please uninstall Malwarebytes and reinstall the free version without the feature of RTP, or completely uninstall AVAST (preferred) and uninstall and reinstall the full version of Malwarebytes Pro.

    AVAST uninstall utility.

    https://www.avast.com/uninstall-utility

    Note: Regardless of the above, you decide to keep and reinstall, you must upgrade to the latest virus definitions and run a scan completes. Why? Because, as long as the conflict exists on your system, it is less certain that he would have been, with only on AV product installed.

    In addition, please if possible update or uninstall the following drivers:

    xnacc.sys Fri Jul 13 20:01:05 2009 (4A5BCAC1): http://sysnative.com/drivers/driver.php?id=xnacc.sys

    netr28x.sys Wed Feb 25 22:02:09 2009 (A 49, 60631): http://sysnative.com/drivers/driver.php?id=netr28x.sys

    LV302V64 LV302V64. SYS Sat Jul 26 11:09:08 2008 (488B3E14): http://sysnative.com/drivers/driver.php?id=LV302V64.SYS

    LVUSBS64 LVUSBS64.sys Sat Jul 26 11:06:36 2008 (488B3D7C): http://sysnative.com/drivers/driver.php?id=LVUSBS64.sys

    HECIx64.sys my Jul 02 18:14:58 2012 (4FF21D62): http://sysnative.com/drivers/driver.php?id=HECIx64.sys

    It would be certainly beneficial to update your system to the latest service pack (SP1) available if you don't have it already done.

    Steps to take before installing Windows 7 SP1 and Windows Server 2008 R2 SP1 starting from Microsoft Download Center.
    http://support.Microsoft.com/kb/2505743

    Learn how to install Windows 7 Service Pack 1 (SP1).
    http://Windows.Microsoft.com/en-us/Windows7/install-Windows-7-Service-Pack-1

    Windows 7 and Windows Server 2008 R2 Service Pack 1 (KB976932)
    http://www.Microsoft.com/en-US/Download/details.aspx?ID=5842

    Troubleshoot installation of Service Pack 1 (SP1) for Windows 7 or Windows Server 2008 R2
    http://Windows.Microsoft.com/en-us/Windows7/troubleshoot-problems-installing-Service-Pack

Maybe you are looking for