Multiple row as a single row in a column

Hi,
I want to select Multiple rows into a single line in 'Single Column Table' .
For ex:
Employee table has only one column , named as empname . it has three rows
Select empname from emp;
empname
thambi
peter
antony
My expected result: thambi,peter,antony

How do I ask a question on the forums?
https://forums.oracle.com/forums/thread.jspa?threadID=2174552#9360002

Similar Messages

  • Trying to convert multiple rows into multipe columns within a single row

    I am trying to convert data from multiple rows into multiple columns. Let me see if I can paint the picture for you.
    Here is a sample of the table i am trying to read from:
    Company Name Account
    1 Sam 123
    1 Sam 234
    1 Joe 345
    1 Sue 789
    1 Sue 987
    1 Sue 573
    I am trying to put this into a View that would have the data represented as such:
    Company Name Acct1 Acct2 Acct3 Acct4
    1 Sam 123 234 <null> <null>
    1 Joe 345 <null> <null> <null>
    1 Sue 789 987 573 <null>
    Many thanks in advance for your help!

    test@XE> --
    test@XE> with t as (
      2    select 1 as company, 'Sam' as name, 123 as account from dual union all
      3    select 1, 'Sam', 234 from dual union all
      4    select 1, 'Joe', 345 from dual union all
      5    select 1, 'Sue', 789 from dual union all
      6    select 1, 'Sue', 987 from dual union all
      7    select 1, 'Sue', 573 from dual)
      8  --
      9  select company,
    10         name,
    11         max(case when rn = 1 then account else null end) as acct1,
    12         max(case when rn = 2 then account else null end) as acct2,
    13         max(case when rn = 3 then account else null end) as acct3,
    14         max(case when rn = 4 then account else null end) as acct4
    15    from (select company,
    16                 name,
    17                 account,
    18                 row_number() over (partition by company, name order by 1) as rn
    19            from t)
    20   group by company, name;
       COMPANY NAM      ACCT1      ACCT2      ACCT3      ACCT4
             1 Joe        345
             1 Sam        234        123
             1 Sue        573        789        987
    3 rows selected.
    test@XE>
    test@XE>isotope

  • Collecting data from multiple rows into one column

    I'd like to run a query and put a collection of items into one output column instead of multiple rows. See the example below:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Prod
    PL/SQL Release 10.2.0.5.0 - Production
    "CORE     10.2.0.5.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
         CREATE TABLE "SKIP"."INGREDIENTS"
       (     "INGRED_ID" NUMBER,
         "INGRED_NAME" VARCHAR2(20 BYTE),
         "STORES" VARCHAR2(20 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGREDIENTS
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (1,'SEA SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (2,'TABLE SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (3,'FLOUR','Piggly Wiggly');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (4,'YEAST',null);
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (5,'BEER','ABC Store');
      CREATE TABLE "SKIP"."PRETZELS"
       (     "PRETZEL_ID" NUMBER,
         "PRETZEL_NAME" VARCHAR2(20 BYTE),
         "PRETZEL_DESC" VARCHAR2(100 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.PRETZELS
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (1,'CLASSIC','Classic knot pretzel');
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (2,'THICK STICK','Straight pretzel, abt 1/2" in dia');
      CREATE TABLE "SKIP"."INGRED_XREF"
       (     "PRETZEL_ID" NUMBER,
         "INGRED_ID" NUMBER
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGRED_XREF
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,1);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,4);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,3);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,5);
    --  Constraints for Table INGRED_XREF
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("PRETZEL_ID" NOT NULL ENABLE);
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("INGRED_ID" NOT NULL ENABLE);
    {code}
    Desired output (note how the ingredients are all listed in one column, separated by commas):
    {code}
    PRETZEL_ID PRETZEL_NAME     PRETZEL_DESC                        INGREDIENTS
    1          CLASSIC          Classic knot pretzel                SEA SALT, TABLE SALT, YEAST
    2          THICK STICK      Straight pretzel, abt 1/2" in dia   TABLE_SALT, FLOUR, BEER

    See the FAQ : {message:id=9360005}
    Especially links concerning string aggregation.

  • Empty table with multiples rows and 2 columns for processing data

    Hi,
    I am very new to adobe forms. I have the requirement that the user will enter some data in the table rows and I should process them to update in a z-table as well as use that data for MB1A tcode. I am not sure what to use here. Which is the best. I dont know anything about webdynpro. Can it be done directly in SFP transaction without using web-dynpro?
    Also if I need more rows I should give them the option to add rows. How does the submit button work here when the user enters the data in all the 10 rows.
    I heard about web services and I know a little about it, can it be achieved though that? Please help me. I need to finish 4 forms like this and each form should take me to the next form level.
    Kaps.

    Hello!
    You don´t have to tell me, I am the ABAP developer as well. I know that there is very little like ..."career" value in learning scripting in some obscure languages like Java script or Form Calc for Adobe forms. But trust me, you won´t have to learn much. You will have to learn how to manipulate the presence of form fields (or variable values, but that is the same like setting the presence to hidden, you only pass a constant or any other value).
    In the mentioned guide, in the last chapter you can just copy and next paste the ready to use scripting bacis. I think you should find the add/ remove row scripts there as well.
    The right scenario is not always easy to pick, consider this:
    - how many forms at the same time will the user have to fill? (if one --> offline, if more --> portal/ WD)
    - do you want the user to work with the NW portal? do you have licenses for the new users? (WD)
    - how often will the people fill their forms? how important the processes are? how many values will come from the backend tables (like how many search helps you would use if you can)
    etc. etc.
    Hope that clarifies things a little for you
    regards Otto

  • ALV column header with multiple rows and ALV column header span

    How could I have in an ALV a column header on several lines and/or a column header that spans on multiple columns?
    i.e. I would like to have in an ALV two columns, each with it's own distinct header and additionally another column header for both of the columns, that spans across both columns. How could I program this?

    Hi,
    follow below mentioned code
    SET THE LABEL OF THE COLUMN
    DATA: hr_weeknum TYPE REF TO cl_salv_wd_column_header.
    CALL METHOD lr_weeknum->get_header
    RECEIVING
    value = hr_weeknum.
    CALL METHOD lr_weeknum->set_resizable
    EXPORTING
    value = abap_false.
    hr_weeknum->set_prop_ddic_binding_field(
    property = if_salv_wd_c_ddic_binding=>bind_prop_text
    value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
    set the text of the column
    CALL METHOD hr_weeknum->set_text
    EXPORTING
    value = 'C Form'.
    Regards,
    Srini.

  • Multiple Rows Into One Column Field

    Hi All,
           Today I tried one query:
    select wm_concat(ename) from emp
    group by deptno;
    I have a data that looks like this.
    CLARK,KING,MILLER,SREE
    JONES,FORD,ADAMS,SCOTT
    ALLEN,MARTIN,BLAKE,TURNER,JAMES,WARD
    Can someone help me to build an SQL command that would have the output as follows:
    I need per column 3 values....
    CLARK,KING,MILLER,
    SREE,JONES,FORD,
    ADAMS,SCOTT,ALLEN,
    MARTIN,BLAKE,TURNER,
    JAMES,WARD

    StewAshton wrote:
    That's funny, I don't get the same answer
    Why do you think you should?
    Besides, you're not the only one.
    ENAMES
    KING,BLAKE,CLARK
    JONES,SCOTT,FORD
    SMITH,ALLEN,WARD
    MARTIN,TURNER,ADAMS
    JAMES,MILLER
    Regards
    Etbin
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    It's from my APEX Workspace: first select from the emp table (not touched until now)
    Message was edited by: Etbin

  • Concatenating multiple rows from asingle column

    hi,
    Could anyone help me in writing a query for following
    I have columns
    A B
    1 a
    1 b
    1 c
    2 d
    2 e
    3 f
    3 g
    O/p
    C
    1 abc,
    2 de,
    3 fg
    can anyone help me out in writing this ...I appriciate it.
    Thanks,

    SELECT  A,
            REPLACE(SYS_CONNECT_BY_PATH(B,','),',') B
      FROM  (
             SELECT  A,
                     B,
                     ROW_NUMBER() OVER(PARTITION BY A ORDER BY B) RN,
                     COUNT(*) OVER(PARTITION BY A) CNT
               FROM  TBL
      WHERE RN = CNT
      START WITH RN = 1
      CONNECT BY A = PRIOR A
             AND RN = PRIOR RN + 1
      ORDER BY A
    /SY.

  • Downloading .xls file with multiple rows and Columns

    Hi ALL,
    I need to genarate .xls file with multiple rows and and Columns and sent as an email.Since our customer having Problem with .CSV files need to genarate .XLS file.
    Please do the needful.
    Thanks
    Madhu

    Hi Madhu,
    You might also consider using Excel Spreadsheet XML as the target structure (namespace is urn:schemas-microsoft-com:office:spreadsheet).  When you double-click the resulting xml on a PC it automatically opens with Excel. So, users don't see a difference.  It will open up a lot of options with formatting including creating multiple worksheets if you wanted to.  Best of all you can stick with XML.
    See my response in this thread:
    Re: Convert XML data into XLS 
    Thanks,
    -Russ

  • Free alternatives to JTable that allow multiple rows in the header?

    My goal is to make a table with two or more rows in the column header. For instance, imagine I want to have the numbers of the days in the calendar as columns, then I want to have a row over them with the months, spanning over multiple days, then I want to have a row over that with the year, spanning over multiple months. I want these rows to be in the column header so they're always visible as you scroll down.
    Right now, I'm doing this with the first rows of the grid, out of the header, so they get out of view when the user scrolls down. Also, by being in the actual grid, they screw up sorting of the table.
    So I need 2 features. Multiple rows in the column header and the ability to merge multiple cells in the header.
    I've see some code to do this but it seemed too complicated so I want to see if I can find a component that does this out of the box first. I've seen 2 3rd party JTable-based components that do this but they're paid products and paying the full price of a component bundle for these features isn't a very attractive idea.
    So, does anyone know of a good table component that does this?

    Have a look at JXTable from the SwingX project. You should be able to find it via Google.

  • Multiple rows Converge to Single row and join

    Hi Folks,
    I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
    Table 1: DTL_TABLE (id, period, course, names, title, type)
    1 2010 mat john null null
    1 2010 mat jim null null
    1 2010 cam null officer null
    1 2010 cam null Prof null
    1 2010 phy null null Inclass
    1 2010 phy null null Online
    Join with
    Table 2: ID_TABLE(id, period, Loc, Dept, Code)
    1 2010 nj 101 CC.
    Output format (id, period, course, names, title, type, Loc, Dept, Code)
    result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
    I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
    Thank you,
    Aj
    CREATE TABLE DTL_TABLE
       ids      VARCHAR2 (10),
       period   VARCHAR2 (10),
       course   VARCHAR2 (10),
       names    VARCHAR2 (10),
       title    VARCHAR2 (10),
       TYPE     VARCHAR2 (10)
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'mat',
                 'jim',
                 NULL,
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'mat',
                 'john',
                 NULL,
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'mat',
                 'kale',
                 NULL,
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'cam',
                 NULL,
                 'officer',
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'cam',
                 NULL,
                 'prof',
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'phy',
                 NULL,
                 NULL,
                 'inclass');
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'phy',
                 NULL,
                 NULL,
                 'online');
    COMMIT;
    CREATE TABLE id_table
       ids      VARCHAR2 (10),
       period   VARCHAR2 (10),
       loc      VARCHAR2 (10),
       dept     VARCHAR2 (10),
       code     VARCHAR2 (10)
    INSERT INTO id_table
         VALUES ('1',
                 '2010',
                 'nj',
                 '101',
                 'cc');
    COMMIT;

    Aj09 wrote:
    Hi Folks,
    I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
    Table 1: DTL_TABLE (id, period, course, names, title, type)
    1 2010 mat john null null
    1 2010 mat jim null null
    1 2010 cam null officer null
    1 2010 cam null Prof null
    1 2010 phy null null Inclass
    1 2010 phy null null Online
    Join with
    Table 2: ID_TABLE(id, period, Loc, Dept, Code)
    1 2010 nj 101 CC.
    Output format (id, period, course, names, title, type, Loc, Dept, Code)
    result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
    I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
    SELECT TBL.id,
           DTLperiod,
           course,
           names,
           title,
           TYPE,
           Loc,
           Dept,
           Code
    FROM   ID_TABLE TBL,
           DTL_TABLE DTL
    WHERE  TBL.ID = DTL.ID
           AND TBL.PERIOD = DTL.PERIOD; it not good to use RESERVED WORDS like "ID" or "TYPE" as column names

  • 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

  • Is there a way in Oracle to return multiple rows as a single string?

    Hi gurus,
    I just got help from your guys fixing my dynamic sql problem. What I am doing in that function is to return a single string from multiple rows and I use it in the select statement. It works fine once the problem was solved. But is there any way in Oracle to do this in the select statement only? I have a table that stores incidents (incident_id is the PK) and another table that stores the people that are involved in an incident.
    Incident_table
    (incident_id number PK);
    Incident_people_table
    (incident_id number PK/FK,
    person_id number PK);
    Now in a report, I need to return the multiple rows of the Incident_People_table as a single string separated by a comma, for example, 'Ben, John, Mark'. I asked the SQL Server DBA about this and he told me he can do that in SQL Server by using a variable in the sql statement and SQL Server will auomatically iterate the rows and concatenate the result (I have not seen his actual work). Is there a similar way in Oracle? I have seen some examples here for some similar requests using the sys_connect_by_path, but I wonder if it is feasible in a report sql that is already rather complex. Or should I just stick to my simpler funcion?
    Thanks.
    Ben

    Hi,
    May be, this example will help you.
    SQL> CREATE TABLE Incident_Table(
      2    incident_id number
      3  );
    Table created.
    SQL> CREATE TABLE Person_Table(
      2    person_id number,
      3    person_name VARCHAR2(200)
      4  );
    Table created.
    SQL> CREATE TABLE Incident_People_Table(
      2    incident_id number,
      3    person_id number
      4  );
    Table created.
    SQL> SELECT * FROM Incident_Table;
    INCIDENT_ID
              1
              2
    SQL> SELECT * FROM Person_Table;
    PERSON_ID PERSON_NAME
             1 John
             2 Mark
             3 Ben
             4 Sam
    SQL> SELECT * FROM Incident_People_Table;
    INCIDENT_ID  PERSON_ID
              1          1
              1          2
              1          3
              2          1
              2          2
              2          4
    6 rows selected.
    SQL> SELECT IT.*,
      2    (
      3      WITH People_Order AS (
      4        SELECT IPT.incident_id, person_id, PT.person_name,
      5          ROW_NUMBER() OVER (PARTITION BY IPT.incident_id ORDER BY PT.person_name) AS Order_Num,
      6          COUNT(*) OVER (PARTITION BY IPT.incident_id) AS incident_people_cnt
      7        FROM Incident_People_Table IPT
      8          JOIN Person_Table PT USING(person_id)
      9      )
    10      SELECT SUBSTR(SYS_CONNECT_BY_PATH(PO.person_name, ', '), 3) AS incident_people_list
    11      FROM (SELECT * FROM People_Order PO WHERE PO.incident_id = IT.incident_id) PO
    12      WHERE PO.incident_people_cnt = LEVEL
    13      START WITH PO.Order_Num = 1
    14      CONNECT BY PRIOR PO.Order_Num = PO.Order_Num - 1
    15    ) AS incident_people_list
    16  FROM Incident_Table IT
    17  ;
    INCIDENT_ID INCIDENT_PEOPLE_LIST
              1 Ben, John, Mark
              2 John, Mark, SamRegards,
    Dima

  • Multiple rows in a single row.

    I want to know how can I store the values of multiple rowe in a single row.for an example..
    machine name    manchine no  frequency   month
    Lathe                  MOO1          yearly         jan
    Lathe                  MOO1          halfyearly   feb
    Lathe                  MOO1         weekly       march and so on
    I want this in a single row..
    like                        jan       feb             march
    Lathe       M001   yearly     halfyearly   weekly.
    and in a single row I want this as per the month specified .
    In my report I have 12 months distribution for each machine.

    Taruna,
    Just make sure understand the scenario correctly. Would you like to store the row in DB like this:
    Lathe MOO1 yearly jan,feb,mar
    then you expect to show in the report like this:
    Lathe MOO1 yearly jan
    Lathe MOO1 yearly feb
    Lathe MOO1 yearly mar
    Yes, you can do it this way, but somehow break the 1st principle of DB schema design - Atomic
    Of course, you need to convert jan,feb,mar into list and display for each row.
    string monthStr = "jan,feb,mar";
    string [] months = monthStr.Split(",");
    Kind Regards
    -Yatsea

  • How do I insert multiple rows from a single form ...

    How do I insert multiple rows from a single form?
    This form is organised by a table. (just as in an excel format)
    I have 20 items on a form each row item has five field
    +++++++++++ FORM AREA+++++++++++++++++++++++++++++++++++++++++++++++++++++
    +Product| qty In | Qty Out | Balance | Date +
    +------------------------------------------------------------------------+
    +Item1 | textbox1 | textbox2 | textbox3 | date +
    + |value = $qty_in1|value= &qty_out1|value=$balance1|value=$date1 +
    +------------------------------------------------------------------------+
    +Item 2 | textbox1 | textbox2 | textbox4 | date +
    + |value = $qty_in2|value= $qty_out1|value=$balance2|value=$date2 +
    +------------------------------------------------------------------------+
    + Item3 | textbox1 | textbox2 | textbox3 | date +
    +------------------------------------------------------------------------+
    + contd | | | +
    +------------------------------------------------------------------------+
    + item20| | | | +
    +------------------------------------------------------------------------+
    + + + SUBMIT + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Database Structure
    +++++++++++++++++
    + Stock_tabe +
    +---------------+
    + refid +
    +---------------+
    + item +
    +---------------+
    + Qty In +
    +---------------+
    + Qty Out +
    +---------------+
    + Balance +
    +---------------+
    + Date +
    +++++++++++++++++
    Let's say for example user have to the use the form to enter all 10 items or few like 5 on their stock form into 4 different textbox field each lines of your form, however these items go into a "Stock_table" under Single insert transaction query when submit button is pressed.
    Please anyone help me out, on how to get this concept started.

    Hello,
    I have a way to do this, but it would take some hand coding on your part. If you feel comfortable hand writing php code and doing manual database calls, specificaly database INSERT calls you should be fine.
    Create a custom form using the ADDT Custom Form Wizard that has all the rows and fields you need. This may take a bit if you are adding the ability for up to 20 rows, as per your diagram of the form area. The nice thing about using ADDT to create the form is that you can setup the form validation at the same time. Leave the last step in the Custom Form Wizard blank. You can add a custom database call here, but I would leave it blank.
    Next, under ADDT's Forms Server Behaviors, select Custom Trigger. At the Basic tab, you enter your custom php code that will be executed. Here you are going to want to put your code that will check if a value has been entered in the form and then do a database INSERT operation on the Stock_table with that row. The advanced tab lets you set the order of operations and the name of the Custom Trigger. By default, it is set to AFTER. This means that the Custom Trigger will get executed AFTER the form data is processed by the Custom Form Transaction.
    I usually just enter TEST into the "Basic" tab of the Custom Trigger. Then set my order of operations in the "Advanced" tab and close the Custom Trigger. Then I go to the code view for that page in Dreamweaver and find the Custom Trigger function and edit the code manually. It's much easier this way because the Custom Trigger wizard does not show you formatting on the code, and you don't have to keep opening the Wizard to edit and test your code.
    Your going to have to have the Custom Trigger fuction do a test on the submitted form data. If data is present, then INSERT into database. Here's a basic example of what you need to do:
    In your code view, the Custom Trigger will look something like this:
    function Trigger_Custom(&$tNG) {
    if($tNG->getColumnValue("Item_1")) {
    $item1 = $tNG->getColumnValue("Item_1");
    $textbox1_1 = $tNG->getColumnValue("Textbox_1");
    $textbox1_2 = $tNG->getColumnValue("Textbox_2");
    $textbox1_3 = $tNG->getColumnValue("Textbox_3");
    $date1 = $tNG->getColumnValue("Textbox_3");
    $queryAdd = "INSERT INTO Stock_table
    (item, Qty_In, Qty_Out, Balance, Date) VALUES($item1, $textbox1_1, $textbox1_2, $textbox1_3, $date1)"
    $result = mysql_query($queryAdd) or die(mysql_error());
    This code checks to see if the form input field named Item_1 is set. If so, then get the rest of the values for the first item and insert them into the database. You would need to do this for each row in your form. So the if you let the customer add 20 rows, you would need to check 20 times to see if the data is there or write the code so that it stops once it encounters an empty Item field. To exit a Custom Trigger, you can return NULL; and it will jump out of the function. You can also throw custom error message out of triggers, but this post is already way to long to get into that.
    $tNG->getColumnValue("Item_1") is used to retrieve the value that was set by the form input field named Item_1. This field is named by the Custom Form Wizard when you create your form. You can see what all the input filed names are by looking in the code view for something like:
    // Add columns
    $customTransaction->addColumn("Item_1", "STRING_TYPE", "POST", "Item_1");
    There will be one for each field you created with the Custom Form Wizard.
    Unfortunately, I don't have an easy way to do what you need. Maybe there is a way, but since none of the experts have responded, I thought I would point you in a direction. You should read all you can about Custom Triggers in the ADDT documentation/help pdf to give you more detailed information about how Custom Triggers work.
    Hope this helps.
    Shane

  • Concatenate multiple row values into single column value

    Hello,
    Can anyone please refresh my memory on how to concatenate multiple row values into a single column value.
    In the following query, I will get multiple denial reasons per application and I would rather return all denial reasons on one line.
    SELECT a.application_id, a.membership_number,
    r.reason_text AS denial_reason,
    a.appl_receipt_date AS application_receipt_date,
    a.plan_request_1 AS application_plan_code,
    a.adjudication_date AS application_denial_date
    FROM application a, PLAN p, application_reason ar, reason r
    WHERE a.plan_request_1 = p.plan_cd
    AND a.application_id = ar.application_id
    AND ar.reason_id = r.reason_id
    AND a.adjudication_cd = 'D'
    AND a.appl_receipt_date BETWEEN '01-jan-2006' AND '31-dec-2006'
    AND p.plan_type_id = 12 and a.application_id = :appId
    ORDER BY application_id
    Any help is greatly appreciated.
    Thanks,
    -Christine

    found the following
    SELECT deptno,
           LTRIM(MAX(SYS_CONNECT_BY_PATH(ename,','))
           KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
    FROM   (SELECT deptno,
                   ename,
                   ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) AS curr,
                   ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) -1 AS prev
            FROM   emp)
    GROUP BY deptno
    CONNECT BY prev = PRIOR curr AND deptno = PRIOR deptno
    START WITH curr = 1;
        DEPTNO EMPLOYEES
            10 CLARK,KING,MILLER
            20 ADAMS,FORD,JONES,SCOTT,SMITH
            30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
    3 rows selected.at http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php

  • Multiple row values of a column  (variable)  into a single record

    Hi,
    I have the follwing table structure - ITEM_MASTER
    Item Item_Parent Item_Type
    ------- ---------------------- -----------1000 ITEM
    998272 1000 EAN
    998873 1000 EAN
    998874 1000 EAN
    I need it as follows:
    Item EAN1 EAN2 EAN3
    1000 998272 998873 998874
    The query I am trying to use outer join as follows but without success:
    select im.item, im_ean1.item,
    from ITEM_MASTER im
    LEFT OUTER JOIN on ITEM_MASTER im_ean1
    on (im.item = im_ean1.item_parent and im_ean1 = 'EAN' )
    I am not getting the 3 EANs in a single row.
    I am getting them in multiple rows.
    Please suggest how should I proceed.
    Thanks in advance
    Suddha Satta Ray

    RANK may give you multiple time same occurrence, that's why I used ROW_NUMBER, see example below :
    SQL> ed
    Wrote file afiedt.buf
      1  select sal,
      2         rank() over (order by sal) rk,
      3         dense_rank() over (order by sal) drf,
      4         row_number() over (order by sal) rn
      5* from emp
    SQL> /
           SAL         RK        DRF         RN
           800          1          1          1
           950          2          2          2
          1100          3          3          3
          1250          4 4          4
          1250          4 4          5
          1300          6          5          6
          1500          7          6          7
          1600          8          7          8
          2450          9          8          9
          2850         10          9         10
          2975         11         10         11
          3000         12 11         12
          3000         12 11         13
          5000         14         12         14
    14 rows selected.
    Elapsed: 00:00:00.00
    SQL> Maybe it's your problem.
    Nicolas.

Maybe you are looking for