[b]please help me to insert recored to MS_Access Table [/b]

please help me to insert recored to MS_Access Table please can you modify my program becouse it is not working
import java.awt.*;
import java.util.*;
import java.awt.event.* ;
import javax.swing.*;
import javax.swing.event.*;
import java.sql.*;
class ProductMast2 extends JFrame
private JTextField       txtProd_Id;
private JButton          btnAdd;
String url,sql;
String sqlI;
Container cp ;
Connection conn;
Statement stmt;
ResultSet rs;
    public ProductMast2()
       cp = getContentPane() ;
            txtProd_Id                   = new JTextField( "" , 8   ) ;
                btnAdd                        =new JButton ("add");
               cp.add(txtProd_Id  , BorderLayout.SOUTH  ) ;
               cp.add(btnAdd  , BorderLayout.NORTH  ) ;
               this.connection();
     btnAdd.addActionListener(new ActionListener(){
     public void actionPerformed(ActionEvent  ee)
         try
                    sqlI="Insert into Pro"
                    +"(Prod_Id)"
                     +"values('"+txtProd_Id+"')";      
                  txtProd_Id.setText("");
                    rs=stmt.executeQuery(sqlI);
                    //rs=stmt.executeUpdate(sqlI);
                    while (rs.next()) {
                  txtProd_Id.setText(rs.getString(1));
                 // should be in finally block
                  rs.close();
                  stmt.close();
                  conn.close();
                  catch (Exception e)
                   System.out.println("Exception caught as: " + e.toString());
     public void connection()
                                 url="jdbc:odbc:Pro";
                                         try
                                         // Loading thr Driver by passing it to Class name() method.
                                         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                          //creating a connection object by passing  the name of the 32bit ODBC driver
                                            //throut the Driver Manger getConnection()mathod
                                      conn=DriverManager.getConnection(url);
                                         //creat Statement object
                                         stmt=conn.createStatement();
                                         System.out.println("Successfuly  connected");
                                   //     conn.close();
                                                  sql="SELECT * FROM Pro";
                                                  rs=stmt.executeQuery(sql);      
                                                  rs.next();
                                                  txtProd_Id.setText(rs.getString(1));
                                              catch(Exception sqlExcep)
                                                             System.out.print("ERROR:"+sqlExcep);
class Pro
   public static void main( String[] args )
      ProductMast2 emp = new ProductMast2() ;
    // ProductMast2 emp = new ProductMast2() ;
      emp.connection();
     /////////  ProductMast1.connection();
       emp.setTitle( " Product  Master1 SOPS For Al-Hesn For Cloding And Trading" ) ;
       emp.setSize( 900, 250 ) ;
       emp.setVisible( true );
       //emp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       //System.exit(0);
        //public void windowClosing(WindowEvent WE)
          return ;
 

Hi,
you surely would need a good tutorial for jdbc and one for sql.
                    sqlI="Insert into Pro"
                    +"(Prod_Id)"
                     +"values('"+txtProd_Id+"')";      
                  txtProd_Id.setText("");     Please use prepared statements that concated sql strings
                    rs=stmt.executeQuery(sqlI);
                    //rs=stmt.executeUpdate(sqlI);
                    while (rs.next()) {
                  txtProd_Id.setText(rs.getString(1));
               }You must be joking here. Statement.executeQuery is used for SELECTing data. You insert statement is never going to return a resultset. ExecuteUpdate, which you have commented by the way, does the job but it returns an int(RecordsAffected).
Kiros

Similar Messages

  • Please Help me in inserting record in a table

    Hi,
    Kindly help me on how to insert records in a table that the values are from the another table.
    for example :
    i have table1, all of the records in column1 of table1 will be inserted to table2 column2 . .
    I already tested it to a visual foxpro programming language and it's ok, i used this command :
    *"INSERT INTO table1 (column1) SELECT column2 FROM table2"*
    but when I try it to a JAVA Program, there's an error.
    Please help me.. Thank You.

    Sir, this is what you mean?
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3256)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1313)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1585)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1500)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1485)
    at remittance.utility.security.frmRole.addtoPermission(frmRole.java:197)
    at remittance.utility.security.frmRole.btnADDActionPerformed(frmRole.java:177)
    at remittance.utility.security.frmRole.access$200(frmRole.java:22)
    at remittance.utility.security.frmRole$3.actionPerformed(frmRole.java:92)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:5517)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
    at java.awt.Component.processEvent(Component.java:5282)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3984)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1791)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

  • Please help with multiple insert query into nested table!!!!

    I am having a problem with inserting multiple references to objects into a nested table using the following query:
    INSERT INTO TABLE(SELECT Taken_by FROM courses WHERE course_number= 001)
    (SELECT REF(p) FROM persons p
    WHERE p.enroled_in = 'Computing for Business'
    The database says that p.enroled_in is an invalid identifier. I know why this is. This is because the field enroled_in is part of a subtype of person called student_type and the query above is not accounting for this properly. I would like to know the correct syntax to use so I can insert into the nested table wherever a student is enroled into the 'computing for business' course. My full schema is below:
    CREATE TYPE person_type;
    CREATE TYPE student_type;
    CREATE TYPE staff_type;
    CREATE TYPE course_type;
    CREATE TYPE module_type;
    CREATE TYPE address_type AS OBJECT
    Street VARCHAR2 (30),
    Town     VARCHAR2 (30),
    County VARCHAR2 (30),
    Postcode VARCHAR2 (9)
    CREATE TYPE person_type AS OBJECT
    Name VARCHAR2 (50),
    Address address_type,
    DOB     DATE
    ) NOT FINAL;
    CREATE TYPE staff_type UNDER person_type
    Staff_number NUMBER (2,0)
    ) FINAL;
    CREATE TYPE student_type UNDER person_type (
    Student_number NUMBER (2,0),
    Enroled_in VARCHAR2(50),
    MEMBER FUNCTION getAge RETURN NUMBER
    )NOT FINAL;
    CREATE OR REPLACE TYPE BODY student_type AS
    MEMBER FUNCTION getAge RETURN NUMBER AS
    BEGIN
    RETURN Trunc(Months_Between(Sysdate, DOB)/12);
    END getAge;
    END;
    CREATE TYPE module_type AS OBJECT
    Module_number VARCHAR2(6),
    Module_name VARCHAR2(50),
    Credit NUMBER(2,0),
    Taught_in VARCHAR2(50)
    CREATE TYPE students_tab AS TABLE OF REF person_type;
    CREATE TYPE modules_tab AS TABLE OF REF module_type;
    CREATE TYPE course_type AS OBJECT
    Course_number NUMBER (2,0),
    Course_name VARCHAR2(50),
    Dept_name VARCHAR2(50),
    Taken_by Students_tab,
    Contains Modules_tab
    CREATE TABLE modules OF module_type(
    constraint pk_modules primary key (Module_number)
    CREATE TABLE courses OF course_type(
    constraint pk_courses primary key (Course_number)
    NESTED TABLE Taken_by STORE AS students_nt,
    NESTED TABLE Contains STORE AS modules_nt;

    By the way I am using oracle 9i and trying to insert into the nested table data from a subtype (i.e student is a subtype of person)

  • Please help me in inserting data into table from XML message.

    Hi Experts,
    Please provide a procedure to implement my below requirement.
    Since I am new to queue concept.
    [code]- <MESSAGES>
    - <MESSAGE ID="3026900">
      <MSG_ID>3026900</MSG_ID>
      <DT_POSTED>6/20/2013 08:15:48</DT_POSTED>
      <POSTED_BY>GPD_MSG_EXTRACTOR</POSTED_BY>
      <DT_LAST_QUEUED />
    - <MSG>
    - <WORK_SET TRANSACTION_ID="@TRANS_ID" TRANSACTION_TYPE="Batch" IS_ACID="@IS_ACID">
    - <WORK_UNIT GROUP="LEAD_TIME" ACTION="UPDATE" AFFECTED="LEAD_TIME">
    - <RECORDSET TABLE_NAME="LEAD_TIME">
    - <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
    - <rs:data>
      <z:row business_unit_id="3838" geo="AT" sku="A0814818" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      <z:row business_unit_id="202" geo="GB" sku="A0814819" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      <z:row business_unit_id="2828" geo="BE" sku="A0814820" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      </rs:data>
      </xml>
      </RECORDSET>
      </WORK_UNIT>
    - <WORK_UNIT GROUP="LEAD_TIME" ACTION="ADD" AFFECTED="LEAD_TIME">
    - <RECORDSET TABLE_NAME="LEAD_TIME">
    - <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
    - <rs:data>
      <z:row business_unit_id="202" geo="GB" sku="A0814821" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      <z:row business_unit_id="2828" geo="BE" sku="A0814822" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      </rs:data>
      </xml>
      </RECORDSET>
      </WORK_UNIT>
    - <WORK_UNIT GROUP="LEAD_TIME" ACTION="DELETE" AFFECTED="LEAD_TIME">
    - <RECORDSET TABLE_NAME="LEAD_TIME">
    - <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
    - <rs:data>
      <z:row business_unit_id="202" geo="GB" sku="A0814817" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      <z:row business_unit_id="2828" geo="BE" sku="A0814816" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      </rs:data>
      </xml>
      </RECORDSET>
      </WORK_UNIT>
      </WORK_SET>
      </MSG>
      </MESSAGE>
      </MESSAGES>[/code]
    The above XML message is receieved by our oracle queue.Once the message is receieved to our queue.
    We have to process the message according to the action(UPDATE ADD DELETE).
    From this message we have to process only 3 fields (geo  sku lead_time).
    These three feilds data should be processed into the SKU_LEAD_TIME table based on the action.
    Req1:
    IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
    IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
    based on the below condition.
    [code]UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
    WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
    Req2:
    IF the action is delete then the records should be deleted from the "LEAD_TIME_TABLE" table.
    based on the below condition.
    [code]DELETE FROM LEAD_TIME_TABLE
    WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
    Req3:
    IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE"  and "LEAD_TIME_TABLE_STAGING" table
    based on the below conditions.
    Req3.1:
    If SKU from XML message is available in "SKU_TABLE" table
    then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE" table.
    Req3.2:
    If SKU from XML message is not available in "SKU_TABLE" table
    then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE_STAGING" table.
    Req3.3:
    Once the new SKU is avilable in "SKU_TABLE" table then the corresponding SKU record should be
    inserted into "LEAD_TIME_TABLE" table and that record should be deleted from  "LEAD_TIME_TABLE_STAGING" table.
    I am posting required scripts and test cases.
    [code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
    CREATE TABLE LEAD_TIME_TABLE_STAGING(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
    CREATE TABLE SKU_TABLE(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
    INSERT INTO SKU_TABLE VALUES('A0814817','GB',30);
    INSERT INTO SKU_TABLE VALUES('A0814818','AT',30);
    INSERT INTO SKU_TABLE VALUES('A0814819','GB',30);
    INSERT INTO SKU_TABLE VALUES('A0814820','BE',30);
    INSERT INTO SKU_TABLE VALUES('A0814821','GB',30);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
    INSERT INTO LEAD_TIME_TABLE_STAGING VALUES('A0814822','BE',30);[/code]
    From the above message.
    Test case for req3.1:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814821" is available in SKU_TABLE table.
    so the record should be inserted in the LEAD_TIME_TABLE.
    [code]SELECT * FROM LEAD_TIME_TABLE;
    SKU        GEO   LEAD_TIME
    A0814817    GB    30
    A0814818    AT    20
    A0814819    GB    20
    A0814820    BE    20
    A0814821    GB    30[/code]
    Test case for req3.2:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814822" is not available in SKU_TABLE table.
    so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
    [code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
    SKU        GEO   LEAD_TIME
    A0814822    BE     30[/code]
    Test case for req3.3:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814822" is not available in SKU_TABLE table.
    Once I insert SKU number "A0814822" in SKU_TABLE table.
    The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
    and should be deleted from LEAD_TIME_TABLE_STAGING.
    [code]SELECT * FROM LEAD_TIME_TABLE_STAGING;  --- should return NULL.
    SELECT * FROM LEAD_TIME_TABLE;
    SKU        GEO   LEAD_TIME
    A0814817    GB    30
    A0814818    AT    20
    A0814819    GB    20
    A0814820    BE    20
    A0814821    GB    30
    A0814822    BE    30[/code]
    Please help me.
    Thanks in advance.

    Hi,
    I have resolved this issue.
    But I have stuck up in implementing some of the scenarios.
    Req1:
    IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
    IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
    based on the below condition.
    UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
    WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;
    Req3:
    IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE"  and "LEAD_TIME_TABLE_STAGING" table
    based on the below conditions.
    Req3.1:
    If SKU from XML message is available in "schema_name.SKU_TABLE" table.
    The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
    then the three parameter(GEO SKU LEAD_TIME) values from XML message and two fields MODEL,CLASS from SKU_TABLE
    should be inserted into "LEAD_TIME_TABLE" table.
    Req3.2:
    If SKU from XML message is not available in "schema_name.SKU_TABLE" table
    The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
    then the four parameter(BUSINESS_UNIT_ID GEO SKU LEAD_TIME) values from XML message
    should be inserted into "LEAD_TIME_TABLE_STAGING" table.
    Req3.3:
    Once the new SKU is avilable in "schema_name.SKU_TABLE" table then the corresponding SKU record should be
    inserted into "LEAD_TIME_TABLE" table and that record should be deleted from  "LEAD_TIME_TABLE_STAGING" table.
    The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of LEAD_TIME_TABLE_STAGING and "sid" of MAPPING table WHERE business_unit_id=sid.
    I am posting required scripts and test cases.
    [code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
    CREATE TABLE LEAD_TIME_TABLE_STAGING(business_unit_id NUMBER,sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
    CREATE TABLE SKU_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class VARCHAR2(10));
    CREATE TABLE mapping(sid NUMBER,schema_name VARCHAR2(20));
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
    INSERT INTO SKU_TABLE VALUES('A0814817','M125','C111');
    INSERT INTO SKU_TABLE VALUES('A0814818','M127','A111');
    INSERT INTO SKU_TABLE VALUES('A0814819','M126','A111');
    INSERT INTO SKU_TABLE VALUES('A0814820','N100','B111');
    INSERT INTO SKU_TABLE VALUES('A0814821','P123','B111');
    INSERT INTO mapping VALUES(202,'WEDB');
    INSERT INTO mapping VALUES(2828,'HR');
    INSERT INTO mapping VALUES(3838,'BB');
    [/code]
    Test case for req3.1:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814821" is available in schema_name.SKU_TABLE table.
    so the record should be inserted in the LEAD_TIME_TABLE.
    [code]SELECT * FROM LEAD_TIME_TABLE;
    SKU        MODEL  CLASS  GEO   LEAD_TIME
    A0814817    M125   C111   GB     30
    A0814818    M127   A111   AT     20
    A0814819    M126   A111   GB     20
    A0814820    N100   B111   BE     20
    A0814821    P123   B111   GB     30
    [/code]
    Test case for req3.2:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814822" is not available in SKU_TABLE table.
    so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
    [code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
    BUSINESS_UNIT_ID       SKU        GEO   LEAD_TIME
    2828               A0814822    BE     30[/code]
    Test case3.3.3:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814822" is not available in SKU_TABLE table.
    Once I insert SKU number "A0814822" in SKU_TABLE table.
    The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
    and should be deleted from LEAD_TIME_TABLE_STAGING.
    [code]INSERT INTO SKU_TABLE VALUES('A0814822','P123','B111');
    SELECT * FROM LEAD_TIME_TABLE_STAGING;  --- should return NULL.
    SELECT * FROM LEAD_TIME_TABLE;
    SKU        MODEL  CLASS  GEO   LEAD_TIME
    A0814817    M125   C111   GB     30
    A0814818    M127   A111   AT     20
    A0814819    M126   A111   GB     20
    A0814820    N100   B111   BE     20
    A0814821    P123   B111   GB     30
    A0814822    P123   B111   GB     30[/code]
    I am able to implement Req1 and Req3.1 for action UPDATE and INSERT in single merge statement.
    However my code is not taking care of all my requirements.
    Please find my below code.
    [code]   CREATE OR REPLACE PACKAGE BODY messg_values_process
       AS
        procedure ProcessInboundLtimeMessage(p_xml_message XmlType)
        is
        begin
            for work_unit in (
                select message.MESSAGE_ID
                     , work_unit.ACTION
                     , work_unit.LEADTIME_NODES
                  from XmlTable(
                        '/MESSAGES/MESSAGE'
                        passing p_xml_message
                        columns
                            MESSAGE_NO          for ordinality
                          , MESSAGE_ID          number path '@ID'
                          , WORK_UNIT_NODES     XmlType path 'MSG/WORK_SET/WORK_UNIT'
                       ) message
                     , XmlTable(
                        XmlNamespaces(
                            'urn:schemas-microsoft-com:rowset' as "rs"
                          , '#RowsetSchema' as "z"
                        '/WORK_UNIT'
                        passing message.WORK_UNIT_NODES
                        columns
                            WORK_UNIT_NO        for ordinality
                          , ACTION              varchar2(10 char) path '@ACTION'
                          , LEADTIME_NODES       XmlType path 'RECORDSET[@TABLE_NAME="LEAD_TIME"]/xml/rs:data/z:row'
                       ) work_unit
        LOOP
                CASE work_unit.ACTION
                  WHEN 'ADD'    THEN MergeData(work_unit.LEADTIME_NODES);
                  WHEN 'UPDATE' THEN MergeData(work_unit.LEADTIME_NODES);
                  WHEN 'DELETE' THEN RemoveData(work_unit.LEADTIME_NODES);
                  ELSE null;
                END CASE;
            END LOOP;
        END ProcessInboundLtimeMessage;
            procedure MergeData(p_leadtime_nodes XmlType)
        is
        begin
            if (p_leadtime_nodes is not null) then
                merge into LEAD_TIME_TABLE old
                using(
                    select *
                      from XmlTable(
                            XmlNamespaces(
                                'urn:schemas-microsoft-com:rowset' as "rs"
                              , '#RowsetSchema' as "z"
                            '/z:row[not(@business_unit_id=following-sibling::z:row/@business_unit_id)]'
                            passing p_leadtime_nodes
                            columns
                                ITEM_NO             for ordinality
                              , BUSINESS_UNIT_ID    number path '@business_unit_id'
                              , GEO                 varchar2(20 char) path '@geo'
                              , SKU                 varchar2(20 char) path '@sku'
                              , LEAD_TIME           number path '@lead_time'
                ) NEW
                   ON (old.VK_UNIT = new.SKU
                  AND old.GEO=new.GEO)
                when matched then update
                   set old.LEAD_TIME = new.LEAD_TIME
                when not matched then INSERT
                     ( old.VK_UNIT
                     , old.MODEL
                     , old.CLASS
                     , old.GEO
                     , old.LEAD_TIME
                     , old.COUNTDOWN
                     , old.LAST_UPDATED_DATE
                     values
                     ( new.SKU
                     ,'A123'
                     ,'A1234'
                     , new.GEO
                     , new.LEAD_TIME
                     , 'N'
                     , sysdate
            end if;
             exception
            when others then
                LogDataError(
                    'MergeData Procedure Failed #: '||chr(10)||sqlerrm
                  , null
                  , null
        END MergeData;
    END messg_values_process;
    /[/code]
    Please help me.
    Thanks.

  • Please help me line up my cells or tables

    I cannot ge tthe elements on my webpage to line up I have
    moved them around all to no avail the page is:
    http://www.abea.cc/aboutus.html
    notice the offset between the headers and the white body. Could
    someone please help me I am lost. I can line them up perfectly in
    my preview but always offset when I look at them online.I am using
    dreamweaver cs3.

    This image (and others like it) are what's messing you up:
    http://www.abea.cc/images/The-Bay-Shortest-Header_10.jpg
    Adjust the images to not show any of the black outside of the
    white line, then you'll have an easier time adjusting the table
    below it. Once you fix the image you'll have to adjust the table
    structure.

  • Please help --Error in insert into Statement

    Error in insert into statement while connecting to ms-access.
    import java.sql.*;
    public class stupid8
         public stupid8()
              try{
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection con=DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};"+"DBQ=d:/Servlet/registration.mdb");
                   PreparedStatement s=con.prepareStatement("insert into Deposit (username,date,amount) values(?,?,?)");
                   s.setString(1,"username");
                   s.setString(2,"date");
                   s.setString(3,"amount");
                   s.executeUpdate();
                   System.out.println("Success");
              catch(Exception e)
                   System.out.println("Error: "+e);
         public static void main(String args[])
              new stupid8();
    }

    My first guess is that the database is objecting to the use of "date" as a column name; "date" is often a reserved word in databases.
    It would be less of a guess if you posted the actual error message.

  • Please help! (creating new rows in a table)

    Hi guys.
    I have the following table:
    Guest ID | visit ID | start date | end date | days | total amount | avg amount
    1234.......| 6750...| 01/01/08...| 20/01/08 | 20....| $2000.........| $100
    Avg amount = amout per day = days/total amount
    I need to figure out a way of summing up all the profits from, say, last 3 weeks, 2 months etc.
    To do that, I am thinking of breaking up each stay period by days.
    i.e. to create a new row in a table for each day.
    So, for this example, we'd have 20 new rows,
    with same guest iD and visit ID,
    start date and end date are the same because we only count one day...
    Guest ID | visit ID | start date | end date | days | total amount | avg amount
    1234.......| 6750...| 01/01/08 ..| 01/01/08 | 1.......| $100............| $100
    1234......| 6750....| 02/01/08 ..| 02/01/08 | 1.......| $100..........| $100
    etc
    The question is, is there any way to make oracle do this?
    As in, to create new rows (maybe in a new table?)
    Any help/ideas would be appreciated!
    I am using Oracle SQL Plus 8.1.7.0.0

    I have used all_objects to populate multiple records as you are living in stone age :-)
    SQL> drop table temp;
    Table dropped.
    SQL> create table temp (
      2             Guest_ID integer primary key,
      3             visit_ID integer,
      4             start_date date,
      5             end_date date,
      6             days integer,
      7             total_amount integer,
      8             avg_amount integer);
    Table created.
    SQL> insert into temp values (1234, 6750, '01/jan/08', '20/jan/08', 20, 2000, 100);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select t.guest_id,t.visit_id,t.start_date+rownum-1 start_date,t.start_date+rownum-1 end_date, 1 as days, avg_amount as total_amount, avg_amount
      2    from temp t,
      3         (select 1
      4       from all_objects,
      5           (select (end_date - start_date) + 1 day_count
      6              from temp t
      7             where guest_id = 1234)
      8        where rownum <= day_count);
      GUEST_ID   VISIT_ID START_DAT END_DATE        DAYS TOTAL_AMOUNT AVG_AMOUNT
          1234       6750 01-JAN-08 01-JAN-08          1          100        100
          1234       6750 02-JAN-08 02-JAN-08          1          100        100
          1234       6750 03-JAN-08 03-JAN-08          1          100        100
          1234       6750 04-JAN-08 04-JAN-08          1          100        100
          1234       6750 05-JAN-08 05-JAN-08          1          100        100
          1234       6750 06-JAN-08 06-JAN-08          1          100        100
          1234       6750 07-JAN-08 07-JAN-08          1          100        100
          1234       6750 08-JAN-08 08-JAN-08          1          100        100
          1234       6750 09-JAN-08 09-JAN-08          1          100        100
          1234       6750 10-JAN-08 10-JAN-08          1          100        100
          1234       6750 11-JAN-08 11-JAN-08          1          100        100
      GUEST_ID   VISIT_ID START_DAT END_DATE        DAYS TOTAL_AMOUNT AVG_AMOUNT
          1234       6750 12-JAN-08 12-JAN-08          1          100        100
          1234       6750 13-JAN-08 13-JAN-08          1          100        100
          1234       6750 14-JAN-08 14-JAN-08          1          100        100
          1234       6750 15-JAN-08 15-JAN-08          1          100        100
          1234       6750 16-JAN-08 16-JAN-08          1          100        100
          1234       6750 17-JAN-08 17-JAN-08          1          100        100
          1234       6750 18-JAN-08 18-JAN-08          1          100        100
          1234       6750 19-JAN-08 19-JAN-08          1          100        100
          1234       6750 20-JAN-08 20-JAN-08          1          100        100
    20 rows selected.Thanks,
    Karthick.

  • Please help me I am not seeing Database table column names in field explorer view

    Hi,
    I am developing a crystal report using eclipse and sql server. After creating connection, when i drag and drop tables, The table name and its columns should apper in field explorer view. Then we drag the columns onto crystal report. Unfortunately I am just  seeing only table names but not column names in field explorer view. Could anyone help me?
    After downloading eclipse I have plugged in the crystal report using the following instructions
    1. Click on the Help menu, and then Software Updates > Find and Install... to open the Install/Update wizard.
    2. Select Search for new features to install and click Next.
    3. Click the New Remote Site button. This will launch the New Update Site wizard
    4. Type the Business Objects Updsate Site for the Name field and the following for the URL: http://www.businessobjects.com/products/dev_zone/eclipse/
    5. Click OK to complete the wizard.
    6. Enable the newly created Business Objects Update Site checkbox as well as the Callisto Discovery Site (which should appear by default with Eclipse 3.2) and click Finish.
    Expand the Business Objects Update Site node and enable the Crystal Reports for Eclipse 1.0.0v555 checkbox.
    8. Expand the Callisto Discovery Site and click the button "Select Required". This will automatically select the required Eclipse features necessary to successfully install Crystal Reports for Eclipse.
    Thank You
    Rajavardhan Sarkapally

    Now we have a lot of views which select data from the tables, but I need to get the "Table Column Name" that is linked in the view.
    If you are using SQL Server 2012/2014, then you can use
    sys.dm_exec_describe_first_result_set (Transact-SQL) to gte the informations.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Same Conect By query workds fine in 9i but not in 10g - Please help

    We recently moved our project from 9i to 10g. A connect by query works fine in 9i environment but same not working in 10g environment. Please help.
    While trying with a sample table, that also behaves samem way. Please find the query and help on how to solve.
    create table test_connect_by (
    parent number,
    child number,
    constraint uq_tcb unique (child)
    insert into test_connect_by values ( 5, 2);
    insert into test_connect_by values ( 5, 3);
    insert into test_connect_by values (18,11);
    insert into test_connect_by values (18, 7);
    insert into test_connect_by values (17, 9);
    insert into test_connect_by values (17, 8);
    insert into test_connect_by values (26,13);
    insert into test_connect_by values (26, 1);
    insert into test_connect_by values (26,12);
    insert into test_connect_by values (15,10);
    insert into test_connect_by values (15, 5);
    insert into test_connect_by values (38,15);
    insert into test_connect_by values (38,17);
    insert into test_connect_by values (38, 6);
    insert into test_connect_by values (null, 38);
    insert into test_connect_by values (null, 26);
    insert into test_connect_by values (null, 18);
    COMMIT;
    In Oracle 10g:
    SQL> select level, lpad(' ',2*(level-1)) || to_char(child) s
    2 from test_connect_by
    3 start with level = 1
    4 connect by prior child = parent;
    no rows selected
    In Oracle 9i:
    SQL> select level, lpad(' ',2*(level-1)) || to_char(child) s
    2 from test_connect_by
    3 start with level = 1
    4 connect by prior child = parent;
    LEVEL S
    1 2
    1 3
    1 10
    1 5
    2 2
    2 3
    1 9
    1 8
    1 11
    1 7
    1 13
    1 1
    1 12
    1 15
    2 10
    2 5
    3 2
    3 3
    1 17
    2 9
    2 8
    1 6
    1 38
    2 15
    3 10
    3 5
    4 2
    4 3
    2 17
    3 9
    3 8
    2 6
    1 26
    2 13
    2 1
    2 12
    1 18
    2 11
    2 7
    39 rows selected.

    Hi,
    user10739895 wrote:
    It works fine and gives result without the "START WITH LEVEL = 1".
    However, in 9i, we get the result with the clause "START WITH LEVEL = 1" and after migrating, now in 10g, we are not getting the result. Is it like in 10g, if it is Level 1, we should not specify?
    Also, please clarify, is it like, if we don't specify the default is Level 1? Conceptually, LEVEL is assigned when rows enter the result set. Rows that enter because of the START WITH clause, by definition, have LEVEL=1. Rows that enter because of CONNECT BY have the LEVEL of the row to which they are connected, plus 1.
    "START WITH LEVEL = 1" returns no rows when I try it in Oracle 11.1.0.
    I suggest not using it.
    If you don't have a START WITH clause, you'll START WITH every row in the table. That seems to be what you got in Oracle 9. Is that what you want? If so, then just don't use a START WITH clause.

  • Please help me on this logic

    Please help me on below requirement.
    Records should not come are total of CODE1+CODE2=0 and AMOUNT< 500.
    Without using MINUS operator becuase
    we have millions of records with different CODES it hampers the performance.
    Data in the table as below
    CODE1 CODE2 AMOUNT
    0 1 500
    0 0 500
    0 0 400
    1 0 400
    2 0 200
    0 0 600
    1 2 700
    After making sum of code data in the table as below.
    CODE1 CODE2 TOT_CODE AMOUNT
    0 1 1 500
    0 0 0 300
    0 0 0 400
    1 0 1 400
    2 0 2 200
    0 0 0 600
    1 2 3 700
    The output should be as below.
    CODE1 CODE2 TOT_CODE AMOUNT
    0 1 1 500
    1 0 1 400
    2 0 2 200
    0 0 0 600
    1 2 3 700
    Records should not come are total of CODE1+CODE2=0 and AMOUNT< 500.
    I tried the below query it's not giving correct result.
    SELECT * FROM(SELECT sd.*,code1+code2 AS TOT_CODE FROM student sd)
    WHERE TOT_CODE !=0
    AND amount>500
    If I use below query it's giving correct out put but taking long time
    because we have millions of records.
    SELECT * FROM(SELECT sd.*,code1+code2 AS TOT_CODE FROM student sd)
    NINUS
    SELECT * FROM(SELECT sd.*,code1+code2 AS TOT_CODE FROM student sd)
    WHERE TOT_CODE !=0
    AND amount>500
    Please help me.
    Thanks on advance.

    CREATE TABLE student (code1 number, code2 number, amount number);
    INSERT INTO student VALUES(0,1,500);
    INSERT INTO student VALUES(0,0,800);
    INSERT INTO student VALUES(0,0,300);
    INSERT INTO student VALUES(0,0,400);
    INSERT INTO student VALUES(1,0,400);
    INSERT INTO student VALUES(2,0,200);
    INSERT INTO student VALUES(0,0,600);
    INSERT INTO student VALUES(1,2,700);
    The output will be
    CODE1 CODE2  TOT_CODE AMOUNT
    0     1         1     500
    0     0         0     800
    1     0         1     400
    2     0         2     200
    0     0         0     600
    1     2         3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Scrolling TBODY ability: we need it back! It's part of w3c spec. Sites with it validate correctly. FF3 supported it just fine. FF4 needs to do the same thing! Please help!

    Question says it all. I have a sample site below that works with a scrolling table with my FF3 on Windows browser, but doesn't work on FF4 on Windows. If there's another way to do scrolling tbodys with locked theads and tfoots, please help me with it. I see a lot of developers asking the question, and getting told that the functionality has been intentionally removed from FF4 with no further explanation. This doesn't compute for me. I have several sites with multiple pages that will now have to be completely redesigned if my users start upgrading to FF4. Please help me out here. The scrolling tables are a very cool component in some of my applications and it seems like a total step backwards to lose that functionality. Thank you!

    Please provide a sample link.

  • Please help me on the logic.

    Hi,
      Please help me the logic below my requirement.I found one function module to calculate the age
    HR_RU_AGE_YEARS.But iam not able to implement the logic.Please help me.
    If the value in table P0021-SUBTY = 1 send 'SP'
    If the value in table P0021-SUBTY = 2 send 'CH'
    Also use Condition Logic to check the age of Child in IT0021-FGBDT. If FGBDT =21 years or greater then Check the Student indicator on IT0021 if it is checked then set 'ST' on full file else set 'CH'.
    For Disabled Dependent check to see if the indicator in P0106-DISAB is set to X i.e. yes. If its Yes then set 'DD' on full file.
    DD takes precendence over 'CH'.  Send termination record for students on their 26th Birthday.
    Regards,
    Sujan

    Hi,
    You can use function module HR_HK_DIFF_BT_2_DATES with date1 as sy-datum and date2 as DOB from pa0002 to calculate age.
    Regards,
    Kanupriya

  • Please help me fix the bug relate to x$kzsro

    Dear everybody
    I'm new to oracle. I'm using Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 in window vista.
    recently, i try to run this code :
    select u.name, o.obj#, o.name,
    decode(o.type#, 2, 'TABLE', 4, 'VIEW')
    from sys.user$ u, sys.obj$ o
    where o.owner# = u.user#
    and o.linkname is null
    and o.type# in (2, 4)
    and (o.owner# = uid
    or
    obj# in (select obj#
    from sys.objauth$
    where grantee# in (select kzsrorol from x$kzsro)
    or grantee#=uid
    and encounter error :
    Error starting at line 1 in command:
    select u.name, o.obj#, o.name,
    decode(o.type#, 2, 'TABLE', 4, 'VIEW')
    from sys.user$ u, sys.obj$ o
    where o.owner# = u.user#
    and o.linkname is null
    and o.type# in (2, 4)
    and (o.owner# = uid
    or
    obj# in (select obj#
    from sys.objauth$
    where grantee# in (select kzsrorol from x$kzsro)
    or grantee#=uid
    Error at Command Line:11 Column:56
    Error report:
    SQL Error: ORA-00942: table or view does not exist
    00942. 00000 - "table or view does not exist"
    *Cause:
    *Action:
    this error relate to table or view x$kzsro in oracle 10.2
    i can't fix this bug.so please help me.
    thanks

    x$kzsro is a fixed table. You can select from fixed tables only if you are connected as sysdba. You can't grant select on a fixed table to a user:
    SQL> grant select on sys.x$kzsro to scott;
    grant select on sys.x$kzsro to scott
    ERROR at line 1:
    ORA-02030: can only select from fixed tables/views
    SQL> What you could do is as k your DBA to:
    SQL> create view v$kzsro as select * from x$kzsro;
    View created.
    SQL> grant select on v$kzsro to scott
      2  /
    Grant succeeded.
    SQL> connect scott
    Enter password: *****
    Connected.
    SQL> select * from sys.x$kzsro;
    select * from sys.x$kzsro
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> select * from sys.v$kzsro;
    ADDR           INDX    INST_ID   KZSROROL
    00000000          0          1          1
    00000008          1          1         54
    00000010          2          1          2
    00000018          3          1          3
    00000020          4          1          4
    00000028          5          1          6
    00000030          6          1         20
    00000038          7          1          7
    00000040          8          1          8
    00000048          9          1          9
    00000050         10          1         10
    ADDR           INDX    INST_ID   KZSROROL
    00000058         11          1         13
    00000060         12          1         18
    00000068         13          1         26
    00000070         14          1         32
    00000078         15          1         33
    00000080         16          1         40
    00000088         17          1         42
    00000090         18          1         48
    00000098         19          1         80
    000000A0         20          1         82
    21 rows selected.
    SQL> SY.
    P.S. If you are new to oracle starting with sys owned tables and fixed tables isn't the best choice.

  • Help to set selected row in adf table!

    Hello,
    I have a problem with adf table, when I select one row in table, I want to set selecte to next row or first row , or end row . . .
    How can I do that.
    If anyone know it, please help me
    Thanks in advance.

    <af:table value="#{bindings.BuddyView1.collectionModel}" var="row" partialTriggers="id"
    rows="#{bindings.BuddyView1.rangeSize}"
    emptyText="#{bindings.BuddyView1.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.BuddyView1.rangeSize}"
    rowBandingInterval="0"
    selectedRowKeys="#{bindings.BuddyView1.collectionModel.selectedRow}"
    *selectionListener="#{bindings.BuddyView1.collectionModel.makeCurrent}"*
    rowSelection="single" binding="#{backing_untitled1.t1}"
    id="t1">
    You will have to create your own selection listener method.
    Cheers
    Venkat
    Edited by: Venkat81 on Jun 10, 2010 11:12 AM

  • My internal hard drive isn't being recognized on my macbook pro but when I put the HD in my Mac Pro (desktop), the desktop computer recognizes the HD.  When I insert the installer CD on my laptop, it also doesn't recognize my hard drive. Please help!

    My internal hard drive isn't being recognized on my macbook pro but when I put the HD in my Mac Pro (desktop), the desktop computer recognizes the HD.  When I insert the installer CD on my laptop, it also doesn't recognize my hard drive. Please help! Thank you!
    I've also been getting an image with the folder and question mark. I've tried everything on the apple support page but it doesn't seem to work either.

    Well, I tried all of your suggestions and they didn't work -- no surprise because I was trying to backup to my external c.d. disk.  Duh!  The application for the home is in the mail.

Maybe you are looking for

  • Job getting cancelled for 'Chain not processed for date-2007031920070318' ?

    Hi All,   We have 2 process chains running only on weekdays - one for sales and the other for billing. A cancelled job is created for one of the process chains with the job log message as 'Chain not processed for date-2007031920070318' for the not ru

  • Query to connect Java Applet to Oracle 10g.

    I am developing an Applet in Java 1.5.0.7.My database is Oracle 10g.Now when i connect Oracle to Java I get the Error : java.lang.ExceptionInInitializerError and it does not get connected.Please help me anyone. Below is the code which i have written.

  • Can't boot into safe mode

    I am running 10.6.7 on a RAID0 internal disk set. I am booting fine into it, but when I try to hold down Shift for Safe-mode boot, I get the little gray spinning circle, and then above it appears a gray circle with a line through it (line a "do not"

  • ABAP/xi dummy projects

    Hey Guys It might not be the best place for this question but i guess i might get some help here.i am currently working in C/C++ and am now trying to move in the SAP world,i have studied  the basic concepts of ABAP and XI and this forum has helped me

  • Decrypt Errors - WLC 4404

    Hello, We recently had a few clients being locked down with countermeasures by our WLC 4404 due to TKIP-MIC errors. After doing some reading on the benefits of AES over TKIP I switched our WLAN security settings to AES, and pushed a new wireless poli