MULTIPLE ROWS IN OBJECT RELATIONAL TABLE, HELP

Hi,
Here is my problem explanation. Please help. I have created an object type address, and a relational table called employee. One of the column in employee table is based on the type address. Now suppose I want to have 5 differrent addresses for a perticular employee how can I have it stored? The empno is the primary key .Here is the data strucure
address( line1 varchar2(30),city varchar2(30), state varchar2(20), zip varchar2(13))
employee
(empno number,
name varchar2(60),
emp_add address)
Thanks
Feroz

Well you could give your employees a nested table of addresses. But as William said, you really ought to use relational tables for this situation.
I haven't yet come across a compelling argument for using Types instead of tables for data storage, and there are lots of drawbacks. Duplication of data is just one.
Cheers, APC

Similar Messages

  • Printing out results in case of object-relational table (Oracle)

    I have made a table with this structure:
    CREATE OR REPLACE TYPE Boat AS OBJECT(
    Name varchar2(30),
    Ident number,
    CREATE OR REPLACE TYPE Type_boats AS TABLE OF Boat;
    CREATE TABLE HOUSE(
    Name varchar2(40),
    MB Type_boats)
    NESTED TABLE MB store as P_Boat;
    INSERT INTO House VALUES ('Name',Type_boats(Boat('Boat1', 1)));
    I am using java to print out all the results by calling a procedure.
    CREATE OR REPLACE package House_boats
    PROCEDURE add(everything works here)
    PROCEDURE results_view;
    END House_boats;
    CREATE OR REPLACE Package.body House_boats AS
    PROCEDURE add(everything works here) AS LANGUAGE JAVA
    Name House_boats.add(...)
    PROCEDURE results_view AS LANGUAGE JAVA
    Name House_boats.resuts_view();
    END House_boats;
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    CALL House_boats.results_view();
    House_boats.java file which is loaded using LOADJAVA:
    import java.sql.*;
    import java io.*;
    public class House_boats {
    public static void results_view ()
       throws SQLException
       { String sql =
       "SELECT * from House";
       try { Connection conn = DriverManager.getConnection
    ("jdbc:default:connection:");
       PreparedStatement pstmt = conn.prepareStatement(sql);
       ResultSet rset = pstmt.executeQuery();
      printResults(rset);
      rset.close();
      pstmt.close();
       catch (SQLException e) {System.err.println(e.getMessage());
    static void printResults (ResultSet rset)
       throws SQLException { String buffer = "";
       try { ResultSetMetaData meta = rset.getMetaData();
       int cols = meta.getColumnCount(), rows = 0;
       for (int i = 1; i <= cols; i++)
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       if (label.length() > size) size = label.length();
       while (label.length() < size) label += " ";
      buffer = buffer + label + " "; }
      buffer = buffer + "\n";
       while (rset.next()) {
      rows++;
       for (int i = 1; i <= cols; i++) {
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       String value = rset.getString(i);
       if (label.length() > size) size = label.length();
       while (value.length() < size) value += " ";
      buffer = buffer + value + " ";  }
      buffer = buffer + "\n";   }
       if (rows == 0) buffer = "No data found!\n";
       System.out.println(buffer); }
       catch (SQLException e) {System.err.println(e.getMessage());}  }
    How do I print out the results correctly in my case of situation?
    Thank you in advance

    I have made a table with this structure:
    I am using java to print out all the results by calling a procedure.
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    How do I print out the results correctly in my case of situation?
    There are several things wrong with your code and methodology
    1. The code you posted won't even compile because there are several syntax issues.
    2. You are trying to use/test Java in the database BEFORE you get the code working outside the DB
    3. Your code is not using collections in JDBC properly
    I suggest that you use a different, proven approach to developing Java code for use in the DB
    1. Use SIMPLE examples and then build on them. In this case that means don't add collections to the example until ALL other aspects of the app work properly.
    2. Create and test the Java code OUTSIDE of the database. It is MUCH easier to work outside the database and there are many more tools to help you (e.g. NetBeans, debuggers, DBMS_OUTPUT windows, etc). Trying to debug Java code after you have already loaded it into the DB is too difficult. I'm not aware of anyone, even at the expert level, that develops that way.
    3. When using complex functionality like collections first read the Oracle documentation (JDBC Developer Guide and Java Developer's Guide). Those docs have examples that are known to work.
    http://docs.oracle.com/cd/B28359_01/java.111/b31225/chfive.htm
    http://docs.oracle.com/cd/E11882_01/java.112/e16548/oraarr.htm#sthref583
    The main issue with your example is #3 above; you are not using collections properly:
    String value = rset.getString(i);
    A collection is NOT a string so why would you expect that to work for a nested table?
    A collection needs to be treated like a collection. You can even treat the collection as a separate result set. Create your code outside the database and use the debugger in NetBeans (or other) on this replacement code for your 'printResults' method:
    static void printResults (ResultSet rset) throws SQLException {
        try {
           ResultSetMetaData meta = rset.getMetaData();
           while (rset.next()) {
               ResultSet rs = rset.getArray(2).getResultSet();
               rs.next();
               String ndx = rs.getString(1);
               Struct struct = (Struct) rs.getObject(2);
               System.out.println(struct.getSQLTypeName());
               Object [] oa = struct.getAttributes();
               for (int j = 0; j < oa.length; j++) {
                  System.out.println(oa[j]);
        } catch  (SQLException e) {
           System.err.println(e.getMessage());
    That code ONLY deals with column 2 which is the nested table. It gets that collection as a new resultset ('rs'). Then it gets the contents of that nested table as an array of objects and prints out the attributes of those objects so you can see them.
    Step through the above code in a debugger so you can SEE what is happening. NetBeans also lets you enter expressions such as 'rs' in an evaluation window so you can dynamically try the different methods to see what they do for you.
    Until you get you code working outside the database don't even bother trying to load it into the DB and create a Java stored procedure.
    Since your current issue has nothing to do with this forum I suggest that you mark this thread ANSWERED and repost it in the JDBC forum if you need further help with this issue.
    https://forums.oracle.com/community/developer/english/java/database_connectivity
    When you repost you can include a link to this current thread if you want. Once your Java code is actually working then try the Java Stored procedure examples in the Java Developer's Guide doc linked above.
    At the point you have any issues that relate to Java stored procedures then you should post them in the SQL and PL/SQL forum
    https://forums.oracle.com/community/developer/english/oracle_database/sql_and_pl_sql

  • Hide multiple rows in a dynamic table based on the row value.

    Hi,
    I need to hide multiple rows in a dynamic table based on the specific value of that row.
    I cant find the right expression to do that.
    please help

    Go to the Row Properties, and in the Visibility tab, you have "Show or hide based on an expression". You can use this to write an expression that resolves to true if the row should be hidden, false otherwise.
    Additionally, in the Matrix properties you should take a look at the filters section, perhaps you can achieve what you wish to achieve through there by removing the unnecessary rows instead of just hiding them.
    It's only so much I can help you with the limited information. If you require further help, please provide us with more information such as what data are you displaying, what's the criteria to hiding rows, etc...
    Regards
    Andrew Borg Cardona

  • Extract Multiple Rows from a Single Table into a Single Row in a New Table

    I have a table in a database that contains contact data like name, address, phone number, etc.
    The folks who designed the database and wrote the application wrote it so that all contact records are placed in that table, regardless of contact type. In fact, the contacts table does not even have a column for "type" even though there are many
    different types of contacts present in that table.
    I am trying to write a mail merge style report in SRSS, that gets sent to a specific type of contact, based on criteria provided that must be obtained from another table, and that data is then used to get back to a specific set of contacts from the contacts
    table.
    The attached file directly below describes my problem and all related information in an extremely detailed way.
    SRSSMailMergeIssue.pdf
    Unless there is a way to make a SRSS Tablix point to two different data sets in SRSS, it looks like I have to combine multiple rows from the same table into a new table.
    If anyone can review the details in the attached pdf file and possibly point me in the direction I need to run to solve this probelm, I would greatly appreciate it.
    I also included a document (below) that shows the tables I reference in the probelm description.
    dbtables.pdf

    I found a solution.... and posted it below
    select
    dk.ucm_docketnumber [UCM DocketNumber],
    dk.ucm_docketid [UCM DocketID],
    vc.FirstName [Victim FirstName],
    vc.MiddleName [Victim MiddleName],
    vc.LastName [Victim LastName],
    vc.Suffix [Victim Suffix],
    vc.Address1_Line1 [Victim AddressLine1],
    vc.Address1_Line2 [Victim AddressLine2],
    vc.Address1_Line3 [Victim AddressLine3],
    vc.Address1_City [Victim City],
    vc.Address1_StateOrProvince [Victim StateProvince],
    vc.Address1_PostalCode [Victim Postalcode],
    oc.FirstName [Offender FirstName],
    oc.MiddleName [Offender MiddleName],
    oc.LastName [Offender LastName],
    oc.Suffix [Offender Suffix],
    oc.Address1_Line1 [Offender AddressLine1],
    oc.Address1_Line2 [Offender AddressLine2],
    oc.Address1_Line3 [Offender AddressLine3],
    oc.Address1_City [Offender City],
    oc.Address1_StateOrProvince [Offender StateProvince],
    oc.Address1_PostalCode [Offender Postalcode],
    pc.FirstName [Arresting Officer FirstName],
    pc.MiddleName [Arresting Officer MiddleName],
    pc.LastName [Arresting Officer LastName],
    pc.Address1_Line1 [Arresting Officer AddressLine1],
    pc.Address1_Line2 [Arresting Officer AddressLine2],
    pc.Address1_Line3 [Arresting Officer AddressLine3],
    pc.Address1_City [Arresting Officer City],
    pc.Address1_StateOrProvince [Arresting Officer StateProvince],
    pc.Address1_PostalCode [Arresting Officer Postalcode]
    FROM ucm_docket dk
    left outer join ucm_victim v on dk.ucm_docketid = v.ucm_docketnumber
    left outer join contact vc on vc.contactid = v.ucm_victimlookup
    left outer join ucm_offender o on o.ucm_offenderid = dk.ucm_offenderlookup
    left outer join contact oc on oc.contactid = o.ucm_individualid
    left outer join contact pc on pc.contactid = dk.ucm_ArrestingOfficerLookup
    WHERE (dk.ucm_docketnumber = @DocketNUM)

  • Load multiple rows of data in table

    hi i want to load multiple rows of data into table from flat file.
    i have oracle 10g enterprise edition, and can not find and envok
    sqlldr. edit command only does one line at a time.
    help please.

    thank you i got sqlldr.
    new problem
    i have created a control file customers.ctl
    LOAD DATA
    INFILE 'C:\ADD_CUST.TXT'
    INTO TABLE CUSTOMERS
    (CUSTOMER_NUMBER,LAST,FIRST,STREET,CITY,STATE,ZIP_CODE,BALANCE,CREDIT_LIMIT,SLSREP_NUMBER)
    and i have data to be loaded into the table in ADD_CUST.txt file.
    this is one line of data there are 9 similer lines.
    '124','ADAMS','SALLY','481 OAK','LANSING','MI','49224',818.75,1000,'03'
    now when i run sqlldr from cmd line below is the message i get.
    SQL*Loader: Release 10.2.0.1.0 - Production on Wed Feb 13 21:04:08 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    C:\>SQLLDR hr/hr control=CUSTOMERS.CTL log=customers.log
    SQL*Loader: Release 10.2.0.1.0 - Production on Wed Feb 13 22:10:19 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Commit point reached - logical record count 9
    Commit point reached - logical record count 10
    C:\>
    please help

  • Insert multiple rows into a same table from a single record

    Hi All,
    I need to insert multiple rows into a same table from a single record. Here is what I am trying to do and I need your expertise. I am using Oracle 11g
    DataFile
    1,"1001,2001,3001,4001"
    2,"1002,2002,3002,4002"
    The data needs to be loaded as
    Field1      Field2
    1               1001
    1               2001
    1               3001
    1               4001
    2               1002
    2               2002
    2               3002
    2               4002
    Thanks

    You could use SQL*Loader to load the data into a staging table with a varray column, then use a SQL insert statement to distribute it to the destination table, as demonstrated below.
    SCOTT@orcl> host type test.dat
    1,"1001,2001,3001,4001"
    2,"1002,2002,3002,4002"
    SCOTT@orcl> host type test.ctl
    load data
    infile test.dat
    into table staging
    fields terminated by ','
    ( field1
    , numbers varray enclosed by '"' and '"' (x))
    SCOTT@orcl> create table staging
      2    (field1  number,
      3     numbers sys.odcinumberlist)
      4  /
    Table created.
    SCOTT@orcl> host sqlldr scott/tiger control=test.ctl log=test.log
    SQL*Loader: Release 11.2.0.1.0 - Production on Wed Dec 18 21:48:09 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 2
    SCOTT@orcl> column numbers format a60
    SCOTT@orcl> select * from staging
      2  /
        FIELD1 NUMBERS
             1 ODCINUMBERLIST(1001, 2001, 3001, 4001)
             2 ODCINUMBERLIST(1002, 2002, 3002, 4002)
    2 rows selected.
    SCOTT@orcl> create table destination
      2    (field1  number,
      3     field2  number)
      4  /
    Table created.
    SCOTT@orcl> insert into destination
      2  select s.field1, t.column_value
      3  from   staging s, table (s.numbers) t
      4  /
    8 rows created.
    SCOTT@orcl> select * from destination
      2  /
        FIELD1     FIELD2
             1       1001
             1       2001
             1       3001
             1       4001
             2       1002
             2       2002
             2       3002
             2       4002
    8 rows selected.

  • Help with constraints on object relational tables

    Hi
    I am looking to create an object relational database with a check constraint on the relationships. For example:
    * I have table called person_tab which is a table of person_t type.
    * Person_t type is inherited by the manager_t type and the applicant_t type.
    * I have a second table called interview_tab of interview_t type.
    * The interview table has two columns (manager and appilcant) that are scope restrained to the person table.
    * I would also like to put check constraints on these columns to say:
    ----- Manager: check the person_number is less than 20000
    ----- Applicant: check the person_number is greater than 19999
    Can anyone tell me if this is possible and if so how can it be done?
    Thanks in advance
    Stephen

    You have circular dependencies (manager_t depends upon interview_list_t depends upon interview_t depends upon manager_t) which I don't think is a good idea. But then that's probably just my old-fashioned relational head baulking at this new-fangled OO way of looking at data models. However, my experience with using types and subtypes in Oracle does teach me that this is a complete pain in the neck, because it makes changing your Type definitions a very awkward process.
    am I right in saying I cannot use the check constraint?I think so. If the value range for ID is a property of being a Manager or an Applicant then properly that should be enforced by those types not by the Interview type. Then all that Interviews needs to worry about is that it gets instantiated with attributes of the correct Type.
    I've simplified your model a bit. To start with I'm going to create a single PERSONS table to store both managers and applicants...
    SQL> CREATE TYPE person_t AS OBJECT (
      2  personno NUMBER,
      3  surname VARCHAR2(30),
      4  forename VARCHAR2(30),
      5  dob DATE
      6  ) NOT FINAL;
      7  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE applicant_t UNDER person_t
      2  (qualifications varchar2(200))
      3  FINAL ;
      4  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE manager_t UNDER person_t
      2  (extension varchar2(5)) FINAL;
      3  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE interview_t AS OBJECT (
      2  interviewno NUMBER,
      3  idate DATE,
      4  itime NUMBER,
      5  interest NUMBER,
      6  is_made_by REF manager_t,
      7  attended_by REF applicant_t
      8  ) ;
      9  /
    Type created.
    SQL>
    SQL>
    SQL> CREATE TABLE persons OF person_t
      2  /
    Table created.
    SQL> CREATE TABLE interviews OF interview_t
      2  /
    Table created.
    SQL> Okay let's create some objects...
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  person_t;
      6     a_ref REF person_t;
      7  begin
      8     INSERT INTO persons p VALUES mgr
      9         RETURNING REF(p) INTO m_ref   ;
    10     INSERT INTO persons p VALUES app
    11         RETURNING REF(p) INTO a_ref   ;
    12     insert into interviews
    13     values (interview_t(1001, sysdate, 45, 5, TREAT(m_ref AS REF manager_t)
            , TREAT(a_ref AS REF applicant_t)));
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    SQL> SELECT i.interviewno, i.is_made_by.surname, i.attended_by.surname
      2  FROM interviews i
      3  /
    INTERVIEWNO IS_MADE_BY.SURNAME             ATTENDED_BY.SURNAME                 
           1001 RUNCITER                       CHIP                                
    SQL> Have we got integrity?
    SQL> rollback
      2  /
    Rollback complete.
    SQL>
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  person_t;
      6     a_ref REF person_t;
      7  begin
      8     INSERT INTO persons p VALUES mgr
      9         RETURNING REF(p) INTO m_ref   ;
    10     INSERT INTO persons p VALUES app
    11         RETURNING REF(p) INTO a_ref   ;
    12     insert into interviews
    13     values (interview_t(1001, sysdate, 45, 5, TREAT(a_ref AS REF manager_t)
             , TREAT(m_ref AS REF applicant_t)));
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> SELECT i.interviewno, i.is_made_by.surname, i.attended_by.surname
      2  FROM interviews i
      3  /
    INTERVIEWNO IS_MADE_BY.SURNAME             ATTENDED_BY.SURNAME                 
           1001                                                                    
    SQL> Kind of, but it's not very satisfactory. Let's use separate tables for MANAGERS and APPLICANTS...
    SQL> rollback
      2  /
    Rollback complete.
    SQL>
    SQL> CREATE TABLE managers OF manager_t
      2  /
    Table created.
    SQL>
    SQL> CREATE TABLE applicants OF applicant_t
      2  /
    Table created.
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  manager_t;
      6     a_ref REF applicant_t;
      7  begin
      8     INSERT INTO managers m VALUES mgr
      9         RETURNING REF(m) INTO m_ref   ;
    10     INSERT INTO applicants a VALUES app
    11         RETURNING REF(a) INTO a_ref   ;
    12     insert into interviews values (interview_t(1001, sysdate, 45, 5, m_ref, a_ref));
    13 
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> SELECT i.interviewno, i.is_made_by.surname, i.attended_by.surname
      2  FROM interviews i
      3  /
    INTERVIEWNO IS_MADE_BY.SURNAME             ATTENDED_BY.SURNAME                 
           1001 RUNCITER                       CHIP                                
    SQL> rollback
      2  /
    Rollback complete.
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  manager_t;
      6     a_ref REF applicant_t;
      7  begin
      8     INSERT INTO managers m VALUES mgr
      9         RETURNING REF(m) INTO m_ref   ;
    10     INSERT INTO applicants a VALUES app
    11         RETURNING REF(a) INTO a_ref   ;
    12     insert into interviews values (interview_t(1001, sysdate, 45, 5, a_ref, m_ref));
    13 
    14  end;
    15  /
       insert into interviews values (interview_t(1001, sysdate, 45, 5, a_ref, m_ref));
    ERROR at line 12:
    ORA-06550: line 12, column 69:
    PL/SQL: ORA-00932: inconsistent datatypes: expected REF APC.APPLICANT_T got REF
    APC.MANAGER_T
    ORA-06550: line 12, column 4:
    PL/SQL: SQL Statement ignored
    SQL>I hope that's useful to you.
    Cheers, APC
    Layout of SQL*Plus session tweaked for readability
    Message was edited by:
    APC

  • Multiple row selection in ADF Table using addition column with checkbox

    I am using ADF table(Jdeveloper11g) and i want to selecte multiple rows it may be more than one OR all rows.
    For that i added one Column to the table with Header Delete and checkbox
    <af:table....
    <af:column sortProperty="Delete" headerText="Delete" width="100"
    sortable="false">
    <af:selectBooleanCheckbox label="#{row.favoriteId}"
    valueChangeListener="#{Mybean.onCheck}"
    id="checkbox" autoSubmit="true">
    </af:selectBooleanCheckbox>
    </af:column>
    </af:table>
    backing bean:Here i added code to get Value of one column with id favoriteId and use an arrayList(listForDelete) to monitor the state of the checkboxes
    public void onCheck(ValueChangeEvent valueChangeEvent) {
    BindingContainer bindings = getBindings();
    DCBindingContainer dcBindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding iterBind =
    (DCIteratorBinding)bindings.get("getUserFavoritesByUserIDIterator");
    if (iterBind != null && iterBind.getCurrentRow() != null) {
    RichSelectBooleanCheckbox ch = (RichSelectBooleanCheckbox)valueChangeEvent.getSource();
    if (!ch.isSelected()) {
    Long issueId = (Long)iterBind.getCurrentRow().getAttribute("favoriteId");
    listForDelete.add(issueId);
    else
    Long issueId = (Long)iterBind.getCurrentRow().getAttribute("favoriteId");
    listForDelete.remove(issueId);
    Problem is that when i select single row checkBox, onCheck() method of backing bean gets called multiple times(equals to the number of rows)
    I think this is beacuse of <af:selectBooleanCheckbox id is same that is "checkbox" but i am not sure.Even i tried to assign some unique id but no any success in assigning Id with value Expression.
    I also find related post
    Re: ADF Table Multiple row selection by Managed Bean
    but that is related to Select All rows or Deselect all rows from table.
    From the simillar post i follow the steps given by Frank.but problem with below step
    ->have an af:clientAttribute assigned to the checkbox with the following EL #{row.key} ,here I added <af:clientAttribute name="#{row.key}"></af:clientAttribute> and i am getting error
    Error(64,37):  Static attribute must be a String literal, its illegal to specify an expression.
    Please let me know if any one had already implemented same test case.
    Thanks for all help
    Jaydeep
    Edited by: JaydeepJ on Aug 7, 2009 4:42 AM

    just to update after the rollback is called in the cancel button i wrote following code which does not change the row focus to the first row
    DCBindingContainer bc =
    (DCBindingContainer)BindingUtils.getBindingContext().getCurrentBindingsEntry();
    DCIteratorBinding profItr =
    bc.findIteratorBinding("ProfileSearchInstIterator");
    Row cRow = profItr.getRowAtRangeIndex(0);
    if(cRow != null){
    System.out.println("Current row is not null so fixed ");
    profItr.setCurrentRowIndexInRange(0);
    RowKeySetImpl rks = new RowKeySetImpl();
    ArrayList keyList = new ArrayList();
    keyList.add(cRow.getKey());
    rks.add(keyList);
    profileTable.setSelectedRowKeys(rks);
    AdfFacesContext.getCurrentInstance().addPartialTarget(profileTable);
    }

  • Merging of multiple rows in an internal table as a single record

    Hi All,
    I have an internal table which has the following columns:
    text, date, time, user.
    it stores notes in the internal table.
    The problem is...when I save a note with multiple lines and spaces it saves each line of the note as a row in the internal table.
    Thus i get more no. of rows in the internal table compare to the no. of rows!
    I need to store each notes as single row in the internal table.
    Please advise how to approach this?
    Helpful answers will be rewarded.
    Thanks & Regards,
    Anshumita.

    You can create a deep internal table. You can declare one Column as an internal table and store the NOTES in that Internal table for each row.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
    you can check the example in the link
    regards,
    abhishek

  • Update multiple rows in a dynamic table Dreamweaver CS5.5

    hello there
    i want to update multiple rows which comes from a dynamic table in Dreamweaver CS5 (a loop in php) here is my Mysql table :
    sql code
    CREATE TABLE `register`.`s_lessons` (
    `lid` int( 5 ) NOT NULL ,
    `sid` int( 9 ) NOT NULL ,
    `term` int( 5 ) NOT NULL ,
    `tid` int( 5 ) NOT NULL ,
    `point` double NOT NULL DEFAULT '0',
    PRIMARY KEY ( `lid` , `sid` , `term` ) ,
    KEY `tid` ( `tid` ) ,
    KEY `point` ( `point` )
    ) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_persian_ci;
    and this is my page source code:
    php file
    <?php require_once('../Connections/register.php'); ?>
    <?php
    session_start();
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $colname1_rs1 = "-1";
    if (isset($_GET['term'])) {
      $colname1_rs1 = $_GET['term'];
    $colname_rs1 = "-1";
    if (isset($_GET['lid'])) {
      $colname_rs1 = $_GET['lid'];
    $colname2_rs1 = "-1";
    if (isset($_SESSION['tid'])) {
      $colname2_rs1 = $_SESSION['tid'];
    mysql_select_db($database_register, $register);
    $query_rs1 = sprintf("SELECT s_lessons.sid, s_lessons.lid, s_lessons.term, s_lessons.tid, s_lessons.point FROM s_lessons WHERE s_lessons.lid = %s AND s_lessons.term = %s AND s_lessons.tid  = %s", GetSQLValueString($colname_rs1, "int"),GetSQLValueString($colname1_rs1, "int"),GetSQLValueString($colname2_rs1, "int"));
    $rs1 = mysql_query($query_rs1, $register) or die(mysql_error());
    $row_rs1 = mysql_fetch_assoc($rs1);
    $totalRows_rs1 = mysql_num_rows($rs1);
    $count=mysql_num_rows($rs1);
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    for ($j = 0, $len = count($_POST['lid']); $j < $len; $j++) {
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
      $updateSQL = sprintf("UPDATE s_lessons SET point=%s WHERE tid=%s, lid=%s, sid=%s, term=%s",
                           GetSQLValueString($_POST['point'] [$j], "double"),
                                GetSQLValueString($_SESSION['tid'], "int"),
                           GetSQLValueString($_POST['lid'] [$j], "int"),
                                GetSQLValueString($_POST['sid'] [$j], "int"),
                                GetSQLValueString($_POST['term'] [$j], "int"));
      mysql_select_db($database_register, $register);
      $Result1 = mysql_query($updateSQL, $register) or die(mysql_error());
      $updateGoTo = "student_lists.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>r</title>
    <link href="styles/style.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="styles/in_styles.css" rel="stylesheet" type="text/css" media="screen" />
    </head>
    <body>
    <div id="wrapper">
         <div id="header-wrapper">
         </div>
         <!-- end #header -->
         <div id="page">
              <div id="page-bgtop">
                   <div id="page-bgbtm">
                        <div id="content">
                             <div class="post">
                               <div style="clear: both;">
                            <form name="form1" id="form1" method="post" action="<?php echo $editFormAction; ?>">
                            <table border="1" align="center">
                              <tr>
                                <th>Student ID</th>
                                <th>Lesson ID</th>
                                <th>Semester</th>
                                <th>Point</th>
                              </tr>
                              <?php do { ?>
                                <tr>
                                  <td class="data"><label for="sid[]"></label>
                                  <input name="sid[]" type="text" id="sid[]" value="<?php echo $row_rs1['sid']; ?>" size="9" readonly="readonly" /></td>
                                  <td class="data"><label for="lid[]"></label>
                                  <input name="lid[]" type="text" id="lid[]" value="<?php echo $row_rs1['lid']; ?>" size="5" readonly="readonly" /></td>
                                  <td class="data"><label for="term[]"></label>
                                  <input name="term[]" type="text" id="term[]" value="<?php echo $row_rs1['term']; ?>" size="4" readonly="readonly" /></td>
                                  <td><label for="point[]"></label>
                                    <input name="point[]" type="text" id="point[]" value="<?php echo $row_rs1['point']; ?>" size="4" />                             
                              </tr>
                                <?php } while ($row_rs1 = mysql_fetch_assoc($rs1)); ?>
                            </table>
                            <p>
                              <input type="submit" name="Submit" id="Submit" value="Submit" />
                              <input type="hidden" name="MM_update" value="form1" />
                            </p>
                            </form>
                               </div>
                             </div>
                        <div style="clear: both;">
                    </div>
                        </div>
                        <!-- end #content -->
                        <!-- end #sidebar -->
                        <div style="clear: both;"> </div>
                   </div>
              </div>
         </div>
         <!-- end #page -->
    </div>
    <!-- end #footer -->
    </body>
    </html>
    <?php
    mysql_free_result($rs1);
    ?>
    All i want is that when users click on SUBMIT button values of point column in s_lessons(database table) be updated by new entries from user.
    i did my best and result with that code is :
    You  have an error in your SQL syntax; check the manual that corresponds to  your MySQL server version for the right syntax to use near ' lid=888,  sid=860935422, term=902' at line 1
    I would appreciate any idea.
    with prior thanks

    Go to the Row Properties, and in the Visibility tab, you have "Show or hide based on an expression". You can use this to write an expression that resolves to true if the row should be hidden, false otherwise.
    Additionally, in the Matrix properties you should take a look at the filters section, perhaps you can achieve what you wish to achieve through there by removing the unnecessary rows instead of just hiding them.
    It's only so much I can help you with the limited information. If you require further help, please provide us with more information such as what data are you displaying, what's the criteria to hiding rows, etc...
    Regards
    Andrew Borg Cardona

  • Multiple row update of a table from another one

    Im trying to make a multiple row update with date from a different table, but it's giving me an error.
    update inv.mtl_system_items_b
    set attribute1 = t2.description,
        last_update_date = SYSDATE,
        last_updated_by = 3606
    from inv.mtl_system_items_b t2
         inner join TMP.TMP_INACTIVAR_PRODUCTOS t1
         on t2.segment2 = t1.inventory_item_id;Edited by: user8986013 on 21-may-2010 14:15

    Hi,
    Whenever you have a question involving an error message, post the complete error message, including line number. Don't you think that might help people solve your problem?
    Whneve you have any question, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data. (In the case of a DM<L statement, like UPDATE, the INSERT statements show the tables before the change, and the results are the contents of the changed table after it.)
    Review the syntax of the UPDATE statement in the SQL Language manual:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10008.htm#sthref9598
    MERGE may be more efficient and easier to use than UPDATE.

  • How to create multiple rows in a child table from the multi select Lov

    Hi
    We have Departments and EmployDept and Persons tables and each employee can associate multiple departments and vice versa.While creating a Department page there should be a Multi Select LOV(values from Persons table) with search option for the Persons.From the search panel we can select multiple persons for that department.Suppose we have selected 5 persons and click on submit, then it should create 5 rows in the EmployDept table for 5 persons with that department id.
    Any inputs on how to implement this scenario please..

    Maybe you can get some ideas from here -
    http://adfdeveloper.blogspot.com/2011/07/simple-implementation-of-af.html

  • Multiple Rows Selection In Advance Table

    Hi All,
    I have a requirement to select multiple rows in advance table.After selection these rows they get added to the record list of another page on click of seeded submit button.This is my custom region.And this functionality is working for seeded region.
    I have added multiple selection component in advance table component.
    How should I make this functionality work for my custom region using the seeded submit button.
    Regards,SHD

    Hi,
    After selection these rows they get added to the record list of another page on click of seeded submit buttonon the click of submit button save the data to the table from where u are getting the data for the other page....Once this data get saved to the table, will definitely shows up in next page.
    Regards,
    Gyan

  • Deleting multiple rows from SUD dialog table

    Hi,
    I have some SUD dialog tables that I would like to delete some rows from.  I can select and delete all or one row (using a SUD button that finds out which one row was selected or if all, and then deleting them with the table.rows.remove command), but I seem to have troubles if I want to select multiple rows (either in a range, ex: rows 3-10, or non-sequential, ex: 1, 4, 6 and 23).  I just started working on this but thought maybe someone has already done this and can save me the trouble!
    Thanks!
    Julia Moeller

    Hi Julia,
    Just a quick guess-- try looping backwards and deleting the last rows first:
    FOR i = 10 TO 3 Step -1
      table.rows.remove i
    NEXT
    Haven't tested it, so no guarantees,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Insert multiple rows from cursor to table

    Hi,
    I want to insert multiple rows retrieved from cursor to a table without looping the cursor till the end of cursor.
    I have the following structure, plz guide me.
    Create procedure procedure_name as
    cursor mycursor as
    select * from table1; --returns multiple row
    t_data table1%rowtype;
    begin
    fetch mycursor to t_data;
    loop
    exit when cursor not found;
    insert to table2
    end loop;
    end procedure;
    ===========================
    Now my cursor contains multiple records. I can iterate the records in loop and insert data to another table e.g table2 with same structure.
    But I want to insert the total data at a time without looping the cursor for each data.Please suggest how to do this ?
    Thanks in advance.

    You should be able to do it in a single statement (assuming table1 and table2 have the same columns/datatypes)
    insert into table2 (select * from table1);

Maybe you are looking for