Truncate 00 in front of the value

How can we truncate the value in a select statement
select id from table
if id = 100 then dbms_out_________________
my problem is sometimes the output may be 100 or 00100 .If it's 00100 it fails
We should truncate only if the value contains 00 in front of the number .

  SQL> with t as
    2   (select '001' no, 'ram'   name from dual union all
    3    select '002' no, 'raj'   name from dual union all
    4    select '003' no, 'rao'   name from dual union all
    5    select '004' no, 'rahul' name from dual union all
    6    select '005' no, 'rahim' name from dual)
    7  select * from t;
  NO  NAME
  001 ram
  002 raj
  003 rao
  004 rahul
  005 rahim
when the condition is applied as character
  SQL> with t as
    2   (select '001' no, 'ram'   name from dual union all
    3    select '002' no, 'raj'   name from dual union all
    4    select '003' no, 'rao'   name from dual union all
    5    select '004' no, 'rahul' name from dual union all
    6    select '005' no, 'rahim' name from dual)
    7  select ltrim(no,'0') no, name
    8    from t;
  NO  NAME
  1   ram
  2   raj
  3   rao
  4   rahul
  5   rahim
  SQL> with t as
    2   (select '001' no, 'ram'   name from dual union all
    3    select '002' no, 'raj'   name from dual union all
    4    select '003' no, 'rao'   name from dual union all
    5    select '004' no, 'rahul' name from dual union all
    6    select '005' no, 'rahim' name from dual)
    7  select no, name
    8    from t
    9   where ltrim(no,'0') = '2';
  NO  NAME
  002 raj
  SQL>
when condition is applied as numeric
  SQL> with t as
    2   (select '001' no, 'ram'   name from dual union all
    3    select '002' no, 'raj'   name from dual union all
    4    select '003' no, 'rao'   name from dual union all
    5    select '004' no, 'rahul' name from dual union all
    6    select '005' no, 'rahim' name from dual)
    7  select trunc(no) no, name
    8    from t;
        NO NAME
           1 ram
           2 raj
           3 rao
           4 rahul
           5 rahim
  SQL> with t as
    2   (select '001' no, 'ram'   name from dual union all
    3    select '002' no, 'raj'   name from dual union all
    4    select '003' no, 'rao'   name from dual union all
    5    select '004' no, 'rahul' name from dual union all
    6    select '005' no, 'rahim' name from dual)
    7  select trunc(no) no, name
    8    from t
    9   where trunc(no) = 2;
          NO NAME
           2 raj
  SQL>

Similar Messages

  • Truncate / Trim and Convert the values while importing in Import Manager

    Hi,
    I am facing the following issues while importing the values in Import Manager.
    1) The incoming value is a 4 character text value (e.g. D004) and i need to truncate the 1st two characters so that i get the output as "04"  and map it to the destination numeric 2 character field.
    Can any1 help me on this as to how can i truncate the 1st two characters?
    2) My incoming value is a numeric field which is coming from ECC. this value can be negative as well. the ECC sends this value as (78.00-) ie the minus sign is suffixed to the value but in MDM i need it as (-78.00) ie minus sign prefixed to the value.
    Is there any setting in Import manager where i can set the minus sign as a prefix?
    Useful answers will be rewarded with points.
    Regards,
    Roshani

    Hi Roshani,
    Can any1 help me on this as to how can i truncate the 1st two characters?
    As suggested by everyone, none of these options will work. Since your field has alphanumeric Value i.e. D004. Use Option Replace.
    After mapping your source field with target field which must be of Type TEXT, Right click on your source field>Set Value Conversion filter>Replace..-->a pop up window will come Replace write Find What: D0 and Replace with: keep it blank(dont write anything) and then Press Ok, you will see all your Source values D0XX converted to XX and then can save in Import Map which will give you the desired result.
    If you set your target field of type INTEGER, you cant have option Replace. And the TRUNCATE option as suggested by everyone will not work as Operand 2: you can set as Numeric values only, you would not able to write D.
    Is there any setting in Import manager where i can set the minus sign as a prefix?
    I dont think this is possible alone with Import Manager, you need MDM workflow for this where your workflow trigger action = Record Import in Data Manager, and need to select the same workflow in configuration options of Import Manager>Import>checkout/workflow = select the workflow name from drop-down which you set in Data Manager and then need to save this in your Import Map. So in this manner whenever record comes through import Manager, these records automatically will go through this Workflow and will give you the desired result.
    START(CHECKOUT)>Assign>STOP(CHECKIN)
    Assign step where you give assignment on this field and write assignment expression as:
    IF(FIND(XXX, "-"), "-"&LEFT(XXX, (LEN(XXX)-1)), XXX)
    where XXX = Field name which you defined in MDM repository.
    Regards,
    Mandeep Saini

  • Minus sign at the end of the value, Need to get Preceeding minus sign.

    Hello gurus,
    I am using following code in web dynpro to get data from a FM and downloading it to excel.
    for the numeric values I am getting minus sign at the end of the value in excel. but If I display the value in alv, it is coming fine. Please let me know where I am going wrong.
    ex: 4568-
          CALL FUNCTION 'Z_EXTRACT'
            EXPORTING
              extract   = z_extract
            TABLES
              it_data       = tab_et.
          DESCRIBE TABLE tab_et.
          IF sy-tfill GT 0.
            CLEAR: text, xtext.
            DATA :    v_fore9ldepl(17)      TYPE n.
            LOOP AT tab_et INTO rec_et.
             MOVE:
              WRITE:  rec_et-fore9ldepl TO v_fore9ldepl DECIMALS 3.
              CONCATENATE  text '1'
                                rec_et-z0g_cwwter                          
                                v_fore9ldepl
                     cl_abap_char_utilities=>newline INTO text SEPARATED BY ','.
                      cl_abap_char_utilities=>newline INTO text SEPARATED BY
                      cl_abap_char_utilities=>horizontal_tab.
            ENDLOOP.
            CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
              EXPORTING
                text   = text
              IMPORTING
                buffer = xtext.
            CLEAR:  filename, wa_files.
            CONCATENATE 'EXTRACT'   '.XLS' INTO filename.
            wa_files-content = xtext.
            wa_files-filename = filename.
            APPEND wa_files TO files.
      DATA izip TYPE REF TO cl_abap_zip.
      DATA output_file TYPE xstring.
      CREATE OBJECT izip.
      LOOP AT files INTO wa_files.
        izip->add( name = wa_files-filename
                    content = wa_files-content ).
      ENDLOOP.
      output_file = izip->save( ).
      CALL METHOD cl_wd_runtime_services=>attach_file_to_response(
      EXPORTING
      i_filename = 'TEST.ZIP'
      i_content = output_file
      i_mime_type = 'ZIP/APPLICATION'
           i_in_new_window = abap_false
      i_in_new_window = abap_true
      i_inplace = abap_false ).

    Hi,
    In the Context attribute tyr to use the properties of formatting where you can have the MINUS sign in the front of the value..
    If this is working fine then when you use any standard export of ALV the same (AS iS) is shown in Excel right...
    Regards,
    Lekha.

  • How to truncate the values from the table

    Hi All,
    I am working on an issue..where we are first deleting all the records from the table and then based on few conditions we are putting the records back in that table...when we tried to run this program along with few others those who are doing almost the same stuff we are having issues...we tried to schedule few jobs related to these programs only...but after a ceratin amount of time couple of jobs got canceled...I was talking to my basis guy and he said the problem is ratehr then truncating the records from the table we are deleting the records and it's taking lots and lots of space to execute...so we need to truncate the records from the table insted of deleting it...we are using the following the statement right now:
        DELETE FROM ZTUS_PG.
        COMMIT WORK.
    So can you please tell me how can we truncate the values from this table instead of just deleting them and what would be effect of this.
    Thanks,
    Rajeev Gupta

    I don't think basis is saying you should delete all the records from the table. They are saying remove the table and it's contents (a much faster thing to do). I'm not sure this the right thing to do, but you can have a look at:
    http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.sample.doc/doc/admin_scripts/s-truncate-db2.htm
    Something like:
    EXEC SQL.
      TRUNCATE TABLE ZTUS_PG REUSE STORAGE
    ENDEXEC.
    COMMIT WORK.                      "Empty table is committed here
    Rob
    Edited by: Rob Burbank on Dec 1, 2008 4:06 PM

  • Double value truncated to two decimal places without rounding the value.

    I want to truncate double value to two decimal places without doing the rounding of the value.
    Is there any method which can directly do the truncation.

    There's many ways to achieve this such as using
    BigDecimal's setScale method or type-casting. This is
    the way I like to do it:double d = -5.239;
    d = d > 0 ? Math.floor(d * 100) / 100.0 : Math.ceil(d
    * 100) / 100.0;
    Your division by 100 may cause an rounding error, because there are numbers which no finite binary representation. That's splitting hairs! I know ;-)

  • Changing the value of a control in a subvi

    I think the answer is out there somewhere but I've read through many threads found with searches similar to this topic so sorry to repost...
    I would like to change the value of a top-level VI control from a sub-vi.  The data is being used as a parameter, I was thinking about using a local/global but I've seen this discouraged.  Is there a way I can do it with references, property, or invoke nodes (or some other suggested method) ?
    I am guessing that if I am not using globals I will need to wire into the sub-vi?
    Dave

    I'd like to clarify what I am trying to do a bit more...
    The sub-vi has a control of the same type as the top-level vi.  The inital control value is being passed into the sub-vi from the top-level vi.  The sub-vi uses the control value in several places through local variables (reading and writing to it)
    I would like to modify the vi so the top-level vi control value changes whenever the sub-vi changes the control value that is passed to it.
    My last attempt was to make a refnum control in the sub-vi (by dragging from top-level block diagram to sub front panel) and then creating a property node from that refnum control.  Using the property node "value" did not give me the value of the control from the top-level vi as I had hoped.  Wiring it to a terminal that was expecting the same type of control (a cluster of two numerics) caused a wiring conflict.
    I noticed elsewhere in the code that the programmer used a text file to save options (unfortunately the control I am working on was not originially included in the options).  There is a vi that, when called, either reads or writes to the text file.  From a C/C++ programming perspective it seems quite odd to me not to just keep all this data in memory and pass it around.  Is using a file to store variables a typical practice in LV programming (even when they are retrieved multiple times during program execution) ?

  • Unable to see the values from the FM in the ICSS application

    Hi Gurus,
    I am trying to call a custom function module in the ICSS application but it's not returning me any values in the application whereas it's showing values in the GUI for the same input.
    One more strange thing is when we are hardcoding the values in the output table of this FM then i am able to see the values in the front end application.
    I am clueless as what could be the reason.
    Please help me.
    Thanks,
    Gary

    Hi Saurabh,
    This is really a strange problem as you said.
    May be your fm is getting called more than once and in the second call there is no input data for the
    fm and that's why its returning blank and your business objects are getting overwritten with blank values but when you are hardcoding you are getting the data.
    Can you please debug and see if your fm is being called twice.
    Instead of hardcoding data to output tables, check once by hardcoding input to java backend object
    while calling the fm.
    Regards,
    Arshi

  • How to store the value of request message and use it in Response mapping

    Hi All,
    We have an requirement where we need to store the data coming in Request Mapping and use the stored value in Response Mapping. Can anybody help us in how to proceed?
    Thanks
    Sujata

    Hi!
    In Mapping you may use the RFC Lookup function to store values in database table during request mapping and to read values from database table during response mapping.
    You can also use an ABAP or Java Mapping "in front of your" message mapping to store/read the values.
    You can also use an Adapter Module (if applicable for the adapter type you use) and/or a UDF to store the data e.g. in Dynmaic Configuration Header of Request Message and to read these data from Dynamic Configuration Header of Response Message. But this works only for synchronous scenarios (and it means overhead in your message traffic).
    Hope these thinkings help you o find the most suitable way for your concrete scenario!
    Regards,
    Volker
    Note:
    These techniques help you to avoid using BPM.
    Edited by: Volker Kolberg on Aug 27, 2009 11:18 AM

  • How do I make new tabs from a first window go behind instead of in front of the first window?

    I use the same version of Firefox at work & new tabs open "behind" the initial tab, I can't figure out how to make this happen on my home computer! At home, new tabs open "in front" of the initial tab & it's really frustrating!

    Extract code into methods, so that when an action is performed a method is called. That way you can reuse the method for purposes such as resetting textfields to their default values, scores to default values, etc.
    You can go one step further and seperate the GUI layer from the processing layer, by deriving classes that for example maintain and calculate a score.
    Mel

  • How do we read the values in a tiled view,in the submitted form ?

    Hi,
    I have a form, which is having a tiled view. Each row in the tiled
    view has a check box. I have to read these check box selections, once
    the page is submitted. Is there any built in mechanism in JATO to do
    this ?
    One way I know is to maintain a hidden field in the form and have a
    javascript handler to create a string to reflect the check box
    selectios and set that string as hidden field value, before submitting
    the form. On the serverside read the hidden field's value and parse
    that string to get the selections.
    Are there any other options?
    Thanks in Advance,
    syam.

    While a front panel variable is inside a loop, it's not available to other loops.
    I want to access the value of the variable in many loops.
    And I want to write to a front panel variable in many loops, too.

  • How to set the value of an array element (not the complete array) by using a reference?

    My situation is that I have an array of clusters on the front panel. Each element is used for a particular test setup, so if the array size is three, it means we have three identical test setups that can be used. The cluster contains two string controls and a button: 'device ID' string, 'start' button and 'status' string.
    In order to keep the diagrams simple, I would like to use a reference to the array as input into a subvi. This subvi will then modify a particular element in the array (i.e. set the 'status' string).
    The first problem I encounter is that I can not select an array element to write to by using the reference. I have tried setting the 'Selection s
    tart[]' and 'Selection size[]' properties and then querying the 'Array element' to get the proper element.
    If I do this, the VI always seems to write to the element which the user has selected (i.e. the element that contains the cursor) instead of the one I am trying to select. I also have not found any other possible use for the 'Selection' properties, so I wonder if I am doing something wrong.
    Of course I can use the 'value' property to get all elements, and then use the replace array element with an index value, but this defeats the purpose of leaving all other elements untouched.
    I had hoped to use this method specifically to avoid overwriting other array elements (such as happens with the replace array element) because the user might be modifying the second array element while I want to modify the first.
    My current solution is to split the array into two arrays: one control and one indicator (I guess that's really how it should be done ;-) but I'd still like to know ho
    w to change a single element in an array without affecting the others by using a reference in case I can use it elsewhere.

    > My situation is that I have an array of clusters on the front panel.
    > Each element is used for a particular test setup, so if the array size
    > is three, it means we have three identical test setups that can be
    > used. The cluster contains two string controls and a button: 'device
    > ID' string, 'start' button and 'status' string.
    >
    > In order to keep the diagrams simple, I would like to use a reference
    > to the array as input into a subvi. This subvi will then modify a
    > particular element in the array (i.e. set the 'status' string).
    >
    It isn't possible to get a reference to a particular element within an
    array. There is only one reference to the one control that represents
    all elements in the array.
    While it may seem better to use references to update
    an element within
    an array, it shouldn't really be necessary, and it can also lead to
    race conditions. If you write to an element that has the
    possibility of the user changing, whether you write with a local, a
    reference, or any other means, there is a race condition between the
    diagram and the user. LV will help with this to a certain extent,
    especially for controls that take awhile to edit like ones that use
    the keyboard. In these cases, if the user has already started entering
    text, it will not be overwritten by the new value unless the key focus
    is taken away from the control first. It is similar when moving a slider
    or other value changes using the mouse. LV will write to the other values,
    but will not rip the slider out of the user's hand.
    To completely avoid race conditions, you can split the array into user
    fields and indicators that are located underneath them. Or, if some
    controls act as both, you can do like Excel. You don't directly type
    into the cell. You choose w
    hich cell to edit, but you modify another
    location. When the edit is completed, it is incorporated into the
    display so that it is never lost.
    Greg McKaskle

  • Error : The value is not set for parameter number"

    Hello All,
    I am getting an error message when I tried modifying a program by adding a new ID column to a database table.
    All DML is working except the Delete. So to look at the delete method, I am setting the parameter correctly as can be seen in the code belwo.
    Can someone please take a quick look and let me know where I need to tweak the code further.
    Thanks
    Fm
    The piece of code is given below.
    /* File Modified */
    /* EmailSetupDao.java
    * Generated by the MDK DAO Code Generator
    package com.harris.mercury.setups.standard.emailsetup;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Vector;
    import org.apache.log4j.Logger;
    import com.harris.mercury.dao.CreateException;
    import com.harris.mercury.dao.DAO;
    import com.harris.mercury.dao.DataField;
    import com.harris.mercury.dao.Holder;
    import com.harris.mercury.dao.LocalResultProxy;
    import com.harris.mercury.dao.RemoveException;
    import com.harris.mercury.dao.ResultProxy;
    import com.harris.mercury.system.DatabaseHelper;
    import com.harris.mercury.system.database.dialect.Dialect;
    * The EmailSetupDao class
    public class EmailSetupDao implements DAO
    protected static Logger logger = Logger.getLogger(EmailSetupDao.class);
    /* This method is called by ResultProxies when they need
    * the data they have retrieved in a ResultSet mapped
    * to a holder.
    public Holder createHolder(ResultSet rs) throws SQLException
    EmailSetupHolder holder = new EmailSetupHolder(); // THE CODE GENERATOR NEEDS THIS VARIABLE
    try
    /* Assign the data into the new holder */
    // $$START_CREATEHOLDER_CONVERSIONS
    holder.setEmail_address( rs.getString("email_address") );
    holder.setLogin_id( rs.getString("login_id") );
    holder.setUser_name( rs.getString("user_name") );
    holder.setSmtp( rs.getString("smtp") );
    holder.setId(rs.getString("id") );
    // $$END_CREATEHOLDER_CONVERSIONS
    catch(SQLException sqle)
    logger.error(sqle, sqle);
    throw sqle;
    return holder;
    /* The findAll method returns a ResultProxy containing all the
    * records in the pucemailr table, unless an extended where clause
    * has been defined.
    public ResultProxy findAll(Connection con) throws SQLException
    LocalResultProxy result = null; // THE CODE GENERATOR NEEDS THIS VARIABLE
    // $$START_ALLFIND
    result = new LocalResultProxy(this,con, "select email_address, login_id, user_name, smtp, id from pucemailr"+makeOrderBy());
    // $$END_ALLFIND
    return result;
    /* Inserts a record into the pucemailr table using a EmailSetupHolder.
    * An exception is thrown if it is not sucessful.
    public void insert(Connection con, EmailSetupHolder holder) throws CreateException
    CreateException ce = null;
    PreparedStatement ps = null; // THE CODE GENERATOR NEEDS THIS VARIABLE
    try
    // Insert into the data base
    // $$START_INSERT_PS
         ps = con.prepareStatement("insert into pucemailr (email_address, login_id, user_name, smtp) values(?, ?, ?, ?) ");
    // $$END_INSERT_PS
    /* Assign the variables in the holder to their corresponding
    * indexes in the prepared statement
    ps = assignPreparedStatementValues(ps, holder, true) ;
    // Try the insert
    ps.executeUpdate();
    catch (SQLException se)
    ce = new CreateException(se.getMessage());
    catch (Exception ex)
    ce = new CreateException(ex.getMessage());
    } finally {
    DatabaseHelper.close(ps);
    // Throw exception if error occurred
    if (ce != null) {
    throw ce;
    /* This method will update a pucemailr record using the
    * supplied EmailSetupHolder. If an error occurs, an exception
    * is thrown.
    public void update(Connection con, EmailSetupHolder holder) throws Exception
    RuntimeException re = null;
    PreparedStatement ps = null; // THE CODE GENERATOR NEEDS THIS VARIABLE
    try
    // $$START_UPDATE_PS
         ps = con.prepareStatement("update pucemailr set email_address=?, login_id=?, user_name=?,smtp=? where id=?");
    // $$END_UPDATE_PS
    /* Assign the variables in the holder to their corresponding
    * indexes in the prepared statement
    ps = assignPreparedStatementValues(ps, holder, false) ;
    // Try the insert
    int ret = ps.executeUpdate();
    if (ret != 1)
    re = new RuntimeException("Update failed on table pucemailr in EmailSetupDao");
    catch (SQLException se)
    re = new CreateException(se.getMessage());
    catch (Exception ex)
    re = new RuntimeException(ex.getMessage());
    } finally {
    DatabaseHelper.close(ps);
    // Throw exception if error occurred
    if (re != null) {
    throw re;
    /* Using the EmailSetupHolder, this method locates records in the pucemailr table.
    * Null values found in the holder are not used in the search.
    * An exception is thrown if an error occurs.
    public ResultProxy find(Connection con, EmailSetupHolder holder) throws SQLException
    // THE CODE GENERATOR NEEDS THESE VARIABLES
    ResultProxy result = null;
    int needAnd = 0;
    StringBuffer selectStatement = new StringBuffer();
    // $$START_FIND
    selectStatement.append("select email_address, login_id, user_name, smtp, id from pucemailr ");
    if(holder.getId() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("id like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getId())+"%'");
    if(holder.getEmail_address() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("email_address like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getEmail_address())+"%'");
    if(holder.getLogin_id() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("login_id like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getLogin_id())+"%'");
    if(holder.getUser_name() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("user_name like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getUser_name())+"%'");
    if(holder.getSmtp() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("smtp like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getSmtp())+"%'");
    // $$END_FIND
    result = new LocalResultProxy(this, con, selectStatement.toString()+makeOrderBy());
    return result;
    /* Creates an Order by clause */
    public String makeOrderBy()
    String result = "";
    // $$START_ORDERBY
    result = " order by smtp";
    // $$END_ORDERBY
    return result ;
    /* This method deltes a single record that matches all the
    * variables found in the EmailSetupHolder.
    * An exception is thrown if an error occurs.
    public void delete(Connection con, EmailSetupHolder holder) throws RemoveException
    RemoveException re = null;
    PreparedStatement ps = null; // THE CODE GENERATOR NEEDS THIS VARIABLE
    boolean hasVars = false;
    StringBuffer deleteSQL = new StringBuffer();
    deleteSQL.append( "delete from pucemailr where " );
    // $$START_DELETE_SQL
    if (hasVars)
    deleteSQL.append(" and ");
    if (holder.getEmail_address() != null) {
    deleteSQL.append("email_address=?") ;
    } else {
    deleteSQL.append("email_address is null");
    hasVars = true;
    if (hasVars)
    deleteSQL.append(" and ");
    if (holder.getLogin_id() != null) {
    deleteSQL.append("login_id=?") ;
    } else {
    deleteSQL.append("login_id is null");
    hasVars = true;
    if (hasVars)
    deleteSQL.append(" and ");
    if (holder.getUser_name() != null) {
    deleteSQL.append("user_name=?") ;
    } else {
    deleteSQL.append("user_name is null");
    hasVars = true;
    if (hasVars)
    deleteSQL.append(" and ");
    if (holder.getSmtp() != null) {
    deleteSQL.append("smtp=?") ;
    } else {
    deleteSQL.append("smtp is null");
    hasVars = true;
    if (hasVars)
    deleteSQL.append(" and ");
    if (holder.getSmtp() != null) {
    deleteSQL.append("id=?") ;
    } else {
    deleteSQL.append("id is null");
    hasVars = true;
    // $$END_DELETE_SQL
    try
         ps = con.prepareStatement(deleteSQL.toString());
    /* Assign the variables in the holder to their corresponding
    * indexes in the prepared statement
    int index = 1 ;
    // $$START_DELETE_VARS
    /* if( holder.getEmail_address() != null) {
    ps.setString(index, holder.getEmail_address() );
    index ++;
    if( holder.getLogin_id() != null) {
    ps.setString(index, holder.getLogin_id() );
    index ++;
    if( holder.getUser_name() != null) {
    ps.setString(index, holder.getUser_name() );
    index ++;
    if( holder.getSmtp() != null) {
    ps.setString(index, holder.getSmtp() );
    index ++;
    if( holder.getId() != null) {
    ps.setString(index, holder.getId() );
    index ++;
    // $$END_DELETE_VARS
    // Try the insert
    int ret = ps.executeUpdate();
    if (ret != 1)
    re = new RemoveException("Delete failed on table pucemailr in EmailSetupDao");
    catch (SQLException se)
    re = new RemoveException(se.getMessage());
    catch (Exception ex) {
    re = new RemoveException(ex.getMessage());
    } finally {
    DatabaseHelper.close(ps);
    // Throw exception if error occurred
    if (re != null)
    throw re;
    /* This method finds records in pucemailr table that match the
    * supplied where clause.
    * An exception is thrown if an error occurs.
    public ResultProxy advancedFind(Connection con, String whereclause) throws SQLException
    // THE CODE GENERATOR NEEDS THIS VARIABLE AND THE PARAMETER VARIABLE 'whereclause'
    StringBuffer selectStatement = new StringBuffer();
    // $$START_ADVANCEDFIND
    selectStatement.append("select email_address, login_id, user_name, smtp, id from pucemailr ");
    // $$END_ADVANCEDFIND
    selectStatement.append(" where ");
    selectStatement.append(whereclause);
    return new LocalResultProxy(this,con, selectStatement.toString()+makeOrderBy());
    /* This methods returns a Vector of DataField objects that
    * map the columns in the pucemailr table for the
    * advanced find Where Clause Generator in the client. The extended
    * where clause will be applied if one exists for this DAO.
    public Vector<DataField> getQueryFields() {
    Vector<DataField> v = new Vector<DataField>() ; // THE CODE GENERATOR NEEDS THIS VARIABLE
    // $$START_QUERYFIELDS
    v.addElement( new DataField( "email_address", "Email address", DataField.STRING ) ) ;
    v.addElement( new DataField( "login_id", "Login id", DataField.STRING ) ) ;
    v.addElement( new DataField( "user_name", "User name", DataField.STRING ) ) ;
    v.addElement( new DataField( "smtp", "Smtp", DataField.STRING ) ) ;
    v.addElement( new DataField( "id", "Id", DataField.STRING ) ) ;
    // $$END_QUERYFIELDS
    return v;
         * Jira Issue NS 30679 - Faiz Qureshi March 7, 2013
         * @param ps
         * @param holder
         * @param isInsert - Added Boolean parameter so the id parameter does not get passed for Insert DML statements
         * @return
         * @throws Exception
    public PreparedStatement assignPreparedStatementValues(PreparedStatement ps, EmailSetupHolder holder, boolean isInsert)
    throws Exception
    // $$START_PS_SETS
    if( holder.getEmail_address() != null)
    ps.setString(1, holder.getEmail_address() );
    else
    ps.setNull(1, java.sql.Types.VARCHAR);
    if( holder.getLogin_id() != null)
    ps.setString(2, holder.getLogin_id() );
    else
    ps.setNull(2, java.sql.Types.VARCHAR);
    if( holder.getUser_name() != null)
    ps.setString(3, holder.getUser_name() );
    else
    ps.setNull(3, java.sql.Types.VARCHAR);
    if( holder.getSmtp() != null)
    ps.setString(4, holder.getSmtp() );
    else
    ps.setNull(4, java.sql.Types.VARCHAR);
    if (!isInsert){
         if( holder.getId() != null)
         ps.setString(5, holder.getId() );
         else
         ps.setNull(5, java.sql.Types.VARCHAR);
    // $$END_PS_SETS
    return ps;
    /* Do not delete this tag, it is reserved for adding new methods to the DAO */
    // $$ START_MDK_RESERVED
    // $$START_EDITABLE_SUB_TABLE_NAME
    * Returns the table names used in this DAO
    * @return the table names used in this DAO
    public String[] getTableNames() {
    // $$START_UNEDITABLE_SUB_TABLE_NAME
    String[] tableNames = new String[] {"pucemailr"};
    // $$END_UNEDITABLE_SUB_TABLE_NAME
    return tableNames;
    // $$END_EDITABLE_SUB_TABLE_NAME
    // $$START_EDITABLE_SUB_FIND
    * Using the EmailSetupHolder, this method locates records in the pucemailr table.
    * Null values found in the holder are not used in the search.
    * An exception is thrown if an error occurs.
    * @param con The database connection
    * @param holder holder containing the values to generate a query upon
    * @param orderBy The order by clause. Note, you must specify the "ORDER BY". If you forget to add a
    * space in front of the order by, it will be automatically handled. Specify null to use the default
    * or empty string for no ordering.
    * @return The result of the search
    * @throws SQLException if an error occurs in the search.
    public ResultProxy find(Connection con, EmailSetupHolder holder, String orderBy) throws SQLException
    // THE CODE GENERATOR NEEDS THESE VARIABLES
    ResultProxy result = null;
    int needAnd = 0;
    StringBuffer selectStatement = new StringBuffer();
    // $$START_FIND
    selectStatement.append("select email_address, login_id, user_name, smtp, id from pucemailr ");
    if(holder.getEmail_address() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("email_address like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getEmail_address())+"%'");
    if(holder.getLogin_id() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("login_id like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getLogin_id())+"%'");
    if(holder.getUser_name() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("user_name like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getUser_name())+"%'");
    if(holder.getSmtp() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("smtp like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getSmtp())+"%'");
    if(holder.getId() != null)
    if ( needAnd > 0)
    selectStatement.append(" and ");
    else
    selectStatement.append(" where ");
    needAnd++;
    selectStatement.append("Id like ");
    selectStatement.append("'"+ Dialect.getSafeDialect(con).escape(holder.getId())+"%'"); }
    // $$END_FIND
    result = new LocalResultProxy(this, con, selectStatement.toString() + (orderBy == null ? makeOrderBy() : com.harris.mercury.system.utils.StringUtils.padLeft(orderBy)));
    return result;
    // $$END_EDITABLE_SUB_FIND
    // $$START_EDITABLE_SUB_FINDALL
    * The findAll method returns a ResultProxy containing all the records in the pucemailr table,
    * unless an extended where clause has been defined.
    * @param con The database connection
    * @param orderBy The order by clause. Note, you must specify the "ORDER BY". If you forget to add a
    * space in front of the order by, it will be automatically handled. Specify null to use the default
    * or empty string for no ordering.
    * @return The result of the search
    * @throws SQLException if an error occurs in the search.
    public ResultProxy findAll(Connection con, String orderBy) throws SQLException
    LocalResultProxy result = null; // THE CODE GENERATOR NEEDS THIS VARIABLE
    // $$START_UNEDITABLE_SUB_FINDALL
    result = new LocalResultProxy(this,con, "select email_address, login_id, user_name, smtp, id from pucemailr" + (orderBy == null ? makeOrderBy() : com.harris.mercury.system.utils.StringUtils.padLeft(orderBy)));
    // $$END_UNEDITABLE_SUB_FINDALL
    return result;
    // $$END_EDITABLE_SUB_FINDALL
    // $$START_EDITABLE_SUB_ADVANCEDFIND
    * This method finds records in pucemailr table that match the supplied where clause.
    * @param con The database connection
    * @param whereclause The where clause for the select statement - do not include the "where" - it
    * will be automatically prepended
    * @param orderBy The order by clause. Note, you must specify the "ORDER BY". If you forget to add a
    * space in front of the order by, it will be automatically handled. Specify null to use the default
    * or empty string for no ordering.
    * @return The result of the search
    * @throws SQLException if an error occurs in the search.
    public ResultProxy advancedFind(Connection con, String whereclause, String orderBy) throws SQLException
    // THE CODE GENERATOR NEEDS THIS VARIABLE AND THE PARAMETER VARIABLE 'whereclause'
    StringBuffer selectStatement = new StringBuffer();
    // $$START_ADVANCEDFIND
    selectStatement.append("select email_address, login_id, user_name, smtp, id from pucemailr ");
    // $$END_ADVANCEDFIND
    selectStatement.append(" where ");
    selectStatement.append(whereclause);
    selectStatement.append((orderBy == null ? makeOrderBy() : com.harris.mercury.system.utils.StringUtils.padLeft(orderBy)));
    return new LocalResultProxy(this,con, selectStatement.toString());
    // $$END_EDITABLE_SUB_ADVANCEDFIND
    // $$ END_MDK_RESERVED
    }

    First thing to do is to edit the post and use some tags to format the code as it is unreadable and too much!
    Read the FAQ (https://forums.oracle.com/forums/help.jspa) to find out how to do this.
    Next we need to know the jdev version you are using!
    As the code is generated I would first try to generate it again after the db change.
    Timo

  • HOW to set the value attribute of FORM INPUT data to a variable in a JSP

    eg. Registration.jsp
    The data is accessed from an hidden field called course
    for example, if I have "Java programming" in the field course, and I use
    an expression to access the value from the hidden field.
    **My problem is that the data gets truncated to "Java" , I need "Java Programming"to display. The code looks like this
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <INPUT TYPE="text" SIZE=12 NAME="course"
    VALUE=<%=getParameter("course") %>
    IS there ANY OTHER WAY to set the value of VALUE to a variable?

    Instead of value=<%=request.getParameter("course")%>
    Use double codes
    value="<%=request.getParameter("course")%>"

  • How can I fire an event case on the value change of an indicator, or a network variable?

    Hi!  I have an event structure setup to look for a value change of an indicator on the front panel.  The indicator is updated by the value of a boolean network-published shared variable through a seperate parallel loop that is polling all of the network-published shared variables.  The event, however, does not fire when the indicator changes value.  I have switched the indicator to a control and tested it with user interaction and that works just fine.
    I want to use the event structure space for my code exectution because it seems logical that that is where it would go, and it will help keep my block diagram tity.  The code is also something I would like executed with the front pannel temperarily disabled.  I would rather not have the code in my network-variable polling loop because again the tity issue.   I would also rather not use a notification VI wired to an independent loop for this particular code.
    Is there a way to have an event structure fire an event with the value change of an indicator, or a network variable directly?
    Thanks for your input.
    LV 8.5
    -Nic

    Thanks for the reply.
    I went about things a little differently, but got them to work so..... .  It really was not my desire to have a boolean indicator on the front panel.  As previously stated, my ultimate goal was to have an event fire on the change of a network variable, which I had to poll for anyway but that is tucked away in a section where I am handling all my network variables.  I ended up using that Create User Event, Register User Event, and Generate User Event SubVIs to handle the task.
    I've read the help for all of those SubVI's and it is not entirely clear to me if the event fires every time the "Generate User Event" receives some inputs, or if it only fires when the value changes.  I could do a test to find out.  It wouldn't be too difficult to add a shift register or a feedback node and place the Generate User Event in a case structure so that it is only fired when the input changes state.

  • Capturing the values of screen elements on click of execute button

    Hello folks,
    Is there a way to capture the values entered in the screen on click of the execute button?
    What I want to do is, I have a selection screen where-in a user can fill the input fields (parameters and select-options). Now when the user clicks on the execute button, the values of all the screen elements (no matter if they are filled or empty) should be stored in variable, so that I can use these values again when I am calling this program from another program.
    I want to do something similar to saving a variant, but this save should happen on click of Execute button and user need not require to explicitly save these values as variant.
    Hope I am clear enough to put my query in front of you all.
    It would be a great thing if you could help me.
    Need your help.
    Thanks in advance.

    Hi,
    You need something like this
    REPORT A.
    TABLES: sflight.
    PARAMETERS: pa_scarr   TYPE sflight-carrid.
    SELECT-OPTIONS so_conn FOR  sflight-connid.
    DATA: BEGIN OF it_selscr_values OCCURS 0.
            INCLUDE STRUCTURE rsparams.
    DATA END OF it_selscr_values.
    START-OF-SELECTION.
      CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
        EXPORTING
          curr_report     = sy-repid
        TABLES
          selection_table = it_selscr_values.  "here you have all parameters' values from selection screen
    "later in some other program you can use this table to call report A filling its selection screen with these default values like
    SUBMIT a WITH SELECTION-TABLE it_selscr_values.
    Regards
    Marcin

Maybe you are looking for