Am inserting only one table in a join table view

am in Jdeveloper 11.1.2.1.0
hi i have the following view am only able to insert in one table,which is SMS_PARTY_ADDRESS,am not able to insert to the othe join table which is property, my view is
<?xml version="1.0" encoding="windows-1252" ?>
<!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
<!---->
<ViewObject
  xmlns="http://xmlns.oracle.com/bc4j"
  Name="smsProp_partyAddress"
  Version="11.1.2.60.81"
  BindingStyle="OracleName"
  CustomQuery="true"
  PageIterMode="Full"
  UseGlueCode="false">
  <DesignTime>
    <Attr Name="_isExpertMode" Value="true"/>
  </DesignTime>
  <Properties>
    <SchemaBasedProperties>
      <LABEL
        ResId="sms1100.smsProp_partyAddress_LABEL"/>
    </SchemaBasedProperties>
  </Properties>
  <ViewAccessor
    Name="Sub_lov1"
    ViewObjectName="sms1100.Sub_lov"
    RowLevelBinds="true"/>
  <ListBinding
    Name="LOV_Town"
    ListVOName="Sub_lov1"
    ListRangeSize="-1"
    ComboRowCountHint="10"
    NullValueFlag="none"
    MRUCount="0">
    <AttrArray Name="AttrNames">
      <Item Value="Town"/>
    </AttrArray>
    <AttrArray Name="DerivedAttrNames">
      <Item Value="Suburb"/>
      <Item Value="PostalCode"/>
      <Item Value="TowId"/>
    </AttrArray>
    <AttrArray Name="ListAttrNames">
      <Item Value="Town"/>
      <Item Value="Suburb"/>
      <Item Value="PostalCode"/>
      <Item Value="Id"/>
    </AttrArray>
    <AttrArray Name="ListDisplayAttrNames">
      <Item Value="Town"/>
      <Item Value="Suburb"/>
      <Item Value="PostalCode"/>
      <Item Value="DsdRegion"/>
      <Item Value="ServiceDeliveryArea"/>
    </AttrArray>
    <DisplayCriteria/>
  </ListBinding>
  <SQLQuery><![CDATA[SELECT SmsPartyAddress.ADDRESS_LINE1,
       SmsPartyAddress.ID,
       SmsPartyAddress.ADDRESS_LINE2,
       SmsPartyAddress.ADDRESS_LINE3,
       SmsPartyAddress.ADDRESS_LINE4,
       SmsPartyAddress.ADDRESS_TYPE_IND,
       SmsPartyAddress.PAR_ID,
       SmsPartyAddress.PROP_ID,
       SmsPartyAddress.START_DT,
       SmsProperties.TOW_ID,
       SmsProperties.ID AS ID1,
       SmsProperties.ADDRESS_LINE,
       SmsProperties.ERF_NO,
       SmsProperties.WAR_ID,
       SmsProperties.ZONE,
        DECODE(TOW1.TOWN,NULL,TOW.TOWN,TOW1.TOWN)TOWN ,
       TOW.TOWN SUBURB,
       POSTAL_CODE
FROM SMS_PARTY_ADDRESS SmsPartyAddress, SMS_PROPERTIES SmsProperties,
SMS_TOWNS TOW
    ,SMS_TOWNS TOW1
    ,SMS_POSTAL_CODES PCOD
WHERE SmsPartyAddress.PROP_ID = SmsProperties.ID(+)
and TOW.PCOD_ID = PCOD.ID
    AND TOW.TOW_ID = TOW1.ID (+)
    --and TOW1.ID = SMSPROPERTIES.TOW_ID(+)
    and TOW.ID = SMSPROPERTIES.TOW_ID
    and SmsPartyAddress.prop_id = SmsProperties.id
     CONNECT BY PRIOR TOW.TOW_ID = TOW.ID]]></SQLQuery>
  <EntityUsage
    Name="SmsPartyAddress"
    Entity="sms1100.SmsPartyAddress"/>
  <EntityUsage
    Name="SmsProperties"
    Entity="sms1100.SmsProperties"
    Association="sms1100.proppaddAssociation"
    AssociationEnd="sms1100.proppaddAssociation.SmsProperties"
    SourceUsage="sms1100.smsProp_partyAddress.SmsPartyAddress"
    ReadOnly="true"
    Reference="true"
    DeleteParticipant="false"
    JoinType="LEFT OUTER JOIN">
    <DesignTime>
      <AttrArray Name="_srcAttributes">
        <Item Value="sms1100.SmsPartyAddress.PropId"/>
      </AttrArray>
      <AttrArray Name="_dstAttributes">
        <Item Value="sms1100.SmsProperties.Id"/>
      </AttrArray>
    </DesignTime>
  </EntityUsage>
  <ViewAttribute
    Name="AddressLine1"
    PrecisionRule="true"
    EntityAttrName="AddressLine1"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_LINE1"/>
  <ViewAttribute
    Name="Id"
    IsUpdateable="while_insert"
    PrecisionRule="true"
    EntityAttrName="Id"
    EntityUsage="SmsPartyAddress"
    AliasName="ID"/>
  <ViewAttribute
    Name="AddressLine2"
    PrecisionRule="true"
    EntityAttrName="AddressLine2"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_LINE2"/>
  <ViewAttribute
    Name="AddressLine3"
    PrecisionRule="true"
    EntityAttrName="AddressLine3"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_LINE3"/>
  <ViewAttribute
    Name="AddressLine4"
    PrecisionRule="true"
    EntityAttrName="AddressLine4"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_LINE4"/>
  <ViewAttribute
    Name="AddressTypeInd"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="AddressTypeInd"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_TYPE_IND"/>
  <ViewAttribute
    Name="ParId"
    PrecisionRule="true"
    EntityAttrName="ParId"
    EntityUsage="SmsPartyAddress"
    AliasName="PAR_ID"/>
  <ViewAttribute
    Name="PropId"
    PrecisionRule="true"
    EntityAttrName="PropId"
    EntityUsage="SmsPartyAddress"
    AliasName="PROP_ID"/>
  <ViewAttribute
    Name="StartDt"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="StartDt"
    EntityUsage="SmsPartyAddress"
    AliasName="START_DT"/>
  <ViewAttribute
    Name="TowId"
    PrecisionRule="true"
    EntityAttrName="TowId"
    IsUpdateable="true"
    EntityUsage="SmsProperties"
    AliasName="TOW_ID"
    IsPersistent="true"/>
  <ViewAttribute
    Name="Id1"
    IsUpdateable="while_insert"
    PrecisionRule="true"
    EntityAttrName="Id"
    EntityUsage="SmsProperties"
    AliasName="ID1"/>
  <ViewAttribute
    Name="AddressLine"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="AddressLine"
    EntityUsage="SmsProperties"
    AliasName="ADDRESS_LINE"/>
  <ViewAttribute
    Name="ErfNo"
    IsUnique="true"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="ErfNo"
    EntityUsage="SmsProperties"
    AliasName="ERF_NO"/>
  <ViewAttribute
    Name="WarId"
    PrecisionRule="true"
    EntityAttrName="WarId"
    EntityUsage="SmsProperties"
    AliasName="WAR_ID"/>
  <ViewAttribute
    Name="Zone"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="Zone"
    EntityUsage="SmsProperties"
    AliasName="ZONE"/>
  <ViewAttribute
    Name="Town"
    IsPersistent="false"
    PrecisionRule="true"
    Precision="60"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="TOWN"
    Expression="TOWN"
    SQLType="VARCHAR"
    LOVName="LOV_Town">
    <DesignTime>
      <Attr Name="_DisplaySize" Value="60"/>
    </DesignTime>
    <Properties>
      <SchemaBasedProperties>
        <CONTROLTYPE
          Value="combo_lov"/>
      </SchemaBasedProperties>
    </Properties>
  </ViewAttribute>
  <ViewAttribute
    Name="Suburb"
    IsPersistent="false"
    PrecisionRule="true"
    Precision="60"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="SUBURB"
    Expression="SUBURB"
    SQLType="VARCHAR">
    <DesignTime>
      <Attr Name="_DisplaySize" Value="60"/>
    </DesignTime>
  </ViewAttribute>
  <ViewAttribute
    Name="PostalCode"
    IsPersistent="false"
    PrecisionRule="true"
    Precision="4"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="POSTAL_CODE"
    Expression="POSTAL_CODE"
    SQLType="VARCHAR">
    <DesignTime>
      <Attr Name="_DisplaySize" Value="4"/>
    </DesignTime>
  </ViewAttribute>
  <AttrArray Name="KeyAttributes">
    <Item Value="Id"/>
  </AttrArray>
  <ResourceBundle>
    <PropertiesBundle
      PropertiesFile="SmsFrontService.SmsFrontServiceBundle"/>
  </ResourceBundle>
</ViewObject>i what to insert in both table partyAddress and propertyaddress,the property table the Updateable="never" and is disable,am not able to set is to always

use this method but the column i still disable
<EntityUsage
Name="SmsProperties"
Entity="sms1100.SmsProperties"
Association="sms1100.proppaddAssociation"
AssociationEnd="sms1100.proppaddAssociation.SmsProperties"
SourceUsage="sms1100.smsProp_partyAddress.SmsPartyAddress"
Reference="true"
ReadOnly="false"
DeleteParticipant="false"
JoinType="LEFT OUTER JOIN">
public class smsProp_partyAddressImpl extends ViewObjectImpl {
    protected void create(AttributeList attributeList) {
    // The view row will already have created "blank" entity instances
      SmsPropertiesImpl newProperty = new SmsPropertiesImpl();
    SmsPartyAddressImpl newPostal = new SmsPartyAddressImpl();
    //SmsPropertiesViewImpl newProperty = getSmsPropertiesView2();
    //SmsPartyAddressViewImpl  newPostal = getSmsPartyAddressView1();
    //SmsPropertiesImpl newProperty = getSmsPropertiesView2();
    //SmsPartyAddressImpl  newPostal = getSmsPartyAddressView1();
    try {
    // Let postal Address "blank" entity instance to do programmatic defaulting
    newProperty.create(attributeList);
    // Let postalAddress "blank" entity instance to do programmatic
    // defaulting passing in new SmsPropertiesImpl instance so its attributes
    // are available to the SmsPartyAddressImpl's create method.
    newPostal.create(newProperty);
    catch (JboException ex) {
    newProperty.revert();
    newPostal.revert();
    throw ex;
    catch (Exception otherEx) {
    newProperty.revert();
    newPostal.revert();
    throw new RowCreateException(true /* EO Row? */,
    "SmsProperties" /* EO Name */,
    otherEx /* Details */);
}but the updatable="Always"
the view is
<?xml version="1.0" encoding="windows-1252" ?>
<!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
<!---->
<ViewObject
  xmlns="http://xmlns.oracle.com/bc4j"
  Name="smsProp_partyAddress"
  Version="11.1.2.60.81"
  BindingStyle="OracleName"
  CustomQuery="true"
  PageIterMode="Full"
  UseGlueCode="false"
  RowClass="sms1100.smsProp_partyAddressRowImpl"
  ComponentClass="sms1100.smsProp_partyAddressImpl"
  RowInterface="sms1100.common.smsProp_partyAddressRow"
  ClientRowProxyName="sms1100.client.smsProp_partyAddressRowClient">
  <DesignTime>
    <Attr Name="_isExpertMode" Value="true"/>
    <Attr Name="_codeGenFlag2" Value="Access|Coll|Prog|VarAccess"/>
    <Attr Name="_isCodegen" Value="true"/>
  </DesignTime>
  <Properties>
    <SchemaBasedProperties>
      <LABEL
        ResId="sms1100.smsProp_partyAddress_LABEL"/>
    </SchemaBasedProperties>
  </Properties>
  <ViewAccessor
    Name="Sub_lov1"
    ViewObjectName="sms1100.Sub_lov"
    RowLevelBinds="true"/>
  <ListBinding
    Name="LOV_Town"
    ListVOName="Sub_lov1"
    ListRangeSize="-1"
    ComboRowCountHint="10"
    NullValueFlag="none"
    MRUCount="0">
    <AttrArray Name="AttrNames">
      <Item Value="Town"/>
    </AttrArray>
    <AttrArray Name="DerivedAttrNames">
      <Item Value="Suburb"/>
      <Item Value="PostalCode"/>
      <Item Value="TowId"/>
    </AttrArray>
    <AttrArray Name="ListAttrNames">
      <Item Value="Town"/>
      <Item Value="Suburb"/>
      <Item Value="PostalCode"/>
      <Item Value="Id"/>
    </AttrArray>
    <AttrArray Name="ListDisplayAttrNames">
      <Item Value="Town"/>
      <Item Value="Suburb"/>
      <Item Value="PostalCode"/>
      <Item Value="DsdRegion"/>
      <Item Value="ServiceDeliveryArea"/>
    </AttrArray>
    <DisplayCriteria/>
  </ListBinding>
  <SQLQuery><![CDATA[SELECT SmsPartyAddress.ADDRESS_LINE1,
       SmsPartyAddress.ID,
       SmsPartyAddress.ADDRESS_LINE2,
       SmsPartyAddress.ADDRESS_LINE3,
       SmsPartyAddress.ADDRESS_LINE4,
       SmsPartyAddress.ADDRESS_TYPE_IND,
       SmsPartyAddress.PAR_ID,
       SmsPartyAddress.PROP_ID,
       SmsPartyAddress.START_DT,
       SmsProperties.TOW_ID,
       SmsProperties.ID AS ID1,
       SmsProperties.ADDRESS_LINE,
       SmsProperties.ERF_NO,
       SmsProperties.WAR_ID,
       SmsProperties.ZONE,
        DECODE(TOW1.TOWN,NULL,TOW.TOWN,TOW1.TOWN)TOWN ,
       TOW.TOWN SUBURB,
       POSTAL_CODE
FROM SMS_PARTY_ADDRESS SmsPartyAddress, SMS_PROPERTIES SmsProperties,
SMS_TOWNS TOW
    ,SMS_TOWNS TOW1
    ,SMS_POSTAL_CODES PCOD
WHERE SmsPartyAddress.PROP_ID = SmsProperties.ID(+)
and TOW.PCOD_ID = PCOD.ID
    AND TOW.TOW_ID = TOW1.ID (+)
    --and TOW1.ID = SMSPROPERTIES.TOW_ID(+)
    and TOW.ID = SMSPROPERTIES.TOW_ID
    and SmsPartyAddress.prop_id = SmsProperties.id
     CONNECT BY PRIOR TOW.TOW_ID = TOW.ID]]></SQLQuery>
  <EntityUsage
    Name="SmsPartyAddress"
    Entity="sms1100.SmsPartyAddress"/>
  <EntityUsage
    Name="SmsProperties"
    Entity="sms1100.SmsProperties"
    Association="sms1100.proppaddAssociation"
    AssociationEnd="sms1100.proppaddAssociation.SmsProperties"
    SourceUsage="sms1100.smsProp_partyAddress.SmsPartyAddress"
    Reference="true"
    ReadOnly="false"
    DeleteParticipant="false"
    JoinType="LEFT OUTER JOIN">
    <DesignTime>
      <AttrArray Name="_srcAttributes">
        <Item Value="sms1100.SmsPartyAddress.PropId"/>
      </AttrArray>
      <AttrArray Name="_dstAttributes">
        <Item Value="sms1100.SmsProperties.Id"/>
      </AttrArray>
    </DesignTime>
  </EntityUsage>
  <ViewAttribute
    Name="AddressLine1"
    PrecisionRule="true"
    EntityAttrName="AddressLine1"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_LINE1"/>
  <ViewAttribute
    Name="Id"
    IsUpdateable="while_insert"
    PrecisionRule="true"
    EntityAttrName="Id"
    EntityUsage="SmsPartyAddress"
    AliasName="ID"/>
  <ViewAttribute
    Name="AddressLine2"
    PrecisionRule="true"
    EntityAttrName="AddressLine2"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_LINE2"/>
  <ViewAttribute
    Name="AddressLine3"
    PrecisionRule="true"
    EntityAttrName="AddressLine3"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_LINE3"/>
  <ViewAttribute
    Name="AddressLine4"
    PrecisionRule="true"
    EntityAttrName="AddressLine4"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_LINE4"/>
  <ViewAttribute
    Name="AddressTypeInd"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="AddressTypeInd"
    EntityUsage="SmsPartyAddress"
    AliasName="ADDRESS_TYPE_IND"/>
  <ViewAttribute
    Name="ParId"
    PrecisionRule="true"
    EntityAttrName="ParId"
    EntityUsage="SmsPartyAddress"
    AliasName="PAR_ID"/>
  <ViewAttribute
    Name="PropId"
    PrecisionRule="true"
    EntityAttrName="PropId"
    EntityUsage="SmsPartyAddress"
    AliasName="PROP_ID"/>
  <ViewAttribute
    Name="StartDt"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="StartDt"
    EntityUsage="SmsPartyAddress"
    AliasName="START_DT"/>
  <ViewAttribute
    Name="TowId"
    PrecisionRule="true"
    EntityAttrName="TowId"
    EntityUsage="SmsProperties"
    AliasName="TOW_ID"/>
  <ViewAttribute
    Name="Id1"
    IsUpdateable="while_insert"
    PrecisionRule="true"
    EntityAttrName="Id"
    EntityUsage="SmsProperties"
    AliasName="ID1"/>
  <ViewAttribute
    Name="AddressLine"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="AddressLine"
    EntityUsage="SmsProperties"
    AliasName="ADDRESS_LINE"/>
  <ViewAttribute
    Name="ErfNo"
    IsUnique="true"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="ErfNo"
    EntityUsage="SmsProperties"
    AliasName="ERF_NO"/>
  <ViewAttribute
    Name="WarId"
    PrecisionRule="true"
    EntityAttrName="WarId"
    EntityUsage="SmsProperties"
    AliasName="WAR_ID"/>
  <ViewAttribute
    Name="Zone"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="Zone"
    EntityUsage="SmsProperties"
    AliasName="ZONE"/>
  <ViewAttribute
    Name="Town"
    IsPersistent="false"
    PrecisionRule="true"
    Precision="60"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="TOWN"
    Expression="TOWN"
    SQLType="VARCHAR"
    LOVName="LOV_Town">
    <DesignTime>
      <Attr Name="_DisplaySize" Value="60"/>
    </DesignTime>
    <Properties>
      <SchemaBasedProperties>
        <CONTROLTYPE
          Value="combo_lov"/>
      </SchemaBasedProperties>
    </Properties>
  </ViewAttribute>
  <ViewAttribute
    Name="Suburb"
    IsPersistent="false"
    PrecisionRule="true"
    Precision="60"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="SUBURB"
    Expression="SUBURB"
    SQLType="VARCHAR">
    <DesignTime>
      <Attr Name="_DisplaySize" Value="60"/>
    </DesignTime>
  </ViewAttribute>
  <ViewAttribute
    Name="PostalCode"
    IsPersistent="false"
    PrecisionRule="true"
    Precision="4"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="POSTAL_CODE"
    Expression="POSTAL_CODE"
    SQLType="VARCHAR">
    <DesignTime>
      <Attr Name="_DisplaySize" Value="4"/>
    </DesignTime>
  </ViewAttribute>
  <AttrArray Name="KeyAttributes">
    <Item Value="Id"/>
  </AttrArray>
  <ResourceBundle>
    <PropertiesBundle
      PropertiesFile="SmsFrontService.SmsFrontServiceBundle"/>
  </ResourceBundle>
</ViewObject>am also geting this error in my view after i set readOnly="false"
Remove updateable flag from entity usage or mark attributes as key attributes for this entity usage
i follow your link

Similar Messages

  • Insert only one character in a JTable cell

    Hi1
    Can anybody tell me how i can do in order to insert only one character in a JTable cell? For example, i'ld like that user inserts only
    a and not abcd in a JTable cell... can anyone halp me?
    Thanks

    Have you tried
    table.getColumn(0).setCellEditor(new DefaultCellEditor(new JFormattedTextField("[A-Z]")));
    I haven't tried it. You might look at some of these.
    http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2B%22new+defaultcelleditor%22+%2B%22new+jformattedtextfield%22&col=javaforums&x=39&y=17

  • Dimension which belongs to only one of the several fact tables

    Hi,
    I'm newbie in BI. I have good knowledge of DW and Administration (OCP).
    Firstly could you give me, please some link expalining aspects of creating "Business Model And Mapping" better than SE Tutoarial.
    Now how my problems looks like :
    I have several fact tables and dimensions.
    But not all dimensions are shared among all facts.
    So when i try to put in Answers measurements from all facts it's ok - results are retrieved.
    But when i try to add to report some Dimensions attributes which belongs to only one of the facts all facts measurements are gone except measurements for fact table to which dimension attribute is linked to.
    I think i know what is the reason but i don't know how to simply solve it :
    Below is session trace excerpt only with facts measurements :
    RqList
    Liczba Transakcji:[DAggr(Fakty - Transakcje (ZSFK).Liczba Transakcji by [ Słownik - Daty.Nr Miesiąca, Słownik - Daty.Miesiąc Rozliczenia, Słownik - Outlety.Outlet Numer (MID), Słownik - Outlety.Outlet Nazwa, Słownik - Terminale.Nr Terminala, Słownik - Daty.Rok Rozliczenia] )] as c7 GB,
    Kwota Opłaty Netto:[DAggr(Fakty - Opłaty za Terminale (CBD).Kwota Opłaty Netto by [ Słownik - Daty.Nr Miesiąca, Słownik - Daty.Miesiąc Rozliczenia, Słownik - Outlety.Outlet Numer (MID), Słownik - Outlety.Outlet Nazwa, Słownik - Terminale.Nr Terminala, Słownik - Daty.Rok Rozliczenia] )] as c11 GB,
    Below iis session trace excerpt with facts measurements and added dimension attribute:
    RqList
    Liczba Transakcji:[DAggr(Fakty - Transakcje (ZSFK).Liczba Transakcji by [ Słownik - Rodzaje Walut.KOD_WALUTY, Słownik - Daty.Nr Miesiąca, Słownik - Daty.Miesiąc Rozliczenia, Słownik - Outlety.Outlet Numer (MID), Słownik - Outlety.Outlet Nazwa, Słownik - Terminale.Nr Terminala, Słownik - Daty.Rok Rozliczenia] )] as c7 GB,
    Kwota Opłaty Netto:[DAggr(Fakty - Opłaty za Terminale (CBD).Kwota Opłaty Netto by [ Słownik - Rodzaje Walut.KOD_WALUTY, Słownik - Daty.Nr Miesiąca, Słownik - Daty.Miesiąc Rozliczenia, Słownik - Outlety.Outlet Numer (MID), Słownik - Outlety.Outlet Nazwa, Słownik - Terminale.Nr Terminala, Słownik - Daty.Rok Rozliczenia] )] as c12 GB,
    Second plan is the plan when report retrieves only results for one fact table and null's for others
    Problem is with attribute : "Słownik - Rodzaje Walut.KOD_WALUTY" which is from dimension which belongs only to one fact table.
    So other fact table are not linked to this dimension and therefore this plan cannot retrieve results for them.
    It is obvious that some of the facts cannot share some dimensions with others but i would like to join them on other common attribute
    and my question is how ?
    Thanks's in advance Arkadiusz Masny
    Edited by: Arkadiusz Masny on Dec 10, 2009 6:49 AM

    It's normal behavior. How would fact measure know the value for accurate "non-fact" dimension
    Workaround:
    First solution is:
    Add into logical source of each fact (in logical layer) tables to which belongs dimension attribute and join dimenstion to that fact.
    Second you may:
    Create fact table which join all needed dimensions with some useless fact ( i.e. count). Next you have to set option "Implicit Fact Column" in presentation catalog to use this fact table.
    I can explain it to you in Polish by mail or phone
    You bring me a next topic for my blog (in Polish) http://obiee.pl so I'll write sth about such behavior :)
    Regards

  • Unidirectional one-to-many with join table

    According to http://docs.jboss.org/hibernate/orm/3.5/reference/en-US/html/associations.html#assoc-unidirectional-12m "A unidirectional one-to-many association on a foreign key is an unusual case, and is not recommended", instead they recommend using a join table, e.g.
    create table Person ( personId bigint not null primary key )
    create table PersonAddress ( personId not null, addressId bigint not null primary key )
    create table Address ( addressId bigint not null primary key )
    However if doing this, when using SQLDeveloper the Address table does not appear as a child table of Person, which it should be as a unidirectional one-to-many meaning that I can't create a cache group for Person and subsequently Person.
    Is this something that can be worked around as I'm using a legacy schema created from Hibernate/JPA and the implications of changing are quite substantial?
    Thanks

    Hi Gennady,
    Apologies but my question was not clear enough. The schema structure that I have inherited is as follows:
    CREATE TABLE T_PERSON ( PERSONID NUMBER PRIMARY KEY, PERSONFIRSTNAME VARCHAR2(20), PERSONLASTNAME VARCHAR2(20) );
    CREATE TABLE T_PERSONADDRESS (PERSONID NUMBER NOT NULL, ADDRESSID NUMBER NOT NULL PRIMARY KEY );
    CREATE TABLE T_ADDRESS ( ADDRESSID NUMBER  PRIMARY KEY, ADDRESSTEXT VARCHAR2(200) );
    ALTER TABLE T_PERSONADDRESS ADD CONSTRAINT FK_PERSON_ADDR_PERSON_ID FOREIGN KEY (PERSONID) REFERENCES T_PERSON(PERSONID);
    ALTER TABLE T_PERSONADDRESS ADD CONSTRAINT FK_PERSON_ADDR_ADDR_ID FOREIGN KEY (ADDRESSID) REFERENCES T_ADDRESS(ADDRESSID);This is implementing a unidirectional one-to-many relationship between T_PERSON and T_ADDRESS according to the Hibernate and JPA recommendation. As far as I can see most schema designers would do this using by adding a column "PERSON_ID" (and associated FK) on the T_ADDRESS table and therefore not needing the T_PERSONADDRESS table.
    This being what it is, I would then like to create a cache-group as follows:
    CREATE READONLY CACHE GROUP "CACHEGROUPADDRESSES"
    AUTOREFRESH MODE INCREMENTAL INTERVAL 5 MINUTES
    STATE PAUSED
    FROM
      "SCHEMA1"."T_PERSON" (
        "PERSONID"        NUMBER            NOT NULL,
        "PERSONFIRSTNAME" VARCHAR2(20 BYTE),
        "PERSONLASTNAME"  VARCHAR2(20 BYTE),
        PRIMARY KEY("PERSONID")
      "SCHEMA1"."T_ADDRESS" (
        "ADDRESSID" NUMBER NOT NULL,
        "ADDRESSTEXT" VARCHAR2(20 BYTE),
        PRIMARY KEY("ADDRESSID")
      "SCHEMA1"."T_PERSONADDRESS" (
        "PERSONID"  NUMBER NOT NULL,
        "ADDRESSID" NUMBER NOT NULL,
        PRIMARY KEY("ADDRESSID"),
        FOREIGN KEY("PERSONID")
          REFERENCES "SCHEMA1"."T_PERSON"("PERSONID"),
        FOREIGN KEY("ADDRESSID")
          REFERENCES "SCHEMA1"."T_ADDRESS"("ADDRESSID")
      )This however gives me the error "TT8222: Multiple parent tables found" because TimesTen has failed to identify the one-to-many-using-link-table pattern.
    Without a schema re-write is there anything that I can do, alternatively will this be looked at for a future release of TimesTen?
    Edited by: TrisStev on Apr 16, 2012 10:37 AM

  • Loading xml file in to database (inserting only one level)

    Hi All,
      I am trying to load an xml file into db using ssis..when i am trying to load the data in xml its loading only first row..
    sample xml:
    <?xml version="1.0"?>
      <Products>
        <Product ID="Level1_75000000" UserTypeID="Level1" ParentID="Products_6537">
          <Name>Household/Office Furniture/Furnishings</Name>
          <Product ID="Level2_75020000" UserTypeID="Level2">
            <Name>Fabric/Textile Furnishings</Name>
            <Product ID="Level3_75020100" UserTypeID="Level3">
              <Name>Household/Office Fabric/Textile Furnishings</Name>
              <Product ID="Level4_10002215" UserTypeID="Level4">
                <Name>Fabric/Textile Window Blinds</Name>
              </Product>
              <Product ID="Level4_10002214" UserTypeID="Level4">
                <Name>Curtains</Name>
              </Product>
              <Product ID="Level4_10002221" UserTypeID="Level4">
                <Name>Household/Office Fabric/Textile Furnishings Other</Name>
              </Product>
              <Product ID="Level4_10002220" UserTypeID="Level4">
                <Name>Household/Office Fabric/Textile Furnishing Variety Packs</Name>
              </Product>
              <Product ID="Level4_10002219" UserTypeID="Level4">
                <Name>Fabric/Textile Towels</Name>
              </Product>
              <Product ID="Level4_10002218" UserTypeID="Level4">
                <Name>Furnishing Floor Rugs/Mats - Detachable</Name>
              </Product>
              <Product ID="Level4_10002217" UserTypeID="Level4">
                <Name>Cushions</Name>
              </Product>
              <Product ID="Level4_10002216" UserTypeID="Level4">
                <Name>Furnishing Covers/Cloths - Detachable</Name>
              </Product>
            </Product>      
            <Name>Ornamental Furnishings</Name>
            <Product ID="Level3_75030100" UserTypeID="Level3">
              <Name>Ornaments</Name>
              <Product ID="Level4_10002231" UserTypeID="Level4">
                <Name>Ornaments</Name>
              </Product>
              <Product ID="Level4_10005692" UserTypeID="Level4">
                <Name>Ornament Accessories</Name>
              </Product>
              <Product ID="Level4_10002238" UserTypeID="Level4">
                <Name>Ornaments Variety Packs</Name>
              </Product>
              <Product ID="Level4_10002249" UserTypeID="Level4">
                <Name>Candle Holders/Accessories</Name>
              </Product>
              <Product ID="Level4_10002236" UserTypeID="Level4">
                <Name>Seasonal Decorations (Non Powered)</Name>
              </Product>
              <Product ID="Level4_10002237" UserTypeID="Level4">
                <Name>Seasonal Decorations (Powered)</Name>
              </Product>
              <Product ID="Level4_10000555" UserTypeID="Level4">
                <Name>Candles</Name>
              </Product>
              <Product ID="Level4_10002234" UserTypeID="Level4">
                <Name>Decorative Magnets/Stickers/Window Clings</Name>
              </Product>
              <Product ID="Level4_10002235" UserTypeID="Level4">
                <Name>Sun/Dream Catchers/Windchimes</Name>
              </Product>
              <Product ID="Level4_10002232" UserTypeID="Level4">
                <Name>Artificial Flowers/Plants/Trees</Name>
              </Product>
              <Product ID="Level4_10002233" UserTypeID="Level4">
                <Name>Vases</Name>
              </Product>
            </Product>
            <Product ID="Level3_75030600" UserTypeID="Level3">
              <Name>Ornamental Furnishings Variety Packs</Name>
              <Product ID="Level4_10003816" UserTypeID="Level4">
                <Name>Ornamental Furnishings Variety Packs</Name>
              </Product>
            </Product>
            <Product ID="Level3_75030200" UserTypeID="Level3">
              <Name>Pictures/Mirrors/Frames</Name>
              <Product ID="Level4_10002241" UserTypeID="Level4">
                <Name>Posters/Prints</Name>
              </Product>
              <Product ID="Level4_10002240" UserTypeID="Level4">
                <Name>Paintings</Name>
              </Product>
              <Product ID="Level4_10002243" UserTypeID="Level4">
                <Name>Photographs</Name>
              </Product>
              <Product ID="Level4_10002245" UserTypeID="Level4">
                <Name>Mirrors</Name>
              </Product>
              <Product ID="Level4_10002247" UserTypeID="Level4">
                <Name>Pictures/Mirrors/Frames Variety Packs</Name>
              </Product>
              <Product ID="Level4_10002246" UserTypeID="Level4">
                <Name>Picture Frames</Name>
              </Product>
              <Product ID="Level4_10002248" UserTypeID="Level4">
                <Name>Picture/Mirrors/Frames Other</Name>
              </Product>
            </Product>
            <Product ID="Level3_75030700" UserTypeID="Level3">
              <Name>Decorative Banners/Flags</Name>
              <Product ID="Level4_10005816" UserTypeID="Level4">
                <Name>Decorative Banners/Flags</Name>
              </Product>
            </Product>
            <Product ID="Level3_75030400" UserTypeID="Level3">
              <Name>Clocks</Name>
              <Product ID="Level4_10004101" UserTypeID="Level4">
                <Name>Clocks - Replacement Parts</Name>
              </Product>
              <Product ID="Level4_10002252" UserTypeID="Level4">
                <Name>Clocks</Name>
              </Product>
            </Product>
          </Product>
             </Product>
      </Products>
     Please suggest..

    Hi RAGS1109,
    If our XML data starts to get more complicated (multiple levels of elements / attributes), we start getting more outputs, we will have to join those outputs with a merge join transform.
    Please refer to the following document how to dealing with multiple outputs for XML data source:
    Using XML Source:
    http://blogs.msdn.com/b/mattm/archive/2007/12/11/using-xml-source.aspx 
    Process Multi-Level XML in SSIS:
    http://www.youtube.com/watch?v=rFgLV58EcXA
    If you have any feedback on our support, please click
    here.
    Elvis Long
    TechNet Community Support

  • Adding only one field of an internal table.

    Hi gurus,
    I have an internal table with values Brand , Country, Code & Amount.
    with values as follows
    Brand     Country    Code          Amount
    1533       IN            121213       56.00
    1533       IN            121213       75.00
    1533       IN            138808       66.00
    1533       BR           121111      23.00
    1533       BR           121212      46.00
    Now i want a sum total of amounts based on country( The code is ignored).
    Brand     Country    Code          Amount
    1533       IN                             197.00
    1533       BR                            69.00
    I already tried the COLLECT statement but was not successful,
    Any ideas will be welcomed.
    Regards,
    K

    hiiii
    use following code..you will solve your problem by that.
    FORM display_flight_data .
      LOOP AT t_flight INTO fs_sflight.
        IF s_carrid EQ fs_sflight-carrid
           AND sflight-connid EQ fs_sflight-connid.
          WRITE: /20 fs_sflight-fldate COLOR 2,
          40 fs_sflight-seatsmax COLOR 2,
          58 fs_sflight-seatsocc COLOR 2.
        ELSE.
          ULINE.
          WRITE: /1(50) 'Total Booking So Far ' COLOR 3, w_total COLOR 3.
          WRITE:/10 fs_sflight-carrid COLOR 5,
             20 fs_sflight-connid COLOR 5.
          w_payment = w_payment + fs_sflight-paymentsum.
          w_total = w_payment.
          w_grandtotal = w_payment + w_total.
          w_finaltotal = w_grandtotal.
        ENDIF.
        s_carrid = fs_sflight-carrid.
        sflight-connid = fs_sflight-connid.
      ENDLOOP.
      WRITE: /1(50) 'Total Amount Of Bookings So Far For ' COLOR 3 ,
                     w_finaltotal COLOR 3.
    ENDFORM.                    " display_flight_data
    reward if useful
    thx
    twinkal

  • When primary table is also join table and you have NOT NULL constraints

    Hi,
    Me again. This is similar to the message titled "Problem with an
    optional 1 to 1 relationship modelled using a link table". Whats
    different about this case is we are dealing with a one to many relationship.
    Given this SQL:
    create table person (
    pid INTEGER(10) NOT NULL,
    language_code VARCHAR(3) NOT NULL
    create table language_person (
    pid INTEGER(10) NOT NULL REFERENCES person(pid),
    language_code VARCHAR(3) NOT NULL,
    first_name VARCHAR(20) NOT NULL
    I wrote these classes (abbreviated)
    Person:
    * @jdo:persist
    * @jdo:identity-type application
    * @jdo:objectid-class PersonId
    * @jdo:requires-extent false
    * @jdo:extension vendor-name="kodo" key="table"
    * value="PERSON"
    * @jdo:extension vendor-name="kodo" key="lock-column"
    * value="none"
    * @jdo:extension vendor-name="kodo" key="class-column"
    * value="none"
    public class Person {
    * @jdo:primary-key true
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="PID"
    private int pid;
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="LANGUAGE_CODE"
    private String languageCode;
    * @jdo:collection element-type="LanguagePerson"
    * @jdo:extension vendor-name="kodo" key="pid-data-column"
    * value="PID"
    * @jdo:extension vendor-name="kodo" key="table"
    * value="LANGUAGE_PERSON"
    * @jdo:extension vendor-name="kodo" key="pid-ref-column"
    * value="PID"
    * @jdo:extension vendor-name="kodo"
    key="languageCode-data-column"
    * value="LANGUAGE_CODE"
    * @jdo:extension vendor-name="kodo"
    key="languageCode-ref-column"
    * value="LANGUAGE_CODE"
    private Set languagePersons = new HashSet();
    public Person(int pid, String languageCode) {
    this.pid = pid;
    this.languageCode = languageCode;
    public void addLanguagePerson(LanguagePerson languagePerson) {
    languagePersons.add(languagePerson);
    public Set getLanguagePersons() {
    return languagePersons;
    LANGUAGE_PERSON
    * @jdo:persist
    * @jdo:identity-type application
    * @jdo:objectid-class LanguagePersonId
    * @jdo:requires-extent false
    * @jdo:extension vendor-name="kodo" key="table"
    * value="LANGUAGE_PERSON"
    * @jdo:extension vendor-name="kodo" key="lock-column"
    * value="none"
    * @jdo:extension vendor-name="kodo" key="class-column"
    * value="none"
    public class LanguagePerson {
    * @jdo:primary-key true
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="PID"
    private int pid;
    * @jdo:primary-key true
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="LANGUAGE_CODE"
    private String languageCode;
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="FIRST_NAME"
    private String firstName;
    public LanguagePerson(int pid, String languageCode, String firstName) {
    this.pid = pid;
    this.languageCode = languageCode;
    this.firstName = firstName;
    And then I do this:
         PersistenceManager pm = JDOFactory.getPersistenceManager();
    pm.currentTransaction().begin();
    final Person person = new Person(1,"EN");
    final LanguagePerson languagePerson = new
              LanguagePerson(1,"EN","Mike");
    person.addLanguagePerson(languagePerson);
    pm.makePersistent(person);
    pm.currentTransaction().commit();
    The SQL that issues forth is this:
    1125 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    preparing statement <17089909>: INSERT INTO PERSON(LANGUAGE_CODE, PID)
    VALUES (?, ?)
    1125 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    executing statement <17089909>: [reused=1;params={(String)EN,(int)1}]
    1125 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    preparing statement <9818046>: INSERT INTO
    LANGUAGE_PERSON(LANGUAGE_CODE, PID) VALUES (?, ?)
    1125 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    executing statement <9818046>: [reused=1;params={(String)EN,(int)1}]
    1140 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    preparing statement <24763620>: INSERT INTO LANGUAGE_PERSON(FIRST_NAME,
    LANGUAGE_CODE, PID) VALUES (?, ?, ?)
    1140 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    executing statement <24763620>:
    [reused=1;params={(String)Mike,(String)EN,(int)1}]
    And the second INSERT fails on Oracle because FIRST_NAME is null, and
    the table definition requires it to be NOT NULL.
    Is there anyway I can get Kodo to figure out its dealing with the same
    table for inserting the link columns and the full row, and optimize
    accordingly i.e do one INSERT for LANGUAGE_PERSON?
    I guess my only other options are a) introduce an explicit link table or
    b) define a custom mapping?
    Thanks,
    Mike.

    There are examples of 1-Many mappings in the documentation:
    http://www.solarmetric.com/Software/Documentation/latest/docs/
    ref_guide_meta_examples.html
    The important point I think you've missed is that right now, 1-many
    mappings always require an inverse 1-1 mapping. Again, see the docs
    above.
    So your LanguagePerson needs a field of type Person, and whenever you add
    a LanguagePerson to a Person, make sure to set that LanguagePerson's
    Person too. LanguagePerson.person will use the same PID column as
    LanguagePeson.pid. Kodo has no problem with having 2 mappings
    mapped to the same column.
    Kodo 3.0 will allow 1-Many relations without an inverse 1-1.

  • Help on locking MySQL tables (many can read, but only one can write) Java

    Hi there,
    I have a question regarding locking of tables so that only one person can write to the file, but many are able to read the files (or tables entities).
    I am not sure if I need to lock the tables in my Java code or do I lock the tables within the MySQL syntax. I'm just a little confused on the matter.
    This java code is a working prototype of inserting a customer data into the database and that works fine. I just don't know how to implement it so that only one person can update the table at a time.
    Here is the Customer.java code that I have written.
    Help would be greatly appreciated, thanks so much.
    package business;
    //~--- non-JDK imports --------------------------------------------------------
    import shared.info.CustomerInfo;
    //~--- JDK imports ------------------------------------------------------------
    import java.sql.*;
    * @author
    public class Customer {
        static Connection    con  = DBConnection.getConnection();
        private CustomerInfo info = new CustomerInfo();
        private String               customerID;
        private String               firstName;
        private String               lastName;
        private String               email;
        private String               addressID;
        private String               homePhone;
        private String               workPhone;
        private String               unitNum;
        private String               streetNum;
        private String               streetName;
        private String               city;
        private String               provinceState;
        private String               country;
        private String               zipPostalCode;
        public Customer(String id) {
            try {
                PreparedStatement pstmt = con.prepareStatement("SELECT * FROM " +
                        "Customer NATURAL JOIN Address WHERE CustomerID = ?");
                pstmt.setString(1, id);
                ResultSet rs = pstmt.executeQuery();
                while (rs.next()) {
                    customerID    = rs.getString("CustomerID");
                    firstName     = rs.getString("FirstName");
                    lastName      = rs.getString("LastName");
                    homePhone     = rs.getString("HomePhone");
                    workPhone     = rs.getString("WorkPhone");
                    email         = rs.getString("Email");
                    city          = rs.getString("City");
                    provinceState = rs.getString("ProvinceState");
                    country       = rs.getString("Country");
                    zipPostalCode = rs.getString("ZipPostalCode");
                    unitNum       = rs.getString("UnitNum");
                    streetNum     = rs.getString("StreetNum");
                    streetName    = rs.getString("StreetName");
                    addressID     = rs.getString("AddressId");
            } catch (SQLException e) {
                e.printStackTrace();
            info.setCustomerID(customerID);
            info.setFirstName(firstName);
            info.setLastName(lastName);
            info.setHomePhone(homePhone);
            info.setWorkPhone(workPhone);
            info.setEmail(email);
            info.setCity(city);
            info.setProvinceState(provinceState);
            info.setCountry(country);
            info.setZipPostalCode(zipPostalCode);
            info.setUnitNum(unitNum);
            info.setStreetNum(streetNum);
            info.setStreetName(streetName);
            info.setAddressID(addressID);
        public static void addCustomer(CustomerInfo cust) {
            try {
                int id = -1;
                PreparedStatement pstmt = con.prepareStatement("INSERT INTO Address" +
                        "(UnitNum, StreetNum, StreetName, City, ProvinceState, Country," +
                        " ZipPostalCode) VALUES(?, ?, ?, ?, ?, ?, ?)");
                pstmt.setString(1, cust.getUnitNum());
                pstmt.setString(2, cust.getStreetNum());
                pstmt.setString(3, cust.getStreetName());
                pstmt.setString(4, cust.getCity());
                pstmt.setString(5, cust.getProvinceState());
                pstmt.setString(6, cust.getCountry());
                pstmt.setString(7, cust.getZipPostalCode());
                pstmt.executeUpdate();
                ResultSet rs = pstmt.getGeneratedKeys();
                rs.next();
                id = rs.getInt(1);
                pstmt = con.prepareStatement("INSERT INTO Customer" +
                        "(FirstName, LastName, HomePhone, WorkPhone, Email, AddressID)"
                        + "VALUES(?, ?, ?, ?, ?, ?)");
                pstmt.setString(1, cust.getFirstName());
                pstmt.setString(2, cust.getLastName());
                pstmt.setString(3, cust.getHomePhone());
                pstmt.setString(4, cust.getWorkPhone());
                pstmt.setString(5, cust.getEmail());
                pstmt.setInt(6, id);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
        public void setFirstName(String newName) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET FirstName = ? WHERE CustomerID = ?");
                pstmt.setString(1, newName);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            firstName = newName;
        public void setLastName(String newName) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET LastName = ? WHERE CustomerID = ?");
                pstmt.setString(1, newName);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            lastName = newName;
        public String getFirstName() {
            return firstName;
        public String getLastName() {
            return lastName;
        public void setHomePhone(String number) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET HomePhone = ? WHERE CustomerID = ?");
                pstmt.setString(1, number);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            homePhone = number;
        public String getHomePhone() {
            return homePhone;
        public void setWorkPhone(String number) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET WorkPhone = ? WHERE CustomerID = ?");
                pstmt.setString(1, number);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            workPhone = number;
        public String getWorkPhone() {
            return workPhone;
        public void setEmail(String email) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer" + " SET Email = ? WHERE CustomerID = ?");
                pstmt.setString(1, email);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            this.email = email;
        public String getEmail() {
            return email;
        public void setUnitNum(String num) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET UnitNum = ? WHERE AddressId = ?");
                pstmt.setString(1, num);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            unitNum = num;
        public String getUnitNum() {
            return unitNum;
        public void setCity(String city) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET City = ? WHERE AddressId = ?");
                pstmt.setString(1, city);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            this.city = city;
        public String getCity() {
            return city;
        public void setStreetNum(String num) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET StreetNum = ? WHERE AddressId = ?");
                pstmt.setString(1, num);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            streetNum = num;
        public String getStreetNum() {
            return streetNum;
        public void setStreetName(String name) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address"
                                              + " SET StreetName = ? WHERE AddressId = ?");
                pstmt.setString(1, name);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            streetName = name;
        public String getStreetName() {
            return streetName;
        public void setZipPostalCode(String code) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address"
                                              + " SET ZipPostalCode = ? WHERE AddressId = ?");
                pstmt.setString(1, code);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            zipPostalCode = code;
        public String getZipPostalCode() {
            return zipPostalCode;
        public CustomerInfo getInfo(){
            return info;
        static void deleteCustomer(String customerId) {
            try{
                PreparedStatement pstmt = con.prepareStatement("DELETE FROM Customer" +
                        " WHERE CustomerId = ?");
                pstmt.setString(1, customerId);
                pstmt.executeUpdate();
            }catch(SQLException e){
                e.printStackTrace();
        static void updateCustomer(CustomerInfo custInf) {
            try{
                PreparedStatement pstmt = con.prepareStatement("UPDATE customer" +
                        " SET firstName = ?, SET lastName = ?," +
                        " SET homePhone = ?, SET workPhone = ?, SET email = ?" +
                        " WHERE CustomerId = ?");
                pstmt.setString(1, custInf.getFirstName());
                pstmt.setString(2, custInf.getLastName());
                pstmt.setString(3, custInf.getHomePhone());
                pstmt.setString(4, custInf.getWorkPhone());
                pstmt.setString(5, custInf.getEmail());
                pstmt.setString(6, custInf.getCustomerID());
                pstmt.executeUpdate();
                pstmt = con.prepareStatement("UPDATE address" +
                        " SET unitNum = ?, SET StreetNum = ?, SET StreetName = ?," +
                        " SET city = ?,SET Province = ?,SET country = ?,SET ZipPostalCode = ?" +
                        " WHERE AddressId = ?");
                pstmt.setString(1, custInf.getUnitNum());
                pstmt.setString(2, custInf.getStreetNum());
                pstmt.setString(3, custInf.getStreetName());
                pstmt.setString(4, custInf.getCity());
                pstmt.setString(5, custInf.getProvinceState());
                pstmt.setString(6, custInf.getCountry());
                pstmt.setString(7, custInf.getZipPostalCode());
                pstmt.setString(8, custInf.getAddressID());
                pstmt.executeUpdate();
            }catch(SQLException e){
                e.printStackTrace();
    }In addition, here is my customer sql table.
    -- Table structure for table `customer`
    DROP TABLE IF EXISTS `customer`;
    CREATE TABLE `customer` (
    `CustomerID` mediumint(9) NOT NULL auto_increment,
    `FirstName` varchar(20) NOT NULL,
    `LastName` varchar(20) NOT NULL,
    `HomePhone` varchar(11) NOT NULL,
    `WorkPhone` varchar(11) default NULL,
    `Email` varchar(20) NOT NULL,
    `AddressID` mediumint(9) default NULL,
    PRIMARY KEY (`CustomerID`),
    KEY `AddressID` (`AddressID`),
    CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`AddressID`) REFERENCES `address` (`AddressID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    -- Dumping data for table `customer`
    LOCK TABLES `customer` WRITE;
    /*!40000 ALTER TABLE `customer` DISABLE KEYS */;
    /*!40000 ALTER TABLE `customer` ENABLE KEYS */;
    UNLOCK TABLES;

    to the best of my knowledge, this is something related to the database and not the programming. If you'd want to be the only user to read and edit the table, speicify only one user with that privilege and make it password protected. User must enter the password to write to the tables.

  • How to insert One table value to Another Table

    Hi friends
    Please have a look on this Code. Since i am new Java i am not able to findout the Solution for it
    private void displayavailablity(String selecteditem1)
                   try
                        Vector columnNames = new Vector();
                        Vector data1 = new Vector();
                        String bname,bauthor,bcategory,bref1,bavail,bid;
                        int bref,mid,num;
                        rs = st.executeQuery("SELECT * FROM Books where BAuthorandPublisher='" + selecteditem1 +"'");     
                        while(rs.next())
                             bname = rs.getString("BName");                         
                             bauthor = rs.getString("BAuthorandPublisher");
                             bcategory = rs.getString("BCat");
                             bref = rs.getInt("BRef");
                             if(bref==1)bref1="Yes";
                             else bref1 = "No";
                             mid = rs.getInt("Mid");
                             if(mid==0)bavail="Available";
                             else bavail="Issued To:"+mid;
                             bid = rs.getString("BId");
                             System.out.println("Book Name is::"+bname);
                             System.out.println("Book Availabilty::"+bavail);
                             num = st.executeUpdate("insert into BSearch Values('"+bid+"','"+bname+"','"+bcategory+"','"+bauthor+"','"+bavail+"','"+bref1+",')");
                             System.out.println("Inseted in the table");
                        /**ResultSetMetaData md= rs.getMetaData();
                        int columns =md.getColumnCount();
                        String booktblheading[]={"Book ID","Book NAME","BOOK AUTHOR/PUBLISHER","REFRENCE","CATEGORY"};
                        for(int i=1; i<= booktblheading.length;i++)
                             columnNames.addElement(booktblheading[i-1]);
                        while(rs.next())
                             Vector row = new Vector(columns);
                             for(int i=1;i<=columns;i++)
                                  row.addElement(rs.getObject(i));
                             data1.addElement(row);
                             //System.out.println("data is:"+data);
                        ((DefaultTableModel)table.getModel()).setDataVector(data1,columnNames);
                        //DefaultTableModel model = new DefaultTableModel(data1,columnNames);
                        //table.setModel(model);
                        rs.close();
                        //st.close(); */
                   catch(SQLException ex)
         }I trigger this Method when a JComboBox Item is Selected.
    For an example when i select an Item the select Query brings all the Record Equals to the Selected item. Now i want to insert the Selected items with some Modification to Another Table.
    Now the Problem is My Program Inserts Only One Record (Though there are Many Records Equals to Selected Item)
    Please give me a Better Solution
    Thank you

    jolif,
    If you're "new to java" then might I suggest you leave swing until you're "not so new to java"... it involves so many "advanced concepts" (unlike VB) that it constitutes a biohazard... i.e. it's fundamentally inimical to humanoid lifeforms.
    Now... Having duly vented my spleen, try rs.updateRow();

  • Insert only the third row of table

    Hi!
    What has to be done if I want to insert only the third row of internal table
    into workarea ? How can you handle with such specific circumstances ?
    Regards
    ertas

    Hello!
    I need it for this case.
    l_api_header_tab's thir row must be inserted, but regarding to the corresponding
    fields.
    How can I adapt this command READ ITAB INTO WA INDEX 3.
    LOOP AT l_api_header_tab INTO l_api_header_wa.
    move-corresponding l_api_header_wa to LG_IOTAB .
    append LG_IOTAB .
    ENDLOOP.
    Regards
    ertas

  • Display columns from two tables without making join

    Hi,
    I need to perform currency conversion in the report.
    For eg:) Whatever the currency in ar_payment_schedules i want to
    convert it to INR equivalent.
    Following is the query to do this.
    select ps.invoice_currency_code Currency_B,
         decode(ps.invoice_currency_code, 'INR',ps.amount_due_original,
                   round(ps.amount_due_original*
                                  ps.exchange_rate,
                             curr.precision)
         from
              ar_payment_schedules     ps,
              fnd_currencies          curr
         where ps.customer_id          = '111'
         and curr.currency_code      = 'INR'
    When i do this in the Administration tool, the answers modules erroring out saying
    that no joins between ar_payment_schedules and fnd_currencies. But here join is
    not needed becuase fnd_currencies is filtered with INR and will return only
    one row. Without joining two tables how can i get the same results in Answers.
    thanks,
    Prasanna

    If it would return only one row then what is the need for the join (is it just for returning the precision?). Cant you just hard code the precision value instead of getting it from the table? Also you are doing a cartesian join, though the filters would take care of the final output this would result in a bad performance as your data starts scaling out. You need to find a key to join these 2 tables. If you do not have one, then just create a view with the cartesian join alone and then use that in your report.
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • Trigger with Condition problem - insert only when not exists

    Hello experts!
    I have a problem with a trigger I'm trying to create. It compiles but I receive an error message when the trigger fires.
    The scenario is as follows:
    I have a table TBL_PUNKTDATEN. Whenever the status for a record in that table is changed to 3 or 4 I need the trigger to insert a dataset into my target table (TBL_ARBEIT_ZU_GEBIET).
    However, the trigger must only insert data when there's no existing record in the target table. The condition that specifies whether there is a dataset or not, is the field LNG_GEBIET, which exists in the source as well as in the target table. Hence, for each LNG_GEBIET there can be only one dataset in the target table!
    I created a trigger using the following code. However it doesn't work.
    Maybe you'll see what I want to achieve when having a look at my code.
    Can you please help me out on this one?
    Thanks a lot!
    Sebastian
    create or replace
    TRIGGER set_status_arbeit_zu_gebiet AFTER
      UPDATE ON TBL_PUNKTDATEN FOR EACH ROW WHEN(new.INT_STATUS=3 or new.INT_STATUS=4)
    declare
        cursor c is select LNG_GEBIET from TBL_ARBEIT_ZU_GEBIET where PNUM = 1114 and LNG_GEBIET=:new.LNG_GEBIET;
        x number;
    begin
        open c;
        fetch c into x;
        if c%NOTFOUND  then 
        INSERT INTO TBL_ARBEIT_ZU_GEBIET
            LNG_GEBIET,
              LNG_ARBEITSSCHRITT,
              PNUM,
              INT_BEARBEITER,
              DATE_DATUM,
              GEPL_DATUM
            VALUES
            (:new.LNG_GEBIET,
             52,
             1114,
             895,
             sysdate,
             to_date('01.01.1990', 'DD.MM.YYYY')
        end if;
    end;Well, on the first insert the code works properly and inserts the recordset as expected. However, if there is an existing recordset where :new.LNG_GEBIET matches LNG_Gebiet in my target table, I receive the ORA-06502 error!
    Maybe that spcifies it a little bit???
    Hope you can help me!
    Thank you!
    Edited by: skahlert on 23.09.2009 10:26
    Edited by: skahlert on 23.09.2009 10:28

    Thank you very much Peter G!
    That %Rowtype mod did the trick! Great solution! Thanks! The trigger works principally if there wasn't the fact that it fires also when the status of one individual record is 3 or 4.
    I need it to fire only when all records with the same attribute LNG_GEBIET (by the way, you guess was right - it's not a number) are of status 3 or 4.
    Is it possible to use the cursor function for the trigger's when condition?
    Such as:
    declare
        cursor c3 is select COUNT(*) from TBL_PUNKTDATEN where LNG_GEBIET=:new.LNG_GEBIET;and
    declare
        cursor c4 is select COUNT(*) from TBL_PUNKTDATEN where INT_STATUS = 3 and  LNG_GEBIET=:new.LNG_GEBIET or INT_STATUS = 4 and  LNG_GEBIET=:new.LNG_GEBIET;
      And then subsequently somehow compare the results of both cursors?
    ... WHEN c3=c4
    declare
        cursor c2 is select LNG_GEBIET from TBL_ARBEIT_ZU_GEBIET where PNUM = 1114 and LNG_GEBIET=:new.LNG_GEBIET;
        v_c2  c2%ROWTYPE;
    begin
    open c2;
    fetch c2 into v_c2;
    if c2%notfound then
            INSERT INTO TBL_ARBEIT_ZU_GEBIET
            LNG_GEBIET,
              LNG_ARBEITSSCHRITT,
              PNUM,
              INT_BEARBEITER,
              DATE_DATUM,
              GEPL_DATUM
            VALUES
            (:new.LNG_GEBIET,
             52,
             1114,
             895,
             sysdate,
             to_date('01.01.1990', 'DD.MM.YYYY')
            end if;
            close c2;
    end;Please excuse me if the attempt is simply stupid!
    Sebastian
    Edited by: skahlert on 23.09.2009 15:36
    I just saw your reply Max! Thank you! Now I understand far better! Seems to be a successful day! I'm learning a lot! Will also test that method!
    If we could find a solution to the problem I described above it would make it a perfect day! I'm continously trying different attempts to have the trigger only fire when all records are 3 or 4.
    Not that you think I'm just waiting for your answers! That's not the case!
    Thank you all!
    Edited by: skahlert on 23.09.2009 17:30

  • Merge only one row out of multiple rows

    I need to prepare a merge statement which merge only one row in to a table. Below is the table definition, sample data and merge statement i used.
          CREATE TABLE Mob_Attr (NAME VARCHAR2(20), ATTR_1 VARCHAR2(20), ATTR_2 VARCHAR2(20), ATTR_3 VARCHAR2(20));
          CREATE TABLE Mob_Desc (NAME VARCHAR2(50), ATTR_1 VARCHAR2(20), ID NUMBER(20));     
          CREATE TABLE Mob_Main (NAME VARCHAR2(20), ATTR VARCHAR2(20), ID VARCHAR2(10));     
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n1','aa',null,null);
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n2','bb',null,null);
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n3','cc',null,null);
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n4','dd',null,null);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',10);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',15);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',123);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',1455);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n2','bb',455);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n2','bb',135);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n3','cc',15);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n3','cc',52);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n4','dd',1455);
          merge into Mob_Main ma using
          (select d.name, d.attr_1,d.id from Mob_Attr a, Mob_Desc d
          where a.name = d.name and a.attr_1 = d.attr_1
          ) q on (ma.name=q.name and ma.attr=q.attr_1)
          when not matched then
          insert (NAME,ATTR,ID)
          values (q.name,q.attr_1,q.ID);
          Above merge statement will actually merge entire data . But i want the first row will only get inserted to the base table (Mob_Main). If we take name 'n1' first row from table Mob_Desc with ID as '10' only should get inserted. I can go for a cursor to do this as i have huge data volume i prefer merge instead.

    MERGE INTO Mob_Main ma
         USING (SELECT d.name, d.attr_1, d.id
                  FROM Mob_Attr a, Mob_Desc d
                 WHERE a.name = d.name AND a.attr_1 = d.attr_1 AND id = 10
                UNION
                SELECT d.name, d.attr_1, d.id
                  FROM Mob_Attr a, Mob_Desc d
                 WHERE a.name = d.name AND a.attr_1 = d.attr_1 AND id != 10
                       AND NOT EXISTS
                                  (SELECT 1
                                     FROM Mob_Desc d1
                                    WHERE     d.name = d1.name
                                          AND d.attr_1 = d1.attr_1
                                          AND d1.id = 10)) q
            ON (ma.name = q.name AND ma.attr = q.attr_1)
    WHEN NOT MATCHED
    THEN
       INSERT     (NAME, ATTR, ID)
           VALUES (q.name, q.attr_1, q.ID);
    COMMIT;
    select *
    from Mob_Main
    order by name, id;
    NAME                 ATTR                 ID       
    n1                   aa                   10       
    n2                   bb                   135      
    n2                   bb                   455      
    n3                   cc                   15       
    n3                   cc                   52       
    n4                   dd                   1455     
    6 rows selected.

  • Problem to insert only month and year instead of full date

    select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
            b.epd, b.lpd
    from prl_daftar_proses a, senarai_pesalah b, penjara p
    where a.no_daftar=b.no_daftar
    and a.episod=b.episod
    and b.penjara_id = p.penjara_id
    and a.setuju_jplp is null
    and a.bulan_proses between to_date(:FROM,'dd/mm/yyyy') and to_date(:TO,'dd/mm/yyyy')
    order by b.penjara_id, a.bulan_proses,a.no_daftarHi,anyone can help me how i can insert only month and year from the value that have full date in the database??
    for example,the date is 09/18/2012, but i just want to insert 09/2012 as parameter. If i want to insert only one parameter, i can do that..But i have problem when I want to insert two parameters..

    jeneesh wrote:
    Welcome to the forum..
    This..?
    Assuming bulan_proses is a date without time part
    select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
            b.epd, b.lpd
    from prl_daftar_proses a, senarai_pesalah b, penjara p
    where a.no_daftar=b.no_daftar
    and a.episod=b.episod
    and b.penjara_id = p.penjara_id
    and a.setuju_jplp is null
    and a.bulan_proses between to_date(:FROM,'mm/yyyy') and last_day(to_date(:TO,'mm/yyyy'))
    order by b.penjara_id, a.bulan_proses,a.no_daftar
    i got another problem..
    before that.may i know what is the function of last_day?

  • Help: Error on SELECT INTO TABLE2 FROM TABLE AS E1 JOIN...

    Can anyone help? I am getting an error in my sql statement below:
    SELECT E1.COL1, E1.COL2, E2.COL3, E1.COL4
    INTO TABLE2
    FROM TABLE AS E1
    JOIN TABLE AS E2 ON
    (E1.COL1 = '10000' AND E2.COL1 = '20000') OR
    (E1.COL1 = '20000' AND E2.COL1 = '10000')
    WHERE
    E1.COL3 = E2.COL3 AND E1.COL4 = '11000' AND E1.COL3 < '2011/04/01'
    The script works fine on SQL Server (2008) but I am unable to run it in Oracle.
    I am using Oracle SQL Developer v1.5.4 Build MAIN-5940.
    Thanks in advance for anyone who can help.

    Tubby wrote:
    850777 wrote:
    Thanks for the immediate reply Tubby. I will try removing the AS for aliasing.
    I still have one more problem though (about removing the line INTO TABLE2) because
    I am actually using it to store the SELECTed data into the new TABLE2. Is there a workaround for this? ThanksWhat are you trying to do here? View the data produced by the query, or create a pl/sql routine?
    What's the point behind creating a table to store the results in?
    Tubby wrote:850777 wrote:
    Thanks for the immediate reply Tubby. I will try removing the AS for aliasing.
    I still have one more problem though (about removing the line INTO TABLE2) because
    I am actually using it to store the SELECTed data into the new TABLE2. Is there a workaround for this? ThanksWhat are you trying to do here? View the data produced by the query, or create a pl/sql routine?
    What's the point behind creating a table to store the results in?What I am trying to do is copy the data in TABLE to TABLE2 but with the data in E1.COL3 swapped with the one in E2.COL3 based on certain conditions.
    Basically I am just trying to swap the values of a column (COL3) and store it in my new table (TABLE2) together with all the (unswapped) values from all the other columns.
    Ex.
    TABLE
    COL1 COL2 COL3 COL4
    1 1 1 1
    2 2 3 2
    3 3 2 2
    4 4 4 1
    Target result:
    TABLE2
    COL1 COL2 COL3 COL4
    1 1 1 1
    2 2 2 2 <-swapped values
    3 3 3 2 <-in COL3
    4 4 4 1

Maybe you are looking for

  • Extremely high memory usage on ideapad u310

    Hi all, I've got a problem with my ideapad u310 touch running windows 8.1. When doing completely nothing (just staring at the desktop with no programs running) my laptop uses ~55% of ram. I find this extremely high, when i open a few chrome tabs and

  • Reservation not getting generated

    Dear all, In Repetetive manufacturing.After running  the MRP , system is creating the planned order for fert and the raw materials. How to see the reservation created against these planned order  so that stores person can issue the material to the pr

  • Sending SMS Via my java Application

    Hi all, I want to develop a feature to send SMS from my java application by using mobile phone. I am new to java. tell me how to connect the mobile phone from my applicatio and how do i send the SMS. Hoping your help sooner.... Thanks and regards, Su

  • Why won't Bridge CS6 launch?

    I've just installed Photoshop CS6 (64bit).  I cannot launch Adobe Bridge - I get the message "Waiting for Bridge CS6....." and it won't progress beyond this point.  Has anyone got any idea what I can do?  I've rebooted the PC, but still the same.

  • Trouble installing virtual PC onto Mac OS X v10.4.10

    i'm not very tech savvy, but...here's the best i can describe my problem. i'm currently using an iMac OS X v10.4.10 and i'm trying to install the program Virtual PC, which allows me to run windows programs on the Mac computer. even when the first par