Help on fetching values form the Database Tables

Hi,
I am working on fetching the values from the Oracle base tables.
First the order will be submitted by the customer. Depending on the city name he mentioned I need to route the order details to two different queues.
For example if I(customer) insert a list of values(order details) to a table name "X" with the with city name as "San Jose" I need to fetch the values from this table "X" and route them to a Queue"A".
And again if I insert a list of values to a table name "X" with the with city name as "Milpitas" I need to fetch the values from the table "X" and route them to a Queue"B".
How do I do this in ESB. I know how to use Database adapter and MQ adapter to create connections between Table and queue.
Can any one help me on this.
Thanks
Ramana.

Hi Ramana,
Your use case may be implemented using Oracle ESB like this:
- Specify a database adapter for reading from DB, your table X. Select an appropriate polling strategy for this. When you finish the wizard, you should have a DB service and get a Routing Service (RS) "for free". The DB service should already be wired to the RS.
- Specify queuing services add appropriate routing rules with filters (that are based on the message content) and message transformations in your RS in order to route data to the queue of your choice.
Hth, Sjoerd

Similar Messages

  • Change a field value in the  database table

    Hi,
    GB01 is the database table.
    GB01-BOOLCLASS = 009
    GB01-CLASSTYPE = S
    GB01-BCLTAB = BSEG.
    GB01-BCLFIELD = GSBER.
    Upon input of above details,  will get table Record as
    BOOLCLASS    9    
    CLASSTYPE    S    
    BCLTAB       BSEG 
    BCLFIELD     GSBER
    BEXCLUDE     X   
    In the record, the field GB01-BEXCLUDE has the value “X” in it. It should be replaced by value “=.”
    Changes should be made ONLY for this record. Other Records should not be touched.
    How can we do this. Help me in doing this.
    Thanks,
    Ramya.

    Hi Ramya,
    Follow these steps :
    1. Goto the table GB01 -> Display its contents.
    2. Double click the record which you want to edit.
    3. Type /h (where you type transaction code) to go to debugging mode for that record.(Press enter twice to goto debugging mode)
    4. Click on Field CODE and give it value EDIT and then click on the PENCIL icon besides it.
    5. Now click on SAVE.
    6. Switch off the Debugging mode now.
    7. Now you can see your selected record in EDITABLE mode.
    8. Do the EDIT part and SAVE.
    Reward with points if helpful.
    Regards
    Hemant Khemani

  • Poplist and displaying corresponding values from the database table

    Hi
    I have a poplist in a control block, the values of which are populated using a procedure. This is called in when-new-form-instance.
    This part works fine and values are filled in the poplist when form is opened..
    The datablock is based on a view. 3 columns from the view are selected to be displayed.
    Also the databock is filled with all values (for selected columns)
    Now when the poplist value is changed, I need the values in the datablock to be changed as well, but this is not happening.
    In my when-list-changed trigger, I have:
    go_block('datablock');
    execute_query;Please tell , where and what should I add to display the datablock values as per the poplist value.
    i.e, something like,
    select col1,col2,col3 from <view> where col4 =:control.col4
    Note:I tried in the where clause property of the block, but then nothing is displayed in the datablock
    Thanks

    This does not work , either..
    Before, when I changed the values from the list, it was still displaying same data on datablock always(all records)
    Now when I give this code,data is displayed in datablock only once(first time when the form opens)
    I have defined the Query data source type property on data block as "Table" but infact this datablock is based on a view..is this correct?
    Anything else I could try?

  • Upgrade the database table

    hi all
    I have a sceen if i will enter the value and press the save button it will add all the value into the database table.
    I am doing this using dialog programming.
    if anybody have face this prob to upgrade the database table than it would help me a lot
    thanks a lot to all
    mrutyun

    Hey Hi
    For that first either you have to declare internal table or you can use database table work area in the abap editor
    after that you need to declare all 5 fields with same name in abap as well as screen painter.
    now in the PAI of the screen you have to handle all your 3 pushbuttons with the help of fcoded assigned to them.
    the case may be like this
    PROCESS AFTER INPUT
    CASE OK-CODE.
    WHEN 'CREATE'.
    ITABNAME-FNAME1 = SCREEN FIELD NAME1
    ITABNAME-FNAME2 = SCREEN FIELD NAME2
    ITABNAME-FNAME3 = SCREEN FIELD NAME3
    ITABNAME-FNAME4 = SCREEN FIELD NAME4
    ITABNAME-FNAME5 = SCREEN FIELD NAME5
    INSERT <DATABASE TABLE> FROM ITAB.
    WHEN 'DISPLAY'.
    SELECT SINGLE * FROM DBTAB INTO ITAB.
    SCREEN FIELD NAME1 = ITABNAME-FNAME1
    SCREEN FIELD NAME2 = ITABNAME-FNAME2 =
    SCREEN FIELD NAME3 = ITABNAME-FNAME3
    SCREEN FIELD NAME4 = ITABNAME-FNAME4
    SCREEN FIELD NAME5 = ITABNAME-FNAME5.
    WHEN 'CHANGE'.
    ITABNAME-FNAME1 = SCREEN FIELD NAME1
    ITABNAME-FNAME2 = SCREEN FIELD NAME2
    ITABNAME-FNAME3 = SCREEN FIELD NAME3
    ITABNAME-FNAME4 = SCREEN FIELD NAME4
    ITABNAME-FNAME5 = SCREEN FIELD NAME5
    MODIFY <DATABASE TABLE> FROM ITAB.
    ENDCASE.
    THANKS

  • Call the database table on commit operation and fetch the rows

    Hi
    I am new to Bpel. I have a task to call the database table on commit operation and fetch the rows and call a webservice iteratively for fetching the data into a file?
    Can anybody help me on this
    Thanks and regards
    Richa

    HI,
    update ZYBKP set MATNR = <b>zcore_2-ZDUMMY</b> where matnr = <b>zcore_2-ZDUMMY</b>.
    update ZY310 set MATNR = zcore_2-ZDUMMY where matnr = zcore_2-ZDUMMY.
    update ZYBCS_LOT set MATNR = zcore_2-ZDUMMY where matnr = zcore_2-ZDUMMY.
    <b>YOU ARE COMPARING SAME MATERIAL AND UPDATING WITH THE SAME..</b> AND ALSO ZCORE_2 IS A DATABASE TABLE AND MAY NOT CONTAIN ANY VALUE AT THAT POINT...
    in these statments you say that
    update table set matnr = 'MATNR' WHERE MATNR = 'MATNR'.
    EVEN THOUGH THIS STATMENT IS EXECUTED THERE WILL NOT BE ANY CHANGE IN THE TABLE...
    Thanks,
    Mahesh

  • To replace values of one of the field in the database table

    How to replace values of one of the field in the database table with a new values? Pls help to solve

    Hi
    You can use the UPDATE command to update one of the field value in a table
    see the UPDATE syntax and use it
    but in real time you should not do like this
    Regards
    Anji

  • Name of the database tables where the error log (SM35) values are present

    Hi,
    I want to know the database tables which contains the values of the error log present in SM35.
    Plz help me out.

    Hi,
        Check out for APQI Table with
    GROUPID
    PROGID
    QSTATE
    CREATOR
    MSGCNTE
    APQL Batch Input Log Directory
    Regards
    Bala Krishna
    Edited by: Bala Krishna on Feb 11, 2009 3:45 PM

  • Field value is getting double while updating the database table

    Hi Experts,
    A simple doubt :
    there is a standard program through which a zfunction module is getting triggered, through this zfunction module i am updating the database table.
    Now what happening is one of the field(KCQTY) value in database is getting double at a time when i am executing the Program with same variant only.
    I have also done the CLEAR & REFRESH internal tables starting of the Function module.
    Can you please help me out.
    Max points wil be awarded.
    thanks
    rico.

    Hi Nicole,
    this is the part of the coding where you can see how the field KCQTY is getting moved in the loop statement.
      DELETE IT_CE20002B_815 WHERE
          KONDA = SPACE  OR
          WERKS = SPACE  OR
          VVB01001 < 0.
        LOOP AT IT_CE20002B_815.
          INDX = SY-TABIX.
          CONCATENATE IT_CE20002B_815-PERBL0(4) IT_CE20002B_815-PERBL5(2)
                                                    INTO MONAT.
       MOVE itab_ce20001b-perbl TO monat.
          CLEAR S815.
          READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA
                                           BINARY SEARCH.
            SELECT SINGLE * FROM S815 WHERE VRSIO = '000'
                                         AND SPMON = MONAT
                                         AND KONOB = 'APO'
                                         AND MVGR2 = IT_CE20002B_815-KONDA
                                         AND PRODH = IT_CE20002B_815-PRDHA
                                         AND WERKS = IT_CE20002B_815-WERKS.
                                        AND VTWEG EQ CO_VTWEG_99.
    BREAK SAMEE.
          IF SY-SUBRC EQ 0.
    Eintrag in S810 existiert
            IF S815-AEMENGE <= IT_CE20002B_815-VVB01001.
    wenn die Auftragseingangsmenge kleiner gleich der Kontingentsmenge
    wird die Kontingentmenge in das Steploop übernommen
              MOVE IT_CE20002B_815-VVB01001 TO  W_T_DATA_815-KCQTY.
    *Liste ausgeben
             PERFORM AUSGABE4.
              PERFORM AUSGABE4_815.
            ELSE.
    Ausgabe Fehlermeldung, wenn die Auftragsmenge größer als die
                           Kontingentmenge ist.
    *Liste mit fehlermeldungen ausgeben, Kontingent trotzdem übernehmen
              MOVE IT_CE20002B_815-VVB01001 TO  W_T_DATA_815-KCQTY.
             PERFORM AUSGABE_FEHLER4.
              PERFORM AUSGABE_FEHLER4_815.
            delete it_ce20002b index indx.
            continue.
            ENDIF.
          ELSE.
    Es existiert kein Eintrag in S810, dann direkt eingeben
            MOVE IT_CE20002B_815-VVB01001 TO W_T_DATA_815-KCQTY.
            MODIFY IT_CE20002B_815 INDEX INDX.
    *Liste ausgeben (Kein Eintrag in S810)
           PERFORM EINTRAG2.
            PERFORM EINTRAG2_815.
          ENDIF.
    *Übergabestructur für die Weiterverarbeitung durch das Copymanagement
    *im Functionsbaustein wird gefüllt.
          W_T_DATA_815-SPMON = MONAT.   "itab_ce20001a-perbl.
          W_T_DATA_815-KONOB = CO_KONOB_APO.
          READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA
                                          BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_T_DATA_815-MVGR2 = CO_MVGR2_999.
          ELSE.
            W_T_DATA_815-MVGR2 = IT_CE20002B_815-KONDA.
          ENDIF.
          W_T_DATA_815-WERKS = IT_CE20002B_815-WERKS.
          W_T_DATA_815-PRODH = IT_CE20002B_815-PRDHA.
         W_T_DATA_815-VTWEG = '99'.
         W_T_DATA_815-KUNNR = '9999999999'.
          W_T_DATA_815-KCQTY = IT_CE20002B_815-VVB01001.
          W_T_DATA_815-BASME = IT_CE20002B_815-VVB01_ME.
    JR181005 - begin of ins.
         w_t_data_810-matkl = it_ce20002b-matkl.
    JR181005 - end of ins.
          APPEND W_T_DATA_815 TO TAB_DATA.
          CLEAR IT_CE20002B_815.
        ENDLOOP.
    thanks for reply
    rico

  • To fetch Data from multiple database tables!

    How to fetch Data from fields of multiple database tables!
    Give me one example!

    use <b>join....</b>
    c the SAPHELP docs...
    FROM tabref1 [INNER] JOIN tabref2 ON cond
    Effect
    The data is to be selected from transparent database tables and/or views determined by tabref1 and tabref2. tabref1 and tabref2 each have the same form as in variant 1 or are themselves Join expressions. The keyword INNER does not have to be specified. The database tables or views determined by tabref1 and tabref2 must be recognized by the ABAP Dictionary.
    In a relational data structure, it is quite normal for data that belongs together to be split up across several tables to help the process of standardization (see relational databases). To regroup this information into a database query, you can link tables using the join command. This formulates conditions for the columns in the tables involved. The inner join contains all combinations of lines from the database table determined by tabref1 with lines from the table determined by tabref2, whose values together meet the logical condition (join condition) specified using ON>cond.
    Inner join between table 1 and table 2, where column D in both tables in the join condition is set the same:
    Table 1                      Table 2
    A
    B
    C
    D
    D
    E
    F
    G
    H
    a1
    b1
    c1
    1
    1
    e1
    f1
    g1
    h1
    a2
    b2
    c2
    1
    3
    e2
    f2
    g2
    h2
    a3
    b3
    c3
    2
    4
    e3
    f3
    g3
    h3
    a4
    b4
    c4
    3
    |--|||--|
        Inner Join
        |--||||||||--|
        | A  | B  | C  | D  | D  | E  | F  | G  | H  |
        |--||||||||--|
        | a1 | b1 | c1 | 1  | 1  | e1 | f1 | g1 | h1 |
        | a2 | b2 | c2 | 1  | 1  | e1 | f1 | g1 | h1 |
        | a4 | b4 | c4 | 3  | 3  | e2 | f2 | g2 | h2 |
        |--||||||||--|
    Example
    Output a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
    DATA: DATE   LIKE SFLIGHT-FLDATE,
          CARRID LIKE SFLIGHT-CARRID,
          CONNID LIKE SFLIGHT-CONNID.
    SELECT FCARRID FCONNID F~FLDATE
        INTO (CARRID, CONNID, DATE)
        FROM SFLIGHT AS F INNER JOIN SPFLI AS P
               ON FCARRID = PCARRID AND
                  FCONNID = PCONNID
        WHERE P~CITYFROM = 'FRANKFURT'
          AND P~CITYTO   = 'NEW YORK'
          AND F~FLDATE BETWEEN '20010910' AND '20010920'
          AND FSEATSOCC < FSEATSMAX.
      WRITE: / DATE, CARRID, CONNID.
    ENDSELECT.
    If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or a table alias.

  • Initial value and value in the database

    Hello world ,
    i want to add initial value with value in the database depend on the date
    for example i have initial value for 30/09/2009
    i and to all it with value in the database in 31/12/2009
    take a look what i did
    PROCEDURE pkd_prem IS
    cursor gr_pkd_prem is select
    SUM(DECODE(mark,'01',FM_mark,TM_mark) A,
    SUM(DECODE(FMS,'01',LS,NS) b
    from fr_treaty_profile ftp, fr_monthly_summary
    where
    (ftp.tpr_cgp_id = fr_monthly_summary.fms_cgp_id )
    AND (ftp.tpr_cmp_id = fr_monthly_summary.fms_cmp_id )
    AND (ftp.tpr_treaty_origin = fr_monthly_summary.fms_treaty_origin )
    AND (ftp.tpr_uw_year = fr_monthly_summary.fms_uw_year )
    AND (ftp.tpr_class = fr_monthly_summary.fms_class )
    AND (ftp.tpr_type = fr_monthly_summary.fms_type )
    AND (ftp.tpr_serial = fr_monthly_summary.fms_serial )
    AND
    (fr_monthly_summary.fms_treaty_origin=:BLK1.EO_ORIGIN) AND
    (fr_monthly_summary.fms_uw_year=:BLK1.EO_UW_YEAR) AND
    (fr_monthly_summary.fms_class=:BLK1.EO_CLASS) AND
    (fr_monthly_summary.fms_treaty_type=:BLK1.EO_TYPE) AND
    ( fr_monthly_summary.fms_treaty_serial=:BLK1.EO_SERIAL)
    AND (FMS_TYPE ='P')
    AND FMS_SERIAL = '01'
    AND (FMS_OFC_ID !='X')
    and (FMS_YEAR =substr(to_char(:BLK1.EO_TRNX_DATE,'DD/MM/YYYY'),7,4))
    and (FMS_PERIOD between substr(to_char(:BLK1.EO_TRNX_DATE,'DD/MM/YYYY'),4,2)-2 and substr(to_char(:BLK1.EO_TRNX_DATE,'DD/MM/YYYY'),4,2)) ;
    ---Initial value
    cursor base is select EO_GR_BKD_PREM from FR_EN
    where
    EO_TREATY_ORIGIN=:BLK1.EO_ORIGIN AND
    EO_UW_YEAR=:BLK1.EO_UW_YEAR AND
    EO_CLASS=:BLK1.EO_CLASS AND
    EO_TREATY_TYPE=:BLK1.EO_TYPE AND
    EO_TREATY_SERIAL=:BLK1.EO_SERIAL AND
    EO_YEAR=:BLK1.EO_YEAR;
    A number(18,3);
    B number(18,3);
    v_base number(18,3);
    BEGIN
    open base;
    open gr_pkd_prem;
    fetch gr_pkd_prem into a,b;
    fetch base into v_base;
    :BLK1.EO_GR_BKD_PREM :=nvl(a,0)+ nvl(b,0)+ nvl(v_base,0);
    close gr_pkd_prem;
    close base;
    END;
    the proceudre is correct and the values come as i want
    but here
    FMS_PERIOD between substr(to_char(:BLK1.EO_TRNX_DATE,'DD/MM/YYYY'),4,2)-2 and substr(to_char(:BLK1.EO_TRNX_DATE,'DD/MM/YYYY'),4,2))
    suppose i will add from 6 to 9
    the value will come down to add with base value
    but next time i want from 10 to 12
    it will add value 10 to 12 with the base for just period 10 to 12
    i want to keep adding
    if i start from 6 to 9
    then shoud be
    add the value of 6 to 9 to 10 to 12
    but

    look ..
    i created a form and let's say there is one field called Base ..
    and i inert value on that field and saved .
    then
    i created cursor to fetch value from another table
    that value which i fetched from another table must add to past value
    take this scenario
    i started with value 6
    then i fetch by cursor value from 1/1/2010 to 31/3/2010 and that value = 33
    first action
    6+33
    then
    i fecth by using cursor from 1/6/2010 to 30/9/2010 and that value = 2
    the result of first action must add with the last value which is 2
    (6+33) from first action plus(+) 2 and display the result on the secreen

  • Unable to save values to the Database

    Hi,
    I have created a table in the database and a form with submit and the cancel button.
    When the values are entered in the form and the submit button is clicked, the values are not getting stored.
    When I was analyzing this, I changed the "Page in this application" to "No Target" in the "URL Redirect" tab from the submit button.
    Now, after the values are entered, and the submit button is clicked, I get an error message, stating "ERR-1777: Page 3 provided no page to branch to. Please report this error to your application administrator.
    When I checked the database tables, the values have been stored.
    My doubt is how can I store the values, without getting the error message?
    Please help!

    When the values are entered in the form and the submit button is clicked, the values are not getting stored.That suggests that your button did not submit the page but used a URL Redirect attribute instead.
    When I was analyzing this, I changed the "Page in this application" to "No Target" in the "URL Redirect" tab from the submit button.The URL Redirect attribute of the button should be set to "No Target" but you now need to create a branch on the page to go to whatever page you want the user to see next.
    Scott

  • Placing null values in the database

    Hi
    I'm using a PreparedStatement object to try to input a null value in the database. I'm using the following code :
    pstmt = connection.prepareStatement("INSERT INTO Conditions (Deal,ConditionDate,Condition ) VALUES (?,?,?)");
    pstmt.setString(1,"aDealName");
    pstmt.setNull(2,Types.TIMESTAMP);
    pstmt.setString(3,"aCondition");
    pstmt.executeUpdate();
    and I get the "SQL Data type out of range" error message.
    Does anyone know what might be the problem?
    Thanks for any help
    LGS

    Hi
    Sorry for the lack of info.
    I am using Microsoft Access 2000, the JDBC-ODBC driver v.4.00.6019
    and my TableModel class is as follows:
    public class MyTableModel2 extends AbstractTableModel
    private Connection conn;
    private Vector rows,columnHeads,firstColumn,columnTypes,columnWidths;
    private Validation validate;
    private String query;
    private int numColumns;
    String tableType;
    String [] columnNamesFrontPage = {"Deal","Spread","Next Event Date","Closing Date"};
    String [] columnNamesCommentsPage  = {"Date","Input By","Spread","Comment"};
    String [] columnNamesTimetable = {"Date","Event"};
    String [] columnNamesConditionsTable = {"Date","Condition"};
    private DBase2 db2;
    private String tableName,primKeyColName;
    public MyTableModel2 ()
    {} //Empty Constructor
    public MyTableModel2 ( Connection dbConn,String aQuery,String table)
      conn = dbConn;
      rows = new Vector();
      columnHeads = new Vector();
      query = aQuery;
      tableType = table;
      firstColumn = new Vector();
      db2 = new DBase2 (dbConn);
      columnTypes = new Vector();
      columnWidths = new Vector();
      validate = new Validation();
    }//End of Constructor
    public int getColumnCount ()
      return columnHeads.size();
    }//End of Method
    public int getRowCount ()
      return rows.size();
    }//End of Method
    public Object getValueAt(int aRow, int aColumn)
      Vector row = (Vector)rows.elementAt(aRow);
      return row.elementAt(aColumn);
    }//End of Method
    public String getColumnName (int column)
      String columnName = "";
      if(tableType == null)
       columnName = columnHeads.get(column).toString();
      else if (tableType == "FrontPage")
       columnName = columnNamesFrontPage [column];
      else if (tableType == "CommentsPage")
       columnName = columnNamesCommentsPage [column];
      else if (tableType == "Timetable")
       columnName = columnNamesTimetable [column];
      else if (tableType == "ConditionsTable")
       columnName = columnNamesConditionsTable [column];
      return columnName;
    }//End of Method
    public void query() 
      try {
       Statement statement = conn.createStatement();
       ResultSet rs = statement.executeQuery(query);
       ResultSetMetaData rsmd = rs.getMetaData();
       tableName = rsmd.getTableName(1);
       Integer i2;
       boolean moreRecords = rs.next();
       for (int i = 1; i <= rsmd.getColumnCount(); ++i)
         if (i == 1)
          primKeyColName = rsmd.getColumnName(i);
         else
          columnHeads.addElement(rsmd.getColumnName(i));
          if (rsmd.getColumnTypeName(i).equals("DATETIME"))
           i2 = new Integer (8);
          else
           int i1 = rsmd.getColumnDisplaySize(i);
           i2 = new Integer (i1);
          columnWidths.add(i2);
          String colTypeName = rsmd.getColumnTypeName(i);
          columnTypes.addElement(colTypeName);
          //JOptionPane.showMessageDialog(null,"Column Width="+i2,"Column Types  ",JOptionPane.INFORMATION_MESSAGE);
       do {
          rows.addElement( getNextRow (rs,rsmd));
       while (rs.next() );
      catch ( SQLException sqlex )
        sqlex.printStackTrace();
      }//End of Method
    private Vector getNextRow( ResultSet rs, ResultSetMetaData rsmd )
           throws SQLException
        Vector currentRow = new Vector();
         for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
           Object o = rs.getObject(i);
           if (o == null)
             String emptyCell = "";
             currentRow.addElement(emptyCell);
           else if(o.getClass().toString().equalsIgnoreCase("class java.sql.Timestamp") )
             SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
             String formatted = sdf.format(o);
             currentRow.addElement(formatted);
           else
             if (i == 1)
              firstColumn.addElement(o);
             else
             currentRow.addElement(o);
          return currentRow;
        }//End of Method
    public void refresh ()
      rows.clear();
      firstColumn.clear();
      try {
       Statement statement = conn.createStatement();
       ResultSet rs = statement.executeQuery(query);
       ResultSetMetaData rsmd = rs.getMetaData();
       boolean moreRecords = rs.next();
       do {
          rows.addElement( getNextRow (rs,rsmd));
       while (rs.next() );
      catch ( SQLException sqlex )
        sqlex.printStackTrace();
      this.fireTableDataChanged();
    }//End of Method
    public boolean isCellEditable (int row, int col)
      return true;
    }//End of Class
    public void setValueAt(Object value, int row, int col)
       String objToString = value.toString();
       int columnWidth = Integer.parseInt(columnWidths.elementAt(col).toString());
       if(objToString.length() > columnWidth)
        validate.errorMessageDisplay("Maximum column width is "+columnWidth+" characters - Please retype","INPUT ERROR");
       else if (columnTypes.elementAt(col).toString().equals("DATETIME") && validate.validDateInput(objToString) == false)
        validate.errorMessageDisplay("Date is required in form dd/mm/yy - Please retype","INPUT ERROR");
       else if (columnTypes.elementAt(col).toString().equals("DOUBLE") && validate.validNumberInput(objToString) == false)
        validate.errorMessageDisplay("This column will accept numbers only - Please retype","INPUT ERROR");
       else
       //JOptionPane.showMessageDialog(null,columnTypes.elementAt(col).toString(),"Column Name  ",JOptionPane.INFORMATION_MESSAGE);
       Vector rowA = (Vector)rows.elementAt(row);
       rowA.setElementAt(value,col);
       fireTableCellUpdated(row, col);
       String newInput = value.toString();
       int id = Integer.parseInt(firstColumn.elementAt(row).toString());
       String colName = columnHeads.elementAt(col).toString();
       String query = "UPDATE "+tableName+" SET "+colName+" = '"+newInput+"' WHERE "+primKeyColName+" = "+id+"";
       db2.modifyDatabase(query);
       refresh();
      }//End of Method The method in which I am using PreparedStatement is:
    public void updateConditionsTable (String aDealName, String aCondition) 
       int result = 0;
       try
        pstmt = connection.prepareStatement("INSERT INTO Conditions (Deal,ConditionDate,Condition )"+
        " VALUES (?,?,?)");
       // pstmt = connection.prepareStatement("INSERT INTO Conditions (Deal,ConditionDate,Condition )"+
       // " VALUES (?,?,?)");
        pstmt.setString(1,aDealName);
        pstmt.setNull(2,Types.INTEGER);
        pstmt.setString(3,aCondition);
        pstmt.executeUpdate();
       catch (SQLException sqlex ) {
         //sqlex.printStackTrace();
         String output = "YOUR INPUT IS NOT VALID - PLEASE TRY AGAIN\n";
         output = output + sqlex.toString();
         JOptionPane.showMessageDialog(null,output,"SQL Error",JOptionPane.INFORMATION_MESSAGE);
        //return result;
       }//Closes Method Once again, thanks for any help

  • Using two cursors, one for updating salary values in the emp table

    Using COPIES of the employee and department tables provided by Oracle or using similar taples that provide employee, salary, job and dept in one table and dept number and department name in another table, write the following program. Use the dept table to step through sequentially and bring up the records with the same department from the employee table. Using an IF statement calcuate a new salary based on the job (you decide on the criteria). Update each record on the employee file (this is why you should use copies) with the new salary. In addition, calculate the total salary for each department and create a new table with the department number, the department name and the salary.
    I'm able to update the salary values, but I'm not sure how to insert those updated values into an empty table the way this problem is asking me to.
    Here's my script so far: any help would be greatly appreciated: )
    declare
    v_deptno emp.deptno%type;
    v_job emp.job%type;
    v_sal emp.sal%type;
    v_dname dept.dname%type;
    v_deptsal totalsal.deptsal%type;
    cursor salup_c is
    select job,sal
    from emp,dept
    where emp.deptno = dept.deptno
    for update of sal;
    cursor totdeptsal_c is
    select dname,sal
    from emp,dept
    where emp.deptno = dept.deptno;
    Begin
    open salup_c;
    loop
    fetch salup_c into v_job,v_sal;
    exit when salup_c%notfound;
    if v_job = 'CLERK' then
    v_sal := v_sal + 10;
    else
    if v_job = 'ANALYST' then
    v_sal := v_sal + 20;
    else
    if v_job = 'MANAGER' then
    v_sal := v_sal + 30;
    else
    if v_job = 'PRESIDENT' then
    v_sal := v_sal + 40;
    else v_sal := v_sal + 50;
    end if;
    end if;
    end if;
    end if;
    update emp
    set sal = v_sal
    where current of salup_c;
    open totdeptsal_c;
    v_deptsal := 0;
    loop
    fetch totdeptsal_c into v_dname, v_deptsal;
    exit when totdeptsal_c%notfound;
    v_deptsal := v_deptsal + v_sal;
    insert into totalsal
    values(v_deptno,v_dname,v_deptsal);
    end loop;
    close totdeptsal_c;
    end loop;
    close salup_c;
    end;
    /

    The script is actually inserting some values into the new table but look at what I'm getting
    Here it is: i only want the dept number ,the dept name, and total salary for each department.
    SQL> @ sndprob;
    PL/SQL procedure successfully completed.
    SQL> select * from totalsal;
    DEPTNO DNAME DEPTSAL
    RESEARCH 1620
    SALES 2410
    SALES 2060
    RESEARCH 3785
    SALES 2060
    SALES 3660
    ACCOUNTING 3260
    RESEARCH 3810
    ACCOUNTING 5810
    SALES 2310
    RESEARCH 1910
    DEPTNO DNAME DEPTSAL
    SALES 1760
    RESEARCH 3810
    ACCOUNTING 2110
    RESEARCH 2460
    SALES 3300
    SALES 2900
    RESEARCH 4625
    SALES 2900
    SALES 4500
    ACCOUNTING 4100
    RESEARCH 4650
    DEPTNO DNAME DEPTSAL
    ACCOUNTING 6650
    SALES 3150
    RESEARCH 2750
    SALES 2600
    RESEARCH 4650
    ACCOUNTING 2950
    RESEARCH 2110
    SALES 2950
    SALES 2600
    RESEARCH 4275
    SALES 2550
    DEPTNO DNAME DEPTSAL
    SALES 4150
    ACCOUNTING 3750
    RESEARCH 4300
    ACCOUNTING 6300
    SALES 2800
    RESEARCH 2400
    SALES 2250
    RESEARCH 4300
    ACCOUNTING 2600
    RESEARCH 3815
    SALES 4655
    DEPTNO DNAME DEPTSAL
    SALES 4305
    RESEARCH 6010
    SALES 4255
    SALES 5855
    ACCOUNTING 5455
    RESEARCH 6005
    ACCOUNTING 8005
    SALES 4505
    RESEARCH 4105
    SALES 3955
    RESEARCH 6005
    DEPTNO DNAME DEPTSAL
    ACCOUNTING 4305
    RESEARCH 2110
    SALES 2950
    SALES 2600
    RESEARCH 4305
    SALES 2600
    SALES 4150
    ACCOUNTING 3750
    RESEARCH 4300
    ACCOUNTING 6300
    SALES 2800
    DEPTNO DNAME DEPTSAL
    RESEARCH 2400
    SALES 2250
    RESEARCH 4300
    ACCOUNTING 2600
    RESEARCH 3690
    SALES 4530
    SALES 4180
    RESEARCH 5885
    SALES 4180
    SALES 5760
    ACCOUNTING 5330
    DEPTNO DNAME DEPTSAL
    RESEARCH 5880
    ACCOUNTING 7880
    SALES 4380
    RESEARCH 3980
    SALES 3830
    RESEARCH 5880
    ACCOUNTING 4180
    RESEARCH 3290
    SALES 4130
    SALES 3780
    RESEARCH 5485
    DEPTNO DNAME DEPTSAL
    SALES 3780
    SALES 5360
    ACCOUNTING 4960
    RESEARCH 5480
    ACCOUNTING 7480
    SALES 3980
    RESEARCH 3580
    SALES 3430
    RESEARCH 5480
    ACCOUNTING 3780
    RESEARCH 3830
    DEPTNO DNAME DEPTSAL
    SALES 4670
    SALES 4320
    RESEARCH 6025
    SALES 4320
    SALES 5900
    ACCOUNTING 5500
    RESEARCH 6040
    ACCOUNTING 8020
    SALES 4520
    RESEARCH 4120
    SALES 3970
    DEPTNO DNAME DEPTSAL
    RESEARCH 6020
    ACCOUNTING 4320
    RESEARCH 5850
    SALES 6690
    SALES 6340
    RESEARCH 8045
    SALES 6340
    SALES 7920
    ACCOUNTING 7520
    RESEARCH 8060
    ACCOUNTING 10080
    DEPTNO DNAME DEPTSAL
    SALES 6540
    RESEARCH 6140
    SALES 5990
    RESEARCH 8040
    ACCOUNTING 6340
    RESEARCH 2360
    SALES 3200
    SALES 2850
    RESEARCH 4555
    SALES 2850
    SALES 4430
    DEPTNO DNAME DEPTSAL
    ACCOUNTING 4030
    RESEARCH 4570
    ACCOUNTING 6590
    SALES 3100
    RESEARCH 2650
    SALES 2500
    RESEARCH 4550
    ACCOUNTING 2850
    RESEARCH 1920
    SALES 2760
    SALES 2410
    DEPTNO DNAME DEPTSAL
    RESEARCH 4115
    SALES 2410
    SALES 3990
    ACCOUNTING 3590
    RESEARCH 4130
    ACCOUNTING 6150
    SALES 2660
    RESEARCH 2220
    SALES 2060
    RESEARCH 4110
    ACCOUNTING 2410
    DEPTNO DNAME DEPTSAL
    RESEARCH 1770
    SALES 2610
    SALES 2260
    RESEARCH 3965
    SALES 2260
    SALES 3840
    ACCOUNTING 3440
    RESEARCH 3980
    ACCOUNTING 6000
    SALES 2510
    RESEARCH 2070
    DEPTNO DNAME DEPTSAL
    SALES 1920
    RESEARCH 3960
    ACCOUNTING 2260
    RESEARCH 3830
    SALES 4670
    SALES 4320
    RESEARCH 6025
    SALES 4320
    SALES 5900
    ACCOUNTING 5500
    RESEARCH 6040
    DEPTNO DNAME DEPTSAL
    ACCOUNTING 8060
    SALES 4570
    RESEARCH 4130
    SALES 3980
    RESEARCH 6040
    ACCOUNTING 4320
    RESEARCH 2120
    SALES 2960
    SALES 2610
    RESEARCH 4315
    SALES 2610
    DEPTNO DNAME DEPTSAL
    SALES 4190
    ACCOUNTING 3790
    RESEARCH 4330
    ACCOUNTING 6350
    SALES 2860
    RESEARCH 2420
    SALES 2270
    RESEARCH 4330
    ACCOUNTING 2620
    196 rows selected.

  • Regardig error while updating the database table

    hi experts,
       i m trying to update the database table from the values containig in my internal table  ,,,but the system is giving this error plz help me::::
    The type of the database table and work area (or internal table)
    "ITAB_UPDATE" are not Unicode convertible. Unicode convertible.          
    my internal table name itab_update and the database table name yitab.i m using this statement::
        modify yitab from itab_update.

    Hi
    1. You  have to Declare the Itab with the same structure as DB table.
    2. Use the statement
        Modify <DBtable> from TABLE <itab>.
    or
       Update <DBtable> from TABLE <itab>.
    Hope this will solve.
    Reward .....if so.
    Regards.

  • How to update field values in a database table using module pool prg?

    hi
    how to update field values in a database table using module pool prg?
    we created a customized table, and we put 2 push buttons in screen painter update and display.
    but update is not working?
    data is enter into screen fields and to internal table, but it is not updated in database table.
    thanks in adv
    vidya

    HI,
    we already used the update statement. but its not working.
    plz check this.
    *& Module Pool       ZCUST_CALL_REC
    PROGRAM  ZCUST_CALL_REC.
    TABLES: ZCUST_CALL_REC,ZREMARKS.
    data:  v_kun_low like ZCUST_CALL_REC-kunnr ,
           v_kun_high like ZCUST_CALL_REC-kunnr,
           v_bud_low like ZCUST_CALL_REC-budat,
           v_bud_high like ZCUST_CALL_REC-budat.
    ranges r_kunnr for ZCUST_CALL_REC-kunnr  .
    ranges r_budat for zcust_call_rec-budat.
    DATA: ITAB TYPE STANDARD TABLE OF ZCUST_CALL_REC WITH HEADER LINE,
          JTAB TYPE STANDARD TABLE OF ZREMARKS WITH HEADER LINE.
    *data:begin of itab occurs 0,
        MANDT LIKE ZCUST_CALL_REC-MANDT,
        kunnr like ZCUST_CALL_REC-kunnr,
        budat like ZCUST_CALL_REC-budat,
        code like ZCUST_CALL_REC-code,
        remarks like ZCUST_CALL_REC-remarks,
        end of itab.
    *data:begin of Jtab occurs 0,
        MANDT LIKE ZCUST_CALL_REC-MANDT,
        kunnr like ZCUST_CALL_REC-kunnr,
        budat like ZCUST_CALL_REC-budat,
        code like ZCUST_CALL_REC-code,
        remarks like ZCUST_CALL_REC-remarks,
        end of Jtab.
    CONTROLS:vcontrol TYPE TABLEVIEW USING SCREEN '9001'.
    CONTROLS:vcontrol1 TYPE TABLEVIEW USING SCREEN '9002'.
    *start-of-selection.
    *&      Module  USER_COMMAND_9000  INPUT
          text
    MODULE USER_COMMAND_9000 INPUT.
    CASE sy-ucomm.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
    SET SCREEN 0.
    LEAVE SCREEN.
    CLEAR sy-ucomm.
    WHEN 'ENQUIRY'.
    perform multiple_selection.
    perform append_CUSTOMER_code.
    PERFORM SELECT_DATA.
    call screen '9001'.
    WHEN 'UPDATE'.
          perform append_CUSTOMER_code.
          PERFORM SELECT_DATA.
          call screen '9002'.
          perform update on commit.
    WHEN 'DELETE'.
          perform append_CUSTOMER_code.
          PERFORM SELECT_DATA.
          call screen '9002'.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPUT
    *&      Module  STATUS_9000  OUTPUT
          text
    MODULE STATUS_9000 OUTPUT.
      SET PF-STATUS 'ZCUSTOMER'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_9000  OUTPUT
    *&      Module  USER_COMMAND_9001  INPUT
          text
    MODULE USER_COMMAND_9001 INPUT.
    CASE sy-ucomm.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
    SET SCREEN 0.
    LEAVE SCREEN.
    CLEAR sy-ucomm.
    endcase.
    ENDMODULE.                 " USER_COMMAND_9001  INPUT
    *&      Module  STATUS_9001  OUTPUT
          text
    MODULE STATUS_9001 OUTPUT.
      SET PF-STATUS 'ZCUSTOMER'.
    SET TITLEBAR 'xxx'.
    move itab-MANDT   to zcust_call_rec-MANDT.
    move itab-kunnr   to zcust_call_rec-kunnr.
    move itab-budat   to zcust_call_rec-budat.
    move itab-code    to zcust_call_rec-code.
    move itab-remarks to zcust_call_rec-remarks.
    vcontrol-lines = sy-dbcnt.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    *&      Module  USER_COMMAND_9002  INPUT
          text
    module  USER_COMMAND_9002 input.
    CASE sy-ucomm.
       WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          SET SCREEN 0.
          LEAVE SCREEN.
          CLEAR sy-ucomm.
       WHEN 'UPDATE'.
             perform move_data.
         UPDATE ZCUST_CALL_REC FROM TABLE ITAB.
            IF SY-SUBRC = 0.
               MESSAGE I000(0) WITH 'RECORDS ARE UPDATED'.
             ELSE.
               MESSAGE E001(0) WITH 'RECORDS ARE NOT UPDATED'.
            ENDIF.
      WHEN 'DELETE'.
             perform move_data.
             DELETE ZCUST_CALL_REC FROM TABLE ITAB.
              IF SY-SUBRC = 0.
               MESSAGE I000(0) WITH 'RECORDS ARE DELETED'.
             ELSE.
               MESSAGE E001(0) WITH 'RECORDS ARE NOT DELETED'.
            ENDIF.
    endcase.
    endmodule.                 " USER_COMMAND_9002  INPUT
    *&      Module  STATUS_9002  OUTPUT
          text
    module STATUS_9002 output.
      SET PF-STATUS 'ZCUSTOMER1'.
    SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_9002  OUTPUT
    *&      Module  update_table  OUTPUT
          text
    module update_table output.
         move itab-MANDT   to zcust_call_rec-MANDT.
         move itab-kunnr   to zcust_call_rec-kunnr.
         move itab-budat   to zcust_call_rec-budat.
         move itab-code    to zcust_call_rec-code.
         move itab-remarks to zcust_call_rec-remarks.
    vcontrol-lines = sy-dbcnt.
    endmodule.                 " update_table  OUTPUT
    ***Selection Data
    FORM SELECT_DATA.
    SELECT  mandt kunnr budat code remarks  FROM zcust_call_rec INTO
                            table itab
                             WHERE kunnr IN r_kunnr AND BUDAT IN R_BUDAT.
    ENDFORM.
    ****append vendor code
    FORM APPEND_CUSTOMER_CODE.
    clear r_kunnr.
    clear itab.
    clear r_budat.
    refresh r_kunnr.
    refresh itab.
    refresh r_kunnr.
    IF r_kunnr  IS INITIAL
                  AND NOT v_kun_low IS INITIAL
                   AND NOT v_kun_high IS INITIAL.
                        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                    EXPORTING
                                       input         = v_kun_low
                                    IMPORTING
                                       OUTPUT        = r_kunnr-low.
                       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                  EXPORTING
                                      input         = v_kun_high
                                  IMPORTING
                                      OUTPUT        = r_kunnr-high.
                     r_kunnr-option = 'BT'.
                     r_kunnr-sign = 'I'.
                     append r_kunnr.
       PERFORM V_BUDAT.
    ELSEIF r_kunnr  IS INITIAL
                  AND NOT v_kun_low IS INITIAL
                   AND  v_kun_high IS INITIAL.
                        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                    EXPORTING
                                       input         = v_kun_low
                                    IMPORTING
                                       OUTPUT        = r_kunnr-low.
                    r_kunnr-SIGN = 'I'.
                    r_kunnr-OPTION = 'EQ'.
                    APPEND r_kunnr.
       PERFORM V_BUDAT.
    ELSEIF r_kunnr IS INITIAL
                  AND  v_kun_low IS INITIAL
                   AND NOT v_kun_high IS INITIAL.
                        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                    EXPORTING
                                       input         = v_kun_low
                                    IMPORTING
                                       OUTPUT        = r_kunnr-low.
                    r_kunnr-SIGN = 'I'.
                    r_kunnr-OPTION = 'EQ'.
                    APPEND r_kunnr.
          PERFORM V_BUDAT.
    ELSEIF r_kunnr IS INITIAL
                  AND  v_kun_low IS INITIAL
                   AND  v_kun_high IS INITIAL.
                        IF SY-SUBRC = 0.
                             MESSAGE I003(0) WITH 'ENTER CUSTOMER NUMBER'.
                              CALL SCREEN '9000'.
                        ENDIF.
    PERFORM V_BUDAT.
    ENDIF.
    ENDFORM.
    FORM V_BUDAT.
    IF  R_BUDAT IS INITIAL
                   AND NOT v_BUD_low IS INITIAL
                   AND NOT v_BUD_high IS INITIAL.
                     r_budat-low = v_bud_low.
                     r_budat-high = v_bud_high.
                     r_budat-option = 'BT'.
                     r_budat-sign = 'I'.
                     append r_budat.
             ELSEIF  R_BUDAT IS INITIAL
                   AND NOT v_BUD_low IS INITIAL
                   AND  v_BUD_high IS INITIAL.
                     r_budat-low = v_bud_low.
                     r_budat-high = v_bud_high.
                     r_budat-option = 'EQ'.
                     r_budat-sign = 'I'.
                     append r_budat.
             ELSEIF  R_BUDAT IS INITIAL
                   AND  v_BUD_low IS INITIAL
                   AND NOT v_BUD_high IS INITIAL.
                     r_budat-HIGH = v_bud_HIGH.
                     r_budat-option = 'EQ'.
                     r_budat-sign = 'I'.
                     append r_budat.
              ELSEIF  R_BUDAT IS INITIAL
                   AND  v_BUD_low IS INITIAL
                   AND  v_BUD_high IS INITIAL.
                   IF SY-SUBRC = 0.
                       MESSAGE I002(0) WITH 'ENTER POSTING DATE'.
                      CALL SCREEN '9000'.
                    r_budat-low = ''.
                    r_budat-option = ''.
                    r_budat-sign = ''.
                    ENDIF.
            ENDIF.
    ENDFORM.
    *&      Form  update
          text
    -->  p1        text
    <--  p2        text
    form update .
    commit work.
    endform.                    " update
    *&      Form  move_data
          text
    -->  p1        text
    <--  p2        text
    form move_data .
       clear itab.
      refresh itab.
           move-corresponding  zcust_call_rec to itab.
           MOVE ZCUST_CALL_REC-MANDT   TO ITAB-MANDT.
           MOVE ZCUST_CALL_REC-KUNNR   TO ITAB-KUNNR.
           MOVE ZCUST_CALL_REC-BUDAT   TO ITAB-BUDAT.
           MOVE ZCUST_CALL_REC-CODE    TO ITAB-CODE.
           MOVE ZCUST_CALL_REC-REMARKS TO ITAB-REMARKS.
         APPEND ITAB.
         delete itab where kunnr is initial.
    endform.                    " move_data
    thanks in adv
    vidya

Maybe you are looking for