Convert the column online

Table "tab1" has given below.

column_acolumn_bcolumn_ccolumn_d
1234

Could you please help to provide the query data is displayed as below?

column_e
1
2
3
4

You can use the unpivot operator control, for example:

with tab1 as

(select 1 as column_a, column_b, 3 column_c 2, 4 as double column_d)

Select column_e

of tab1

UNPIVOT

(column_e FOR name (column_a, column_b, column_c, column_d))

Tags: Database

Similar Questions

  • How to convert the column online

    Hello

    Do is samble of my data, I need to convert columns into rows

    create table uload_table (id1 number, tidset varchar2(200));
    
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (1,1);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (1,2);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (1,3);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (1,4);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (1,5);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (1,7);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (1,8);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (1,10);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (2,2);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (2,3);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (2,4);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (2,5);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (2,8);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (2,9);
    Insert into UNLOAD_TABLE (ID1,TIDSET) values (2,10);
    select * FROM UNLOAD_TABLE ;
    ID1      TIDSET
    ----- ----------   
    1     1
    1     2
    1     3
    1     4
    1     5
    1     7
    1     8
    1     10
    2     2
    2     3
    2     4
    2     5
    2     8
    2     9
    2     10
    I need the result to be as below.
    ID1      TIDSET
    ----- ----------   
    1     ;1;2;3;4;5;7;8;10
    2     ;2;3;4;5;8;9;10
    any help please,.

    http://download.Oracle.com/docs/CD/E11882_01/server.112/e26088/functions089.htm#SQLRF30030

    Concerning

    Etbin

  • 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

  • How to convert the column of ROW using DBMS_REDIFINITION object type column

    Hi all
    Suppose I have the following table to convert:
    create table customer as select customer_id cid, cust_first_name name, cust_address street from customers;
    alter table customer modify cid primary key;
    I created the table based on the customers of the OE schema table, while the street column has cust_address_typ with the following attribute object type
    SQL> describe cust_address_typ
     Name                                     Null?     Type
     ----------------------------------------------------- -------- ------------------------------------
     STREET_ADDRESS                               VARCHAR2(40)
     POSTAL_CODE                                   VARCHAR2(10)
     CITY                                        VARCHAR2(30)
     STATE_PROVINCE                               VARCHAR2(10)
     COUNTRY_ID                                   CHAR(2)
    I want to convert the object attribute adresse_rue in a column of RDM. Consider the following temporary table:
    CREATE TABLE INT_CUSTOMER(
    CID NUMBER,
    NAME VARCHAR2(30),
    street varchar2(100)
    );
    First of all, I checked if the table can be redefined:
    --Verify if the table can be redefined
    BEGIN
    DBMS_REDEFINITION.CAN_REDEF_TABLE('OE','CUSTOMER',DBMS_REDEFINITION.CONS_USE_PK);
    END;
     4  /
    
    PL/SQL procedure successfully completed.
    But when I started the redefinition, I got an error:
    BEGIN
    DBMS_REDEFINITION.START_REDEF_TABLE(
    uname => 'OE',
    orig_table => 'CUSTOMER',
    int_table => 'INT_CUSTOMER',
    col_mapping => 'CID CID, NAME NAME, STREET CUST_ADDRESS_TYP(STREET_ADDRESS)'
    );
    END;
      9  /
    BEGIN
    *
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected
    ORA-06512: at "SYS.DBMS_REDEFINITION", line 52
    ORA-06512: at "SYS.DBMS_REDEFINITION", line 1646
    ORA-06512: at line 2
    What seemed to be the problem?

    Best regards
    Val

    Published by: Valerie good-natured October 9, 2011 21:43

    Have you tried this one:

    BEGIN
    DBMS_REDEFINITION.START_REDEF_TABLE(
    uname => 'OE',
    orig_table => 'CUSTOMER',
    int_table => 'INT_CUSTOMER',
    col_mapping => 'CID CID, NAME NAME,"CUSTOMER".STREET.STREET_ADDRESS STREET'
    );
    END;
    

    Looking at your trace file, I claim that when you use the call above to START_REDEF_TABLE, the inner workings of this procedure will create this SQL statement:

    select CID CID, NAME NAME,"CUSTOMER".STREET.STREET_ADDRESS STREET from "OE"."CUSTOMER" "CUSTOMER"
    

    (You can prove or disprove my claim by tracing it ;-)))

    And this statement has had an alias - even if the alias is the same as the name of the table...

  • How to convert the column lines

    I need to convert my output lines of sql for the column as a pivot to 11g

    Please give me the example of this

    check out this link

    http://nimishgarg.blogspot.com/2010/06/Oracle-pivot-data-rows-to-columns.html

    request for 10g would be

    Select *.
    (select job,
    Sum (decode(DEPTNO,10,SAL)) dept10,
    Sum (decode(DEPTNO,20,SAL)) dept20,
    Sum (decode(DEPTNO,30,SAL)) dept30,
    Sum (decode(DEPTNO,40,SAL)) dept40
    from scott.emp
    Working Group)
    order by 1;

  • convert the column values to a single line...

    I have to return the column values to a single line separated by commas.
    If the nulls in the column just ignore without a comma.
    Here is one for example. There are three values and two NULL values in the table
    SQL> select ID from temp_fa;
    ID
    -----
    
             1
             2
    
             3
    
             5
    
    6 rows selected.
    
    
    I am expecting an output as 1,2,3,5
    Help, please

    There is always more than one title in the Oracle world ;)
    You can use the TRIM, for example (same configuration as your example):

    hoek&XE>  create table t as select level col  from dual connect by level <= 6;
    
    Tabel is aangemaakt.
    
    hoek&XE> update t set col = null where col in (1,3,5);
    
    3 rijen zijn bijgewerkt.
    
    hoek&XE> select * from t;
    
           COL
    ----------
    
             2
    
             4
    
             6
    
    6 rijen zijn geselecteerd.
    
    hoek&XE> select ltrim(sys_connect_by_path(col, ','), ',') output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6,,,
    
    1 rij is geselecteerd.
    
    hoek&XE> select trim ( both ',' from sys_connect_by_path(col, ',')) output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6
    
    1 rij is geselecteerd.
    
  • How can I convert a column online

    Hi experts,
    How can I convert column as line in oracle...

    I have a table like Tab_Query this table has only one column.
       create table Tab_Query
      (
        result varchar2(4000);
      );
    
     insert into Tab_Query values(Mr,John,01-apr-1984,Software Engineer); 
    
      Then table has contain the value like below 
    
       Mr,John,01-apr-1984,Software Engineer
     
      My Requirement is i need the result like below
      Mr
      John
      01-apr-1984
      Software Engineer
    Please, can someone help how can I get the result...

    Kind regards
    Arun

    Hello

    Here's a way to do it when you have several lines:

    select   regexp_substr(result,'[^,]+',1,l) as Tokens
    from tab_query,
        (
        select level l
        from dual connect by level<= (
                                     select max(regexp_count(result, ',') )  +1
                                     from tab_query
                                     )
        )
    where regexp_substr(result,'[^,]+',1,l) is not null
    order by result, l ;
    

    Kind regards
    Sylvie

  • transform data from the column online

    Dear Member,
    I use 10G DB.
    Old table has the structure folliowng with values in point 1 or 2 or 3, 4, all columns
    ID      Year05      year06      year07      year08      year09      year10
    --     -------     -------     ------     -------     -------     -------
    1     654     387     3874     
    2          3645          878          899
    3     232     787          654     89     
    4               34
    ....
    
    The new table  has the following structure ( SEQ,id, year, amount). How can I insert the old data into the new structure like the following?
    
    SEQ     ID     YEAR     AMOUNT
    1     1     05     654
    2     1     06     387
    3     1     07     3874
    4     2     06     3645
    5     2     08     878
    6     2     10     899
    7     3     05     232
    8     3     06     787     
    9     3     08     654
    10     3     09     89
    11     3     10     899
    12     4     07     34
    WAN

    Hi, wAN,

    wanwan63 wrote:
    Frank,

    Thank you very much for the link.
    On the example Comm displayed always on the line if there is no value. Is it possible to not display COMM if comm is null?

    He finds that sal is never NULL in this example. If sal could be null, you want to exclude the rows of the result set, too?

    Add a WHERE clause to exclude the lines. We cannot use a column alias like num_val in the WHERE clause of the query even where it has been defined, then either
    (a) repeat the CASE expression in the WHERE clause, or
    (b) set num_val in a subquery and then use it in the WHERE clause of a query Super, like this:

    WITH     all_col_names          AS
    (
         SELECT     'COMM'  AS col_name     FROM dual     UNION ALL
         SELECT     'SAL'                   FROM dual
    )
    ,     got_num_val          AS
    (
         SELECT       e.ename
         ,       n.col_name
         ,       CASE     n.col_name
                      WHEN  'COMM'     THEN  e.comm
                     WHEN  'SAL'     THEN  e.sal
                  END          AS num_val
            FROM           scott.emp          e
         CROSS JOIN    all_col_names     n
         WHERE       deptno          = 30
    )
    SELECT       *
    FROM       got_num_val
    WHERE       num_val     IS NOT NULL
    ORDER BY  ename
    ,            col_name
    ;
    
  • result of the column online

    RDBMS: oracle 10.2

    I have a table to store categories and the association element.
    catId, ItemId
    1 12
    1 13
    1 14
    ...

    I want to write a query to display the results in a row for each category.
    catId, itemId itemId itemId
    1 12 13 14
    .......

    can I use a sql clause to get the required results?

    A lot of SQL http://www.oracle-base.com/articles/misc/string-aggregation-techniques.php

  • convert the column to the SQL line

    Hello world

    I have table with 2 fields.
    like;

    F1 f2
    x x 1
    x x 2
    x x 3
    x x 4

    y y1
    Y2 y
    y y3
    y y4

    I want to get the data in this table as;
    F1 f2 f3 f4 f5
    x x 1 x 2 x 3 x 4
    y y1 y2 y3 y4


    Thank you in advance.

    user1516131 wrote:

    I want to get the data in this table as;

    I guess that x 1, x 2... is just an example and in reality, it can be any value. If Yes, you can use (and, as hoek said, it's a static solution):

    with t as (
               select 'x' f1, 'x1' f2 from dual union all
               select 'x', 'x2' from dual union all
               select 'x', 'x3' from dual union all
               select 'x', 'x4' from dual union all
               select 'y', 'y1' from dual union all
               select 'y', 'y2' from dual union all
               select 'y', 'y3' from dual union all
               select 'y', 'y4' from dual
              )
    select  f1,
            f2,
            f3,
            f4,
            f5
      from  (
             select  f1,
                     f2,
                     lead(f2) over(partition by f1 order by f2) f3,
                     lead(f2,2) over(partition by f1 order by f2) f4,
                     lead(f2,3) over(partition by f1 order by f2) f5,
                     row_number() over(partition by f1 order by f2) rn
               from  t
            )
      where rn = 1
    /
    
    F F2 F3 F4 F5
    - -- -- -- --
    x x1 x2 x3 x4
    y y1 y2 y3 y4
    
    SQL> 
    

    SY.

  • How to keep the columns of history in capital letters?

    Hello

    Is there a way to convert the columns that are marked as columns of history (ex: Created_By, Updated_By) uppercase and then store them in the database table? Once these columns are marked as history columns, Set accessor methods are not generated in the EOImpl class, and whenever a record is created or updated, the created_by and updated_by on these recordings are filled automatically by the framework using the name of securityContext so my interpretation is not bad.

    Is it possible to override this to ensure that whenever a transaction takes place, these columns are always inserted/updated on top of case?

    Thank you.

    You will need to return username converted to uppercase if the kind of story is HISTORY_CREATE_USER.

    So it should look like this:

    protected Object getHistoryContextForAttribute(AttributeDefImpl attributeDefImpl){
        if(attributeDefImpl.getHistoryKind()==AttributeDefImpl.HISTORY_CREATE_USER){
            return ADFContext.getCurrent().getSecurityContext().getUserName().toUpperCase();
        }else{
            return super.getHistoryContextForAttribute(attributeDefImpl);
        }
    }
    

    Dario

  • How can I get my email back contacts views? I can only see my contacts 'online status. I accidentally deleted all the columns and cannot see contacts, emails.

    I can only view my contacts by "online status" in windows live mail.   I accidentally deleted all the columns and cannot see contacts, emails. How to bring back my columns?

    Hi celine,.

    For a more specialized on issue of Windows Live Mail help, post your query on the Windows Live Forum. Windows Live Forum - http://windowslivehelp.com/

  • I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows?

    I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows so that I can do the calculations?

    If you start the https://forums.adobe.com/welcome Forums Index

    You will be able to select a forum for the specific Adobe products you use

    Click on the symbol "arrow down" on the right (where it is said to see all our products and Services) to open the drop-down list and scroll

  • I need to convert PDF to Excel, however, the columns and tabs make many merged cells and the number of columns empty. In addition to not separate the columns properly, I see many not separate lines together in the same cell. I think same as Adobe Acrobat

    I need to convert PDF to Excel, however, the columns and tabs make many merged cells and the number of columns empty. In addition to not separate the columns properly, I see many not separate lines together in the same cell. I even think that Adobe Acrobat Pro DC has limits. There is no way to set what points in columns to force the column break? Or create several columns that are unnecessary? How column in Excel, size fixed when import us text and define where breaks have columns of text?

    Google Tradutor para empresas:Google para appsTradutor sitesGlobal market Finder traducao Toolkit

    Acts traducao Instantaneasobre o Google TradutorCelularComunidadePrivacidade e TermosAjudaEnviar comments

    PDF does not contain columns, lines, formats, styles or other aspects of word processing or spreadsheet file formats.

    This is because the PDF is decidedly not a file format of word processor or a spreadsheet or something 'like' one of these.

    (see ISO 32000 for what PDF "is")

    Which allows to optimize the export of the content of a page PDF is to start with that tag well formed PDF (ISO 14289-1, PDF/UA-1).

    Without that export is what it is and we performs the cleanup of any necessary content using the native application for the export of files (MS Word or Excel).

    Be well...

Maybe you are looking for

  • app iCloud and photos of duplication

    First, I copied my photo library on a disk (that has been synchronized with my iCloud account). Then, I just did a clean Sierra install for my MacBook. After that find my photo library with App Photos. And open iCloud photo library. Photos app starte

  • Is it possible to run files apk on my phone SE

    Is it possible to run on my SE apk files?  Thank you

  • Dv6-3268 and AMD chipset

    Hi all I used to have an Intel Pavilion for which you could download exact Intel Chipset using a link clearly identified on the page of the laptop. Now, I bought the 3268 which is AMD based, but there is no link with the Chipset. I was wondering if t

  • Bipolar stepper motors (x 2) to follow a set of coordinates

    Hello! I want my bipolar Motors (2 x) to follow a set of coordinates, so I hope that someone could help me get started. Motor control step by step vi receives an amount of markets, negative amount to take a step back. As well; to calculate the amount

  • opening large tdms files in Excel takes forever, can do something?

    After that recording hardware daq channels for 4 hours my file is large 120Mo, with all 20columns data and 150 k lines. This opening in excel takes at least 5 minutes, several answer screen fades and fear that all my data is impossible to do more. Wh