Rows into colum

Dear Friends,
I have a data like
     C_PACK_SLIP_NUM     C_SHIP_DATE     C_DELIVERY_NAME     C_WAYBILL
1     123 10/11/2011 4:53:45 PM      123
2     321     10/11/2011 4:54:15 PM     321     
3     124 10/11/2011 4:53:45 PM      124
4     421     10/11/2011 4:54:15 PM     421
5     126 10/11/2011 4:53:45 PM      126
6     621     10/11/2011 4:54:15 PM     621
now i want to covert the rows into columns
i want data like this
123 321 124 421 126 621
10/11/2011 10/11/2011 10/11/2011 10/11/2011 10/11/2011 10/11/2011
4:53:45 PM 4:53:45 PM 4:53:45 PM 4:53:45 PM 4:53:45 PM 4:53:45 PM
123 321 124 421 126 621
how can i do this
thanks in advance

Please post your question in the appropriate forum for a better/faster response -- PL/SQL
Thanks,
Hussein

Similar Messages

  • Rows into colums

    Hi to all,
    pls help me how to convert rows into columns
    I hav table like this
    PRODUCT_NAME     RM_RATE     MATERIAL_NAME
    aaaaaaaaaaa     51.52     PSPARLEG
    aaaaaaaaaaa     559.39     PBPARLE
    aaaaaaaaaaa     30.38     BOPP TAPE
    aaaaaaaaaaa     204.81 xcd
    aaaaaaaaaaa     16.76     CBPARLEG
    But i want like this
    PRODUCT_NAME PSPARLEG PBPARLE BOPP TAPE xcd CBPARLEG
    aaaaaaaaaa 51.52 5559.39 30.38 204.81 16.76     
    Pls help me...
    thanks,
    Yogisha

    Yogishag wrote:
    Thanks a lot for u r reply
    Actually it will for single product in my scenario i have n number of products.with same materil name..
    o pls help me how to write for all products..Not sure what you mean. It works just fine for multiple products...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'aaaaaaaaaaa' as PRODUCT_NAME, 51.52 as RM_RATE, 'PSPARLEG' as MATERIAL_NAME from dual union all
      2             select 'aaaaaaaaaaa', 559.39, 'PBPARLE' from dual union all
      3             select 'aaaaaaaaaaa', 30.38, 'BOPP TAPE' from dual union all
      4             select 'aaaaaaaaaaa', 204.81, 'xcd' from dual union all
      5             select 'aaaaaaaaaaa', 16.76, 'CBPARLEG' from dual union all
      6             select 'bbbbbbbbbbb', 559.39, 'PBPARLE' from dual union all
      7             select 'bbbbbbbbbbb', 30.38, 'BOPP TAPE' from dual union all
      8             select 'bbbbbbbbbbb', 204.81, 'xcd' from dual
      9            )
    10  --
    11  -- end of test data, just use below query on your own table
    12  --
    13  select product_name
    14        ,max(decode(material_name,'PSPARLEG',rm_rate)) as PSPARLEG
    15        ,max(decode(material_name,'PBPARLE',rm_rate)) as PBPARLE
    16        ,max(decode(material_name,'BOPP TAPE',rm_rate)) as BOPP_TAPE
    17        ,max(decode(material_name,'xcd',rm_rate)) as xcd
    18        ,max(decode(material_name,'CBPARLEG',rm_rate)) as CBPARLEG
    19  from t
    20* group by product_name
    SQL> /
    PRODUCT_NAM   PSPARLEG    PBPARLE  BOPP_TAPE        XCD   CBPARLEG
    aaaaaaaaaaa      51.52     559.39      30.38     204.81      16.76
    bbbbbbbbbbb                559.39      30.38     204.81As it says in the comment, just take the query and run it against your own table instead of the sample data I've used.

  • CONVERT ROWS INTO COLUMNS IN INTERNAL TABLE

    Hi Experts,
    I want to convert rows into coloumns in final internal table.
    How to do that one. Can any one help me its very urgent.
    Regards,
    PBS.

    hi,
    Find the below code for changing rows into colums.
    data: begin of itab1 occurs 0,
    fld,
    end of itab1.
    data: begin of itab2 occurs 0,
    fld1,
    fld2,
    fld3,
    end of itab2.
    itab1-fld = 1.
    append itab1.
    itab1-fld = 2.
    append itab1.
    itab1-fld = 3.
    append itab1.
    read table itab1 index 1.
    if sy-subrc eq 0.
    itab2-fld1 = itab1-fld.
    endif.
    read table itab1 index 2.
    if sy-subrc eq 0.
    itab2-fld2 = itab1-fld.
    endif.
    read table itab1 index 3.
    if sy-subrc eq 0.
    itab2-fld3 = itab1-fld.
    endif.
    append itab2.
    loop at itab1.
    write:/ itab1.
    endloop.
    loop at itab2.
    write:/ itab2.
    endloop.
    refer the below link for further information
    internal table rows to columns
    in the final display list how can i change rows to columns and vice versa

  • Interchanging rows and colums of internal table

    Hi all,
    I have one requirement to interchange the rows and colums of 3X3 internal table.(internal table contains 3 rows and 3 columns ). In the new internal table, I have to display the rows as column values and column values as rows..
    It's urgently. Kindly send me the sample code for the same.
    Thanks in advance.
    Ramesh.

    Hi ramesh,
    it is not possible to create a 'transponed' internal table if the (2) fields in your table arte or different type. Thus each row of the new table would be of different type.
    The quick solution for display is
    field-symbols:
      <any> type any.
    do.
      loop at itab.
        assign component sy-index of structure itab to <any>.
        if sy-subrc <> 0.
    * not assigned means no more components
          exit.
        endif.
        write <any>.
      endloop.
      if sy-subrc = 0.
    * start a new line for the next field
        write /.
      else.
    * all done
        exit.
      endif.
    enddo.
    If you really want to store the values in transposes table, you could do so by storing their references in fields of type REF TO DATA because this is good for any data.
    possible usage:
    types:
      ty_t_reftab type standard table of ref to data with default key,
      ty_t_transposed type standard table of ty_t_reftab with default key.
    data:
      lt_transposed type ty_t_transposed,
      lv_ref type ref to data.
    field-symbols:
      <any> type any,
      <transposed> type line of ty_t_transposed
    do.
      loop at itab.
        at first.
          append initial line to lt_transposed assigning <transposed>.
        endat.
        assign component sy-index of structure itab to <any>.
        if sy-subrc <> 0.
    * not assigned means no more components
          exit.
        endif.
        get refernce of <any> into lv_ref.
        append lv_ref to <transposed>. 
      endloop.
      if sy-subrc <> 0.
    * all done
        exit.
      endif.
    enddo.
    read table
    Sorry, don't know what it's good for. If you need the values, access them like
    loop at lt_transposed assigning <transposed>.
      loop at <transposed> assigning <any>.
        write <any>->*. "Hope that works with WRITE
      endloop.
    endloop.
    Regards,
    Clemens

  • Merging data in table rows into single page form to be printed?

    Hello all,
    I've been trying to make this work but after much hair pulling have had no luck with it.
    I have a three page pdf. On the first page are two tabls of employee names. Each row in the tables includes a cell for the employee name and also one that holds a checkbox. 
    The second and third pages are time sheets appropriate for the department that each employee is in. These two pages are hidden.
    So the idea is that if a particular employee is selected by the check mark, a time sheet with his name, dates and other info would be printed. One department is straightforward in that there is one sheet per employee.
    The trouble is with the other department, in that for that department, each time sheet has four columns, at the top of each goes one employee's name. So the logic for this department is as follows:
    1. count how many names are selected
    2. if four or less are selected, enter first selected name into the first row of the first column, the second into the first rown of the second column, the third into the first row of the third colum etc.  
    3. if more than four are selected, enter the first four names into the first page, print the page, and enter the remaining into the second page and print, and so on until all selected names are processed.
    1. works fine
    2. works fine
    3. works but not correctly.
    So if I have say six names selected, for example, aaa, ,bbb, ccc, ddd, eee, and fff what end at the top of the columns on first page is:
    eee, fff, ccc, ddd  and on the second page its the same thing
    The actual bit of formcalc script to do this is below, obviously it is incorrect or else missing something.
    Any pointers and suggestions (in formcalc if possible) would be very welcome and appreciated.
    Thanks.
    // use a for loop to count number of names selected. tabel has 15 employee names
    for i = 0 upto 14 do
          if ((not (form1.main.front.Table2.Row[i].dbmname.isNull | form1.main.front.Table2.Row[i].dbmname == "")) and (form1.main.front.Table2.Row[i].Checkbox == 1)) then    
                   ns = ns + 1    // ns = number of names selected
          endif
    endfor
    for i = 0 upto 14 do                         //if any names are selected then process and print desk and maintenance sheet
                                                           //check to see if selected rows are not empty     
                   if ((not (form1.main.front.Table2.Row[i].dbmname.isNull | form1.main.front.Table2.Row[i].dbmname == "")) and (form1.main.front.Table2.Row[i].Checkbox == 1)) then
                                                          //enter first selected name into column 1 and second into colum 2 etc... 
                 form1.dbm_sheet.Table3.header2.dbm_name[np] = form1.main.front.Table2.Row[i].dbmname.rawValue 
                                                           //np = name position to select next column that the next name will go into
                  np = np + 1
                                                           //ok - check if number of names selected was 4 or more and if first four names have been entered, lets print the first timesheet
                  if ((ns >= 4) and (np == 4)) then
                            xfa.host.print(1, "2", "2", 1, 1, 0, 0, 0)          //print sheet
                                                           //first sheet with 4 names is printed, therefore reduce ns by 4
                            ns = ns - 4
                                                           //first sheet printed, reset np to zero
                            np = 0
                                                          //if less than 4 names were selected OR are left after printing first 4 then process remaining names
                elseif ((ns  < 4) and (np == ns)) then
                                                 xfa.host.print(1, "2", "2", 1, 1, 0, 0, 0)
                                                        // blank remaining columns that are supposed to be empty : if there are less than four names to be printed on the sheet
                    for i = (np) upto 3 do
                                                                          form1.dbm_sheet.Table3.header2.dbm_name[np] = ""
                 endfor        
            endif
                        endfor
      endif
      endfor

    helo DV,
    to insert a new node element in the resulting model node following code can he used.
    wdContext.node<Node name>().validate();
    IPublic<controller>.I<node>Element ele = wdContext.create<node>Element(new <model structure type>());
    ele.set<attribute name>("<value>");
    wdContext.node<node name>().addElement(ele);
    now to traverse the model node and change a column value following code can be used.
    for(int i=0;i<wdContext.node<node name>().size();i++
    IPublic<controller>.I<node>Element ele = wdContext.node<node name>().get<node name>ElementAt(i);
    ele.set<attribute name>("");
    Regards,
    Piyush.

  • Convert one record row into multiple rows

    Hi,
       I have small requirement.I have selected one data base record into an internal table.Now internal table has 1 record i.e 1 row(ex: 10 columns). Now i will convert this single row record into multiple  records i.e 10 rows( 10 columns wil; be converted into 10 rows). How i will convert this. Please give me any idea on this.
    Regards
    Geetha

    Hi Geetha,
    Search SCN using keyword,  " convert Rows into columns" or vice versa,,,
    U will get more answers & solutions,
    Look at Some of the Previous threads....
    Re: How to create a structure of itab as rows as colums and columns rows dy
    Re: Transpose rows and columns
    CONVERT ROWS INTO COLUMNS IN INTERNAL TABLE
    Convert Internal table Rows into columns of another internal table
    how to convert columns of an internal table to rows of another internal tab.
    Convert Columns into Rows (internal tables) - Urgent Help Pleasse..
    converting columns to rows
    Thanks & regards,
    Dileep .C

  • How could I insert the deleted row into another table within a trigger?

    Hi,
    How could I insert the deleted row into another table within a trigger? The destination table has the same columns as the source table. Since the statements are in the trigger, it is not allowed to query the source table named 'test'. Thanks! The trigger is as follows, uncompleted:
    CREATE TRIGGER delete_trigger
    AFTER DELETE
    ON test
    FOR EACH ROW
    BEGIN
    -- How could I insert the deleted row into another table
    END delete_trigger;
    Message was edited by:
    user569548

    Hi,
    I'm not sure what's wrong there.
    I read the oracle docs about ANALYZE and ALL_TAB_COLUMNS, and did the following:
    ANALYZE TABLE my_tab VALIDATE STRUCTURE; //went ok.
    SELECT column_name
    FROM all_tab_columns
    WHERE table_name = 'my_tab'; //but no rows selected?
    This topic might not be what this thread should be about. Here I posted a new thread:
    How to get colum names of the newly created table?
    Thanks.
    Message was edited by:
    user569548

  • How To Concatenate Column Values from Multiple Rows into a Single Column?

    How do I create a SQL query that will concatenate column values from multiple rows into a single column?
    Last First Code
    Lesand Danny 1
    Lesand Danny 2
    Lesand Danny 3
    Benedi Eric 7
    Benedi Eric 14
    Result should look like:
    Last First Codes
    Lesand Danny 1,2,3
    Benedi Eric 7,14
    Thanks,
    David Johnson

    Starting with Oracle 9i
    select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
    from
    (select last, first, code, row_number() over(partition by last, first order by code) rn
    from a)
    connect by last = prior last and first = prior first and prior rn = rn -1
    start with rn = 1
    group by last, first
    LAST       FIRST      CODES                                                                                                                                                                                                  
    Lesand         Danny          1,2,3
    Benedi         Eric           7,14Regards
    Dmytro

  • Need help with turning multiple rows into a single row

    Hello.
    I've come across a situation that is somewhat beyond my knowledge base. I could use a little help with figuring this out.
    My situation:
    I am attempting to do some reporting from a JIRA database. What I am doing is getting the dates and times for specific step points of a ticket. This is resulting in many rows per ticket. What I need to do is return one row per ticket with a calculation of time between each step. But one issue is that if a ticket is re-opened, I want to ignore all data beyond the first close date. Also, not all tickets are in a closed state. I am attaching code and a sample list of the results. If I am not quite clear, please ask for information and I will attempt to provide more. The database is 10.2.0.4
    select jiraissue.id, pkey, reporter, summary
    ,changegroup.created change_dt
    ,dbms_lob.substr(changeitem.newstring,15,1) change_type
    ,row_number() OVER ( PARTITION BY jiraissue.id ORDER BY changegroup.created ASC ) AS order_row
    from jiraissue
    ,changeitem, changegroup
    ,(select * from customfieldvalue where customfield = 10591 and stringvalue = 'Support') phaseinfo
    where jiraissue.project = 10110
    and jiraissue.issuetype = 51
    and dbms_lob.substr(changeitem.newstring,15,1) in ('Blocked','Closed','Testing','Open')
    and phaseinfo.issue = jiraissue.id
    and changeitem.groupid = changegroup.id
    and changegroup.issueid = jiraissue.id
    order by jiraissue.id,change_dt
    Results:
    1     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2008-07-16 9:30:38 AM     Open     1
    2     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2008-07-16 11:37:02 AM     Testing     2
    3     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-06-08 9:14:52 AM     Closed     3
    4     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-09-02 11:29:37 AM     Open     4
    5     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-09-02 11:29:42 AM     Open     5
    6     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-09-02 11:29:50 AM     Testing     6
    7     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-09-02 11:29:53 AM     Closed     7
    8     23234     QCS-208     System Baseline - OK button does not show up in the Defer Faults page for the System Engineer role      2008-10-03 10:26:21 AM     Open     1
    9     23234     QCS-208     System Baseline - OK button does not show up in the Defer Faults page for the System Engineer role      2008-11-17 9:39:39 AM     Testing     2
    10     23234     QCS-208     System Baseline - OK button does not show up in the Defer Faults page for the System Engineer role      2011-02-02 6:18:02 AM     Closed     3
    11     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2008-09-29 2:44:54 PM     Open     1
    12     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2010-05-29 4:47:37 PM     Blocked     2
    13     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2011-02-02 6:14:57 AM     Open     3
    14     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2011-02-02 6:15:32 AM     Testing     4
    15     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2011-02-02 6:15:47 AM     Closed     5

    Hi,
    Welcome to the forum!
    StblJmpr wrote:
    ... I am attempting to do some reporting from a JIRA database. What is a JIRA database?
    I am attaching code and a sample list of the results. If I am not quite clear, please ask for information and I will attempt to provide more. Whenever you have a question, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and the results you want from that data.
    Simplify the problem as much as possible. For example, if the part you don't know how to do only involves 2 tables, then jsut post a question involving those 2 tables. So you might just post this much data:
    CREATE TABLE     changegroup
    (      issueid          NUMBER
    ,      created          DATE
    ,      id          NUMBER
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2008-07-16 09:30:38 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2008-07-16 11:37:02 AM', 'YYYY-MM-DD HH:MI:SS AM'),  20);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-06-08 09:14:52 AM', 'YYYY-MM-DD HH:MI:SS AM'),  90);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-09-02 11:29:37 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-09-02 11:29:42 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-09-02 11:29:50 AM', 'YYYY-MM-DD HH:MI:SS AM'),  20);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-09-02 11:29:53 AM', 'YYYY-MM-DD HH:MI:SS AM'),  90);
    INSERT INTO changegroup (issueid, created, id) VALUES (23234,  TO_DATE ('2008-10-03 10:26:21 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (23234,  TO_DATE ('2008-11-17 09:39:39 AM', 'YYYY-MM-DD HH:MI:SS AM'),  20);
    INSERT INTO changegroup (issueid, created, id) VALUES (23234,  TO_DATE ('2011-02-02 06:18:02 AM', 'YYYY-MM-DD HH:MI:SS AM'),  90);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2008-09-29 02:44:54 PM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2010-05-29 04:47:37 PM', 'YYYY-MM-DD HH:MI:SS AM'),  30);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2011-02-02 06:14:57 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2011-02-02 06:15:32 AM', 'YYYY-MM-DD HH:MI:SS AM'),  20);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2011-02-02 06:15:47 AM', 'YYYY-MM-DD HH:MI:SS AM'),  90);
    CREATE TABLE     changeitem
    (      groupid          NUMBER
    ,      newstring     VARCHAR2 (10)
    INSERT INTO changeitem (groupid, newstring) VALUES (10, 'Open');
    INSERT INTO changeitem (groupid, newstring) VALUES (20, 'Testing');
    INSERT INTO changeitem (groupid, newstring) VALUES (30, 'Blocked');
    INSERT INTO changeitem (groupid, newstring) VALUES (90, 'Closed');Then post the results you want to get from that data, like this:
    ISSUEID HISTORY
      21191 Open (0) >> Testing (692) >> Closed
      23234 Open (45) >> Testing (807) >> Closed
      23977 Open (607) >> Blocked (249) >> Open (0) >> Testing (0) >> ClosedExplain how you get those results from that data. For example:
    "The output contains one row per issueid. The HISTORY coloumn shows the different states that the issue went through, in order by created, starting with the earliest one and continuing up until the first 'Closed' state, if there is one. Take the first row, issueid=21191, for example. It started as 'Open' on July 16, 2008, then, on the same day (that is, 0 days later) changed to 'Testing', and then, on June 8, 2010, (692 days later), it became 'Closed'. That same issue opened again later, on September 2, 2010, but I don't want to see any activity after the first 'Closed'."
    The database is 10.2.0.4That's very important. Always post your version, like you did.
    Here's one way to get those results from that data:
    WITH     got_order_row     AS
         SELECT     cg.issueid
         ,     LEAD (cg.created) OVER ( PARTITION BY  cg.issueid
                                          ORDER BY      cg.created
                  - cg.created            AS days_in_stage
         ,       ROW_NUMBER ()     OVER ( PARTITION BY  cg.issueid
                                          ORDER BY      cg.created
                               )    AS order_row
         ,     ci.newstring                     AS change_type
         FROM    changegroup     cg
         JOIN     changeitem     ci  ON   cg.id     = ci.groupid
         WHERE     ci.newstring     IN ( 'Blocked'
                           , 'Closed'
                           , 'Testing'
                           , 'Open'
    --     AND     ...          -- any other filtering goes here
    SELECT       issueid
    ,       SUBSTR ( SYS_CONNECT_BY_PATH ( change_type || CASE
                                                             WHEN  CONNECT_BY_ISLEAF = 0
                                           THEN  ' ('
                                              || ROUND (days_in_stage)
                                              || ')'
                                                         END
                                    , ' >> '
               , 5
               )     AS history
    FROM       got_order_row
    WHERE       CONNECT_BY_ISLEAF     = 1
    START WITH     order_row          = 1
    CONNECT BY     order_row          = PRIOR order_row + 1
         AND     issueid               = PRIOR issueid
         AND     PRIOR change_type     != 'Closed'
    ORDER BY  issueid
    ;Combining data from several rows into one big delimited VARCHAR2 column on one row is call String Aggregation .
    I hope this answers your question, but I guessed at so many things, I won't be surprised if it doesn't. If that's the case, point out where this is wrong, post what the results should be in those places, and explain how you get those results. Post new data, if necessary.

  • Error inserting a row into a table with identity column using cfgrid on change

    I got an error on trying to insert a row into a table with identity column using cfgrid on change see below
    also i would like to use cfstoreproc instead of cfquery but which argument i need to pass and how to use it usually i use stored procedure
    update table (xxx,xxx,xxx)
    values (uu,uuu,uu)
         My component
    <!--- Edit a Media Type  --->
        <cffunction name="cfn_MediaType_Update" access="remote">
            <cfargument name="gridaction" type="string" required="yes">
            <cfargument name="gridrow" type="struct" required="yes">
            <cfargument name="gridchanged" type="struct" required="yes">
            <!--- Local variables --->
            <cfset var colname="">
            <cfset var value="">
            <!--- Process gridaction --->
            <cfswitch expression="#ARGUMENTS.gridaction#">
                <!--- Process updates --->
                <cfcase value="U">
                    <!--- Get column name and value --->
                    <cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
                    <cfset value=ARGUMENTS.gridchanged[colname]>
                    <!--- Perform actual update --->
                    <cfquery datasource="#application.dsn#">
                    UPDATE SP.MediaType
                    SET #colname# = '#value#'
                    WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
                    </cfquery>
                </cfcase>
                <!--- Process deletes --->
                <cfcase value="D">
                    <!--- Perform actual delete --->
                    <cfquery datasource="#application.dsn#">
                    update SP.MediaType
                    set Deleted=1
                    WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
                    </cfquery>
                </cfcase>
                <cfcase value="I">
                    <!--- Get column name and value --->
                    <cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
                    <cfset value=ARGUMENTS.gridchanged[colname]>
                    <!--- Perform actual update --->
                   <cfquery datasource="#application.dsn#">
                    insert into  SP.MediaType (#colname#)
                    Values ('#value#')              
                    </cfquery>
                </cfcase>
            </cfswitch>
        </cffunction>
    my table
    mediatype:
    mediatypeid primary key,identity
    mediatypename
    my code is
    <cfform method="post" name="GridExampleForm">
            <cfgrid format="html" name="grid_Tables2" pagesize="3"  selectmode="edit" width="800px" 
            delete="yes"
            insert="yes"
                  bind="cfc:sp3.testing.MediaType.cfn_MediaType_All
                                                                ({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
                  onchange="cfc:sp3.testing.MediaType.cfn_MediaType_Update({cfgridaction},
                                                {cfgridrow},
                                                {cfgridchanged})">
                <cfgridcolumn name="MediaTypeID" header="ID"  display="no"/>
                <cfgridcolumn name="MediaTypeName" header="Media Type" />
            </cfgrid>
    </cfform>
    on insert I get the following error message ajax logging error message
    http: Error invoking xxxxxxx/MediaType.cfc : Element '' is undefined in a CFML structure referenced as part of an expression.
    {"gridaction":"I","gridrow":{"MEDIATYPEID":"","MEDIATYPENAME":"uuuuuu","CFGRIDROWINDEX":4} ,"gridchanged":{}}
    Thanks

    Is this with the Travel database or another database?
    If it's another database then make sure your columns
    allow nulls. To check this in the Server Navigator, expand
    your DataSource down to the column.
    Select the column and view the Is Nullable property
    in the Property Sheet
    If still no luck, check out a tutorial, like Performing Inserts, ...
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp
    John

  • Need to insert rows into 100 tables at a time

    hi there,
    below is our script for creation of 100 tables...
    we need a plsql script, to insert rows into 100 tables at a single time...
    please help us...vey urgent...
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2(2000);
    BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_table'||counter||'
    (id integer primary key, col_a VARCHAR2(42),col_b date,col_c number,col_d varchar2(20),col_e varchar2(20),
    col_f varchar2(20),col_g varchar2(20),col_h date,col_i varchar2(20),col_j varchar2(20),col_k date)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END;
    /

    hi,
    below is our procedure and the error we are getting...
    Name Null? Type
    ID VARCHAR2(10)
    COL_A VARCHAR2(10)
    COL_B VARCHAR2(10)
    COL_C VARCHAR2(10)
    COL_D VARCHAR2(10)
    COL_E VARCHAR2(10)
    COL_F VARCHAR2(10)
    COL_G VARCHAR2(10)
    COL_H VARCHAR2(10)
    COL_J DATE
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2(4000);
    BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_a'||counter||'
    (id varchar2(10), col_a varchar2(10), col_b varchar2(10), col_c varchar2(10), col_d varchar2(10), col_e varchar2(10),
    col_f varchar2(10), col_g varchar2(10), col_h varchar2(10), col_j date)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END;
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2 (2000);
    BEGIN
    FOR OuterCounter IN 1 .. 100 LOOP --- table prefix in which it is to be inserted
    FOR InnerCounter IN 1 .. 100 LOOP --- records to be inserted
    sql_string := 'INSERT INTO emp_a' || Outercounter || ' (id, col_a, col_b, col_c, col_d, col_e, col_f, col_g, col_h, col_j)
    VALUES ('
    || InnerCounter || ', to_char( ''col_a''' || innercounter || '),'
    || InnerCounter || ', to_char( ''col_d''' || innercounter || '),'
    || ', to_char( ''col_e''' || innercounter || '),'
    || ', to_char( ''col_f''' || innercounter || '),'
    || ', to_char( ''col_g''' || innercounter || '),'
    || ', to_char( ''col_h''' || innercounter || '),'
    || ', to_char( ''col_j''' || innercounter || '), SYSDATE)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END LOOP;
    END;
    DECLARE
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    ORA-06512: at line 17
    please check the procedure and write the correct one...

  • Get Multiple Rows into internal Table using Webdynpro Alv Display ..

    Hi guys ,
    I need to find out the logic for getting all the selected rows into the internal table.
    When i display the ALV Output on webdypro screen .
    USer Selects multiple rows for further processing ..
    Ineed to get all the rows selected by user into an internal table .
    Please let me know how to achive this ...
    Thanks in advance for quick reply
    Regards
    Saurabh Goel

    Hi,
    You need to use the method GET_SELECTED of IF_WD_CONTEXT_NODE to get the rows selected. Also ccheck for the paramters of that method, this retruns the element set.
    This meets your requirement.
    Regards,
    Lekha.

  • Inserting rows into a data block

    Hi, how do i insert 'n' rows into a data block and after that commit the changes into the data base.
    Thanks for any help.

    You can use something like this:
    Go_Block('my_block');
    first_record;
    LOOP
    .... insert values to the items
    next_record;
    END LOOP;
    - for commiting changes
    Do_Key('Commit_Form');
    I hope this will help you.
    Helena

  • Inserting Multiple Rows into Database Table using JDBC Adapter - Efficiency

    I need to insert multiple rows into a database table using the JDBC adapter (receiver).
    I understand the traditional way of repeating the statement multiple times, each having its <access> element. However, I am just wondering whether this might be performance-inefficient, as it might insert records one by one.
    Is there a way to ensure that the records are inserted into the table as a block, rather than record-by-record?

    Hi Bhavesh/Kanwaljit,
    If we have multiple ACCESS tags then what happens is that the connection to the database is made only once. But the data is inserted row by row.
    Why i am saying this?
    If we add the following in JDBC Adapter..logSQLStatement = true. Then incase of multiple inserts we can see that there are multiple
    <i>Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','1000')
    Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','2000')</i>
    Doesnt this mean that rows are inserted one by one?
    Correct me if i am wrong.
    This does not mean that the transaction is not guaranted. Either all the rows will be inserted or rolled back.
    Regards,
    Sumit

  • Help in inserting rows into a table

    I have a table called acct_fact,
    I need to insert rows in the table using a script but the problem is there's a column called seq_nbr which has random seq nbr of 14character length like 'ZWX98MGD9MVAD6J','ZWX98MG67RVAD6J' etc.,
    While inserting rows I need to generate such seq_nbr for those columns and insert rows into the table, can I use any such mechanism in my insert query to insert such random nbr's while inserting rows into a table.
    If so please suggest me

    Hi Peter,
    Thankyou for the quick reply:)
    can you suggest me how to implement it here in my script snippet:
    while read var_acct_nbr
    do
    echo "update acct_attr set acct_attr_exp_dt ='$ExpDate' where Acct_Attr_Value_Text='15' and acct_attr_exp_dt is null and person_id='LDCarrBillAgrm' and acct_nbr='$var_acct_nbr' ;" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    echo "insert into acct_fact values ('$var_acct_nbr','$ExpDate','$ExpTime','*seq_nbr*','N','ProjTereza','Remoção de acordo d; data de expiração: $ExpDate',null,'1','LDE',null);" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    done < ./$DirectoryName/ExpireAccts_$TimeStamp.LOG
    the script takes each acct_nbr nbr form a input file and fires an insert statement.
    The one in bold is the column where such sequence need to be inserted.can you help me in implementing the way you suggested in my script i.e., insert statement
    Thanks in Advance:)
    Edited by: rkrish on Jun 27, 2012 3:04 AM

Maybe you are looking for

  • 802.1X EAP-PEAP Authentication issue

    Hi Experts, I am experiencing an issue where the authentication process for two of my Wireless networks prompts the user to enter their credentials at least two times before letting them onto the network. The networks in question  are set up identica

  • IDOC Error - Error Passing the IDOC

    Dear Experts,              I had a <removed by moderator> problem while saving the invoice.             In my case, IDOC is created and Status is shown as 03 (Data Passed to port OK), But the file is not written in Application server. In the status r

  • Business Purpose field hidden in ESS portal for only one user

    Hi All, We have one wiered error  while creating an expense reort in ESS portal and this is only for one employee out of 15,000 users. Problem: The additional information for expense type " Business Purpose " field was hidden for one employee and inf

  • Fonts issue [openbox/wordnet]

    This is the week of strange things for me... So: in my ~/.fonts.conf file there are these lines at the beginning: <!-- Font directory list --> <dir>/usr/share/fonts</dir> <dir>/usr/local/share/fonts</dir> <dir>~/.fonts</dir> All the programs work fin

  • Security prompt

    so we're trying to run a .bat file across the network and we get the annoying prompt, "we can not verify the file. Do you still want to run this file" we do this from the dfsn path \\domain.local\share\share using policy I add file://*.domain.local t