How to fetch single row data into multiple columns

Hi Have a cursor
which will have SELECT Sun_hrs,Mon_hrs,Tue_hrs,Wed_hrs,Thu_hrs,Fri_hrs,Sat_hrs from OTMaster;
now my cursor has one row of the above columns with this row data I want to insert into other tale as column wise
ex:
my row is like this: Sun_hrs,Mon_hrs,Tue_hrs,Wed_hrs,Thu_hrs,Fri_hrs,Sat_hrs
01:00 01:00 01:00 01:00 01:00 01:00 01:00
now I want to insert the above data into table with loop along with weekday
weekday, OTHrs
1 01:00
2 01:00
3 01:00
4 01:00
5 01:00
6 01:00
7 01:00
which type of variable I need to fetch the records, rowtype or tabletype,
plz help me

thank you for information, and now I am using UNPIVOT below is my query
SELECT * FROM OTCEILINGMASTER
UNPIVOT(OTHOURS FOR WEEK_DAY IN (SUN_CEILING_HRS AS '1',MON_CEILING_HRS AS '2',TUE_CEILING_HRS AS '3',
WED_CEILING_HRS AS '4',THU_CEILING_HRS AS '5',FRI_CEILING_HRS AS '6',SAT_CEILING_HRS AS '7'));
when I am selecting all the columns (select * from OTCEILINGMASTER) then only the above query is executing I want only two columns from the table however my table has 10 columns.
please looking into this

Similar Messages

  • How to insert one table data into multiple tables by using procedure?

    How to insert one table data into multiple tables by using procedure?

    Below is the simple procedure. Try the below
    CREATE OR REPLACE PROCEDURE test_proc
    AS
    BEGIN
    INSERT ALL
      INTO emp_test1
      INTO emp_test2
      SELECT * FROM emp;
    END;
    If you want more examples you can refer below link
    multi-table inserts in oracle 9i
    Message was edited by: 000000

  • How to Split Single Outbound Idoc into Multiples

    Hi guys
    Hope you all are doing good.
    Can you please let me know , How to Split Single Outbound IDOC into multiples.
    I am looking for some sought of configuration in IDOC/from SHIPMENT Configuration level.  Because this needs to be implemented for Shipment IDOCS.  Please let me know if this can be done through configurations apart from implementing  User exit or copying the outbound shipment function module.
    Awaiting for your valuable replies.
    Best Regards
    Shiva

    Hello,
    1. Routes
    2. Packaging used
    3. Shipment Type
    Regards
    Waza

  • Split flat file column data into multiple columns using ssis

    Hi All, I need one help in SSIS.
    I have a source file with column1, I want to split the column1 data into
    multiple columns when there is a semicolon(';') and there is no specific
    length between each semicolon,let say..
    Column1:
    John;Sam;Greg;David
    And at destination we have 4 columns let say D1,D2,D3,D4
    I want to map
    John -> D1
    Sam->D2
    Greg->D3
    David->D4
    Please I need it ASAP
    Thanks in Advance,
    RH
    sql

    Imports System
    Imports System.Data
    Imports System.Math
    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
    Imports System.IO
    Public Class ScriptMain
    Inherits UserComponent
    Private textReader As StreamReader
    Private exportedAddressFile As String
    Public Overrides Sub AcquireConnections(ByVal Transaction As Object)
    Dim connMgr As IDTSConnectionManager90 = _
    Me.Connections.Connection
    exportedAddressFile = _
    CType(connMgr.AcquireConnection(Nothing), String)
    End Sub
    Public Overrides Sub PreExecute()
    MyBase.PreExecute()
    textReader = New StreamReader(exportedAddressFile)
    End Sub
    Public Overrides Sub CreateNewOutputRows()
    Dim nextLine As String
    Dim columns As String()
    Dim cols As String()
    Dim delimiters As Char()
    delimiters = ",".ToCharArray
    nextLine = textReader.ReadLine
    Do While nextLine IsNot Nothing
    columns = nextLine.Split(delimiters)
    With Output0Buffer
    cols = columns(1).Split(";".ToCharArray)
    .AddRow()
    .ID = Convert.ToInt32(columns(0))
    If cols.GetUpperBound(0) >= 0 Then
    .Col1 = cols(0)
    End If
    If cols.GetUpperBound(0) >= 1 Then
    .Col2 = cols(1)
    End If
    If cols.GetUpperBound(0) >= 2 Then
    .Col3 = cols(2)
    End If
    If cols.GetUpperBound(0) >= 3 Then
    .Col4 = cols(3)
    End If
    End With
    nextLine = textReader.ReadLine
    Loop
    End Sub
    Public Overrides Sub PostExecute()
    MyBase.PostExecute()
    textReader.Close()
    End Sub
    End Class
    Put this code in ur script component. Before that add 5 columns to the script component output and name them as ID, col1, co2..,col4. ID is of data type int. Create a flat file destination and name it as connection and point it to the flat file as the source.
    Im not sure whats the delimiter in ur flat file between the 2 columns. I have use a comma change it accordingly.
    This is the output I get:
    ID Col1
    Col2 Col3
    Col4
    1 john
    Greg David
    Sam
    2 tom
    tony NULL
    NULL
    3 harry
    NULL NULL
    NULL

  • Displaying single value (Record) into multiple columns

    Hi All,
    I want to display the single record into multiple columns. Please let me know How to achieve this..
    Record:
    Lvl Activity Acre
    6 Week 4 (Same value to be displayed into 3 columns.)
    REquired output:
    lvl Activity PH1 PH2 PH3
    6 Week 4 4 4
    Thanks
    Kavi

    user533671 wrote:
    Hi,
    Thanks for immediate reply.
    PH1, PH2, PH3, ... will go more columns based on parameter , what we are passing.An single SQL statement cannot have a dynamic number of columns based on the data itself. The projection (columns returned) have to be known before any data is fetched... and that includes some 'parameter' value.
    {thread:id=2309172}
    You can build a query dynamically, based on a parameter or even on the data, but 99 times out 100 people use dynamic queries where they are not needed.
    Perhaps explain to us what you are really trying to achieve and why, and we could suggest some better way.

  • 3 rows data into one column

    Hi,
    Im working with asp application having controls (1 dropdownlist(options--Schedlue,InProcess,On HOld),two textboxes(SSStatusComments,SSGeneralComments))  I want to show output something  like below
    CREATE TABLE [dbo].[EFIWorkStatus1](
    [WID] [int] IDENTITY(1,1) NOT NULL,
    [ST_ID] [int] NULL,
    [SSStatus] [nchar](10) NULL,
    [SSStatusComments] [nvarchar](max) NULL,
    [SSGeneralComments] [text] NULL) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    private void SiteSurveystatusload()
    using (SqlConnection cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ArgentDB"].ConnectionString))
    cn.Open();
    string sql = "Select SSStatus,SSStatusComments from EFIWorkStatus1 where ST_ID=@ST_ID";
    SqlCommand cmd = new SqlCommand(sql, cn);
    cmd.Parameters.AddWithValue("@ST_ID", Request.QueryString["ID1"]);
    using (SqlDataReader reader = cmd.ExecuteReader())
    if (reader.HasRows)
    while (reader.Read())
    txt_SiteSurveyGeneralComments.Text = reader["SSStatus"].ToString() + " " + reader["SSStatusComments"].ToString();
    else
    txt_SiteSurveyGeneralComments.Text = "";
    output in database for above code
    WID ST_ID SSStatus SSStatusComments SSGeneralComments
    1 4 Schedule test in schedule Select
    2 4 In Process test in process Select //expected output Schedule test in schedule in SSGEneralComments
    3 4 On Hold ite on hold On Hold ite on hold //expected output Schedule test in schedule In Process test in process in GeneralComments

    I want to display  the contents in textbox(SSGeneralComments)  .Please check below example.
    Initally user selects dropdown option "Schedule" enter  comments in "SSSTatusComments" click savebtn .It stores in DB,Nexttime user wants to change dropdownlist option "IN Process" and enters comments  in "SSStatusCommentstextbox"    at
    that time previous data(Schedule,comments)  I want to display in       SSGeneralCommentstextbox   click on savebtn it saves in database.nexttime user wants   update option to  Complete and enter comments
    in SSStatusCommentstextbox   I want to display previous  data into   SSGeneralCommentstextbox .       
    dropdownlist1   SSStatusCommentstextbox    SSGeneralCommentstextbox 
    Schedule            test in Schedule   
    IN Process          test in Process               Schedule  test in schedule     //want to display content  in
    this  textbox
    Complete           test in complete            Schedule  test in schedule    //want to display content  in this  textbox
       IN Process test in Process  

  • How to fetch each row data

    Hi,
    I have written a CQL query with rows 3 records. In that query is it possible to fetch first record and last record specific field values.
    for example,
    Column: c1, c2, c3
    record1: id1, 2.3, 3.5
    record2: id2, 2.3, 3.6
    record3: id21, 2.3, 3.7
    record3: id25, 2.3, 3.9
    I need to get moving average of three rows of c3 and get first record id and last record ids.
    output1: id1, id1, avg(c3)=3.5
    output2: id1, id2, avg(c3)=3.55
    output3: id1, id21, avg(c3)=3.6
    output4: id2, id25, avg(c3)=3.733
    Please help on above.
    Thanks,
    Sri

    I have one more question.
    The average output is given as input to pattern match processor.
    The double differentiation differentiation of first 2 average input data in CQL pattern match is written as:
    <view id="FetchRows">
         <![CDATA[ istream(select * from mdepthChannel)
                     ]]>
    </view>
    <query id="ExampleQuery">
         <![CDATA[ select *      
                     from FetchRows 
                     MATCH_RECOGNIZE (
                     Measures
                             v1.wellUid as wellUid,
                             v1.arrivalTime as arrivalTime,
                          v1.wellboreUid as wellboreUid,
                          v1.mdepthAverage as mdepthAverage,
                          v1.wopAverage as wopAverage,
                          v2.mdepthAverage as v2mdepthAverage,
                          v2.wopAverage as v2wopAverage,
                          v3.mdepthAverage as v3mdepthAverage,
                          v3.wopAverage as v3wopAverage,
                          getCalculateDerivative(v2.mdepthAverage,getCalculateDerivative(v1.mdepthAverage,v1.wopAverage,v2.mdepthAverage,v2.wopAverage),v3.mdepthAverage,getCalculateDerivative(v2.mdepthAverage,v2.wopAverage,v3.mdepthAverage,v3.wopAverage)) as derValue
                     ALL MATCHES
                     PATTERN (v1 v2 v3)
                     DEFINE
                     v3 as (getCalculateDerivative(v2.mdepthAverage,getCalculateDerivative(v1.mdepthAverage,v1.wopAverage,v2.mdepthAverage,v2.wopAverage),v3.mdepthAverage,getCalculateDerivative(v2.mdepthAverage,v2.wopAverage,v3.mdepthAverage,v3.wopAverage)) <= 0.0)               
                        ) as T
                     ]]>           
    </query>
    Where "getCalculateDerivative" is the java function returns slope of straight line.
    The output of this query returns correct data till 7th record after that it repeats 6nd record.
    That 8th record is the same as 6th record data.
    Why that 8th record is the 6nd record repeats.
    The desired output is same as input record if pattern matches.
    Please help on this.
    Thanks,
    Sri
    Edited by: 897694 on Mar 27, 2012 2:15 AM

  • Sorting data into multiple columns

    Hello, I'm trying to create an array that I can output to a spreadsheet file. I'm sampling based on time, and I'm doing some data analysis within the program. I want to format the array to be like this:
    | Current time | Airflow | Volume | x | y | z |
    and have this for each time point. I can do this with a single signal but I'm having issues with the multiple data entries. The time is controlled by an input to the timed structures palette.
    Here's a screencap of what I have. I'll be adding more signals to the output as I go. I'll also include the VI.
    Thank you!
    Attachments:
    sensor display.vi ‏102 KB

    What I would do is create a typedef cluster containing the data that you know you will want to write for each update. In this case, you will create a cluster with a timestamp control in it and two floats - for the three values you know about now. Do not forget to label the controls for what they will contain.
    VERY IMPORTANT: After creating this cluster, save it as a typedef!!!
    Now create a VI that takes that cluster as an input. Inside that VI, format the data from the cluster into a tab-delimited string and append it to the end of a file.
    Finally, bundle the three values that you have now and wire it to the cluster input of the VI you just created. Now as you add new values that you will want to save, you will need to add them to the typedef, add the formatting code inside the subVI, and add the value to the input cluster.
    Mike...
    As an exercise for the reader:
    You will probabliy also want to add some mechanism to your data saving VI to:
    Allow you to specify the path of the file to which you want to write, 
    Handle/report errors
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How can i import the data from multiple sources into single rpd in obiee11g

    how can i import the data from multiple sources into single rpd in obiee11g

    Hi,
    to import from multiple data sources, first configure ODBC connections for respective data sources. then you can import data from multiple data sources. When you import the data, a connection pool will create automatically.
    tnx

  • How to spool data into multiple Excel sheet if result is more then 65k rows

    Hi all,
    Wann spool data into multiple excel sheet bocz my resultant no of rows are more then 65k.
    Thanks to all in advance.....

    many choices
    1) migrate to a newer version of Excel
    2) split the files after spooling
    for instance with split
    split -l65000 file.txtor with perl, java, vb or what-so-ever
    3) do more than one report by using rownum
    spool f1
    select empno,ename  from (select rownum r,empno,ename from emp order by empno) where r<6 ;
    spool off
    spool f2
    select empno,ename  from (select * from (select rownum r,empno,ename from emp order by empno) where r<11) where r>5 ;
    spool off
    spool f3
    select empno,ename  from (select rownum r,empno,ename from emp order by empno) where r>10 ;
    spool off

  • How to send multiple row data into an internal table??

    I have a view with table control.i want to select multiple row and send all the row data into an internal table.i am able to select multiple row but all the selected row data is not going to the internal table.....only a particular row data which is lead selected is going.
    Do anyone can help me regarding this issue?
    Thanks in advance,
    Subhasis.

    Hey,
    Some code example:
    declaring an internal table and work area to get all the elements from the node.
    data : lt_Elements type  WDR_CONTEXT_ELEMENT_SET,
             ls_Element type  WDR_CONTEXT_ELEMENT_SET,
    considering flights is my node.
             lt_data type sflight.
    Node_Flights is the ref of the node to which ur table is binded.
    Use Code Inspector to read the node.
    lt_Element = Node_Flights->GET_ELEMENTS
    loop at lt_elements into ls_Element.
    l_bollean =   ls_elements->is_selected ( returns abap true/false ).
        if l_bollean IS INITIAL.
           append ls_Element to lt_data.
       endif.
    Hope this would help.
    Cheers,
    Ashish

  • Splitting comma seperated column data into multiple rows

    Hi Gurus,
    Please help me for solving below scenario. I have multiple value in single column with comma seperated values and my requirement is load that data into multiple rows.
    Below is the example:
    Source Data:
    Product         Size                                 Stock
    ABC              X,XL,XXL,M,L,S                 1,2,3,4,5,6
    Target Data:
    Product         Size                                 Stock
    ABC              X                                     1
    ABC              XL                                   2
    ABC              XXL                                 3
    ABC              M                                    4
    ABC              L                                      5
    ABC             S                                        6
    Which transformation we need to use for getting this output?
    Thanks in advance !

    Hello,
    Do you need to do this tranformation through OWB mapping only? And can you please tell what type of source you are using? Is it a flat file or a table?
    Thanks

  • Displaying data from multiple columns into a single line graph

    Post Author: hollowmatrix
    CA Forum: WebIntelligence Reporting
    Hey,I have an issue with the WEBI reporting.I have a data source that has multiple columns say ( month1, month2, month3, month4,.....month 12, month 13, ....month24) with the sales data for each month.Now say I call the month 1 to month 12 as "current year", and call month 13 - month 24 as "previous year".I want to put a prompt in the report which allows  me to select between "current year" and "previous year".Based on the prompt value we get a graph of the sales vs month ....as in if we select  "current year", then we get a graph of the sales Vs time( remember that the sales data for each month is in a different column.)and if we select  "previous year" then we get a graph of the sales Vs time for previous year..( sales vs time for Month 13, month 14, month 15....month 24).I am not able to pull data from multiple columns into a single object that I can use to populate the graphs.Any help on the same will be appreciated .   

    Hi,
    <p>
    please click
    here (asktom) and look for the words "how about the other way round"
    </p>

  • How to display rows of data into different columns?

    I'm new to SQL and currently this is what I'm trying to do: 
    Display multiple rows of data into different columns within the same row
    I have a table like this:
        CREATE TABLE TRIPLEG(
            T#              NUMBER(10)      NOT NULL,
            LEG#            NUMBER(2)       NOT NULL,
            DEPARTURE       VARCHAR(30)     NOT NULL,
            DESTINATION     VARCHAR(30)     NOT NULL,
            CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T#, LEG#),
            CONSTRAINT TRIPLEG_UNIQUE UNIQUE(T#, DEPARTURE, DESTINATION),
            CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T#) REFERENCES TRIP(T#) );
        INSERT INTO TRIPLEG VALUES( 1, 1, 'Sydney', 'Melbourne');
        INSERT INTO TRIPLEG VALUES( 1, 2, 'Melbourne', 'Adelaide');
    The result should be something like this:
    > T#  | ORIGIN  | DESTINATION1  |  DESTINATION2 
    > 1   | SYDNEY  | MELBORUNE     | ADELAIDE
    The query should include the `COUNT(T#) < 3` since I only need to display the records less than 3. How can I achieve the results that I want using relational views???
    Thanks!!!

    T#
    LEG#
    DEPARTURE
    DESTINATION
    1
    1
    Sydney
    Melbourne
    1
    2
    Melbourne
    Adelaide
    1
    3
    Adelaide
    India
    1
    4
    India
    Dubai
    2
    1
    India
    UAE
    2
    2
    UAE
    Germany
    2
    3
    Germany
    USA
    On 11gr2, you may use this :
      SELECT t#,
             REGEXP_REPLACE (
                LISTAGG (departure || '->' || destination, ' ')
                   WITHIN GROUP (ORDER BY t#, leg#),
                '([^ ]+) \1+',
                '\1')
        FROM tripleg
        where leg#<=3
    GROUP BY t#;
    Output:
    1 Sydney->Melbourne->Adelaide->India
    2 India->UAE->Germany->USA
    Cheers,
    Manik.

  • How to Restrict Single Delivery Date for PO with Multiple Line Items

    Dear Experts,
    How to Restrict Single Delivery Date for PO with Multiple Line Items.
    System needs to through Error Message if User Inputs Different Delivery Dates for PO with Multiple Line Items in ME21N Tcode.
    Can we achive this by Some Enhancement in SAP or Not ???
    If so how to do it.
    Any Inputs is highly appreciated.
    Thanks and Regards,
    Selvakumar. M

    Hi Selvakumar,
    we can resrict the PO to have a single delivery date in all the line items by means of giving a error message or overwiting the delivery date keyed/determined in the line item.
    You can use the BADI -> ME_PROCESS_PO_CUST. In which you need to implement the method PROCESS_SCHEDULE.
    (for technical aid - This method will be called for each and every PO line item, From the imporing parameter im_schedule we can get all the details of current PO line, even we can change the data in the current PO line. )
    Regards,
    Madhu.

Maybe you are looking for

  • Tempo

    Apple loops will not sync with the song tempo. When I import a real instrument loop into GB, and check the "follow tempo & pitch" box, sometimes the loop does not follow tempo. For example, a simple drumbeat may not follow the tempo even when its tem

  • MIRO posting with reference to Purchase Order

    Dear Experts, I've created a Purchase Order with reference to a purchase requisition. Now I want to post MIRO with reference to this Purchase Order Number to give payment to Vendor mentioned in Purchase order. But when I going to post miro amount not

  • Accounting doc not getting created

    Dear All, While releasing the billing doc to accounting i am getting the following message- 'Field text is a required field for g/l account xxx 89000'. xxx is the company code. Also when i go for the explanation of this it says- 'The value for field

  • OBIEE 11g - usins Query as column

    hi all, I have a requirement to convert this SQL as a column value in OBIEE level select count(*) from ( SELECT SUM(quantity),SUM(quantity_received),po_header_id FROM F_ERP_PO group by po_header_id having SUM(quantity) = SUM(quantity_received)) as a

  • HTML to Servlet connection

    I'm trying to debug a form submission to a servlet. I have an HTML with a form, and a servlet which processes the submission. If I deploy these files to Tomcat, they run fine and create the expected output. If I run the Servlet or the HTML in the int