Update/insert with a select statment?

helo,
i have this select statement:
SELECT CLAIM_NO, SUM (LPA_AMT)
FROM LPA_CREDHIST_RCA
GROUP BY CLAIM_NO
And i want to update this field LPA_CLAIM.TOTAL_AMT_PAID with the sum(LPA_AMT)
from above.
the join is lpa_credhist_rca.claim_no = lpa_claim.claim_no.
How do i do this??

With this code, you avoid to scan two time the table lpa_credhist_rca and to update all recod of the lpa_claim table.
Regards Salim
MERGE INTO lpa_claim lc
   USING (SELECT claim_no, SUM (lpa_amt) OVER (PARTITION BY 1) total
            FROM lpa_credhist_rca) lcr
   ON (lc.claim_no = lcr.claim_no)
   WHEN MATCHED THEN
      UPDATE
         SET total_amt_paid = total ;Edited by: Salim Chelabi on 2009-06-08 08:51

Similar Messages

  • How to do an insert with a select statement, with unique values

    Hi,
    I have an insert statement like this
    INSERT INTO TABLEA (ID, zzz
    SELECT sequence.nextval, zzz FROM TABLEB
    The problem is TABLEA won't allow any duplicates and TABLEB will return duplicates. Yet I can't use the distinct keyword since I am using a sequence.
    Thanks.

    Samuel411 wrote:
    Hi,
    I have an insert statement like this
    INSERT INTO TABLEA (ID, zzz
    SELECT sequence.nextval, zzz FROM TABLEB
    The problem is TABLEA won't allow any duplicates and TABLEB will return duplicates. Yet I can't use the distinct keyword since I am using a sequence.
    Thanks.Why not?
    drop sequence s
    create sequence s;
    create table distincting (col1 number, object_owner varchar2(30));
    TUBBY_TUBBZ?
    insert into distincting
    select s.nextval, object_owner
    from
      select
        distinct
          owner as object_owner
      from dba_objects
      9  );
    37 rows created.
    TUBBY_TUBBZ?

  • Update statement with nested selects and alias usage

    Hello, we are trying to build an update statement like this...
    update table1 t1
    set attr1 = ( select someattr
    from (nested select 1) as aux1
    (nested select 2 (nested select 2.1 + nested select 2.2)) ) as aux2
    where some_join_clauses
    where t1.attr2 = 123
    and t1.attr3 = 'abc'
    Alias t1 shound be known at the level of nested select 1,2 and 2.1, 2.2? We are receiving an error message saying that t1.someattr is an invalid identifier. Can you help? Thanks!

    mauramos wrote:
    Hello, we are trying to build an update statement like this...
    update table1 t1
    set attr1 = ( select someattr
    from (nested select 1) as aux1
    (nested select 2 (nested select 2.1 + nested select 2.2)) ) as aux2
    where some_join_clauses
    where t1.attr2 = 123
    and t1.attr3 = 'abc'
    Alias t1 shound be known at the level of nested select 1,2 and 2.1, 2.2? We are receiving an error message saying that t1.someattr is an invalid identifier. Can you help? Thanks!You can only reference elements nested 1 level deeper in a correlated update statement.
    I'd suggest you try with the MERGE statement, or alternatively, post some sample data (insert statements) and table DDL (create statements), with an 'expected output' description and we can try to help you build a suitable statement.

  • How to update database with a select box

    I'm hoping someone can/will help me with a new feature I'm
    trying to add to my web site. I'll summarize what I'm working with
    and then proceed to what I'd like to do. This is the web site I'm
    working on: www.truckerstoystore.net
    I have a database for the Truck of the Week set up with the
    information that is output on each page in the left column and
    on the Truck of the week page itself. I add new Truck of the
    Week (TOW) entries via a form I've put together. Right now, in
    order to change the current TOW, I have to manually go into my
    template and change the ID (which is automatically assigned when
    the record is created, and thus makes it unique) in my SQL which
    currently reads
    SELECT *
    FROM truckofweek
    WHERE ID="4"
    to the ID of the current TOW.
    What I want to be able to do is create a new form that will
    allow me to select the TOW entry that I want to be displayed from a
    select box (drop down box). I have a good idea of how to populate
    my select box, but don't know how to get it to work. My first idea
    was to update the table in the database (Access) manually with a
    new column called currentTOW, with values set to a Yes/No type,
    with default values set to "No". Then I would use my form to set
    the value for one of them to "Yes" so I could set my SQL to 'WHERE
    currentTOW ="yes" ' I would also make a <cfif> statement that
    checks for entries marked "Yes" and changes them to "No" when the
    form loads to avoid setting 2 entries to "Yes" and my page thus
    attempting to load 2 TOW entries.
    My problem is, I don't know how to do any of this. I hope
    I've described this situation well enough. I know there has to be
    at least one guru on here that can help me. Any assistance would be
    greatly appreciated.

    Hey,
    Thanks for replying. That sounds like a good idea, but I
    don't know how to do it.
    I started working on a new idea, where I have a second table
    in the same datasource set up called currentTOW, with one field
    called currentTOW and only one record. The idea is to send the
    string of the "owner" field from the select box, which is populated
    from the table called truckofweek to this one cell in the
    currentTOW table.
    This way, in my page which will display the data, I have 2
    querys. The first pulls the data in the single cell from currentTOW
    and outputs its string into the second query. I've attached the
    code below. I get an error when I try to display the page, see the
    error here:
    www.truckerstoystore.net/currentTOW2.cfm.
    However, the SQL looks like I want it to look, as "WHERE Owner =
    Craig Carp" is essentially the same record that it displays now in
    the live page "/currentTOW.cfm" only the SQL currently reads "WHERE
    ID = 4" (4 and Craig Carp are part of the same record).
    Here is the link to my form:
    Form

  • Updating Table with DropDownList Selection (ASP)

    I'm converting one of my Access forms into ASP and I'm having trouble mimicking Access's combobox features in ASP.
    In my original form, I have a combobox bound to a lookup table that writes the selection into a master table field.
    The combobox works like this in Access:
    Row Source: SELECT sourceCodes.name FROM sourceCodes;
    Control source: source (a field in my master table)
    In Dreamweaver, I was able to populate a DropDownList with the same query as a Dataset ('sourceDropDown'):
    <asp:DropDownList ID="DropDownList1" DataSource="<%# sourceDropDown.DefaultView %>" DataTextField="name" DataValueField="code" runat="server"></asp:DropDownList>
    But I'm at a lack of how to write this data when a selection is made. The ASP page I'm making is set up to be an update form by default. How do I tie a combobox change into the update action or do I do something like an AfterUpdate for the DropDownList to write the selection back to the table immediately?
    Goes without saying that I'm new to ASP. Any help or even pointers in the right direction would be really appreciated!
    Thanks in advance!
    [Subject line edited by moderator to indicate server technology used]

    Thanks for your reply!
    The problem I'm still seeing is that my DropDrown code doesn't seem to have anything in it to direct the selected DropDown item to a table's field. It does have a DataSource, which gives the DropDown its items, but I need to tell it where to put data when a selection is made, like "Control Source" in Access.
    ' This populates the DropDownList from a lookup table, but doesn't have any info on where to store selected data.
    <asp:DropDownList ID="DropDownList1" DataSource="<%# sourceDropDown.DefaultView %>" DataTextField="name" DataValueField="name" runat="server"></asp:DropDownList>
    ' I'm using this code so the DropDown reads the actual field I'm trying to update ('source' from my dataset inventoryQry). This is part of the functionality that I want, but I also need to update the field if a selection is made from the DropDown
    <% DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue(inventoryQry.FieldValue("sour ce", Nothing)  )) %>
    I'll keep digging around. If you have any other pointers, thank you in advance!

  • SQL MERGE trying to duplicate update/insert. The insert/update is not ideal, but the sql merge hangs.

    I am trying to duplicate this update/insert with a sql merge:
    -UPDATE [etag].Energy_Processed
    SET Start_Datetime = estg.Start_Datetime,
    --End_Datetime = estg.End_Datetime,
    --Schedule_MW = estg.Schedule_MW,
    --Active_MW = estg.Active_MW,
    Load_Dt = GETUTCDATE() 
    FROM  [etag].Energy_Stg estg, [etag].[Energy_Processed] ep
    WHERE estg.Tag_Name IN
    SELECT DISTINCT(tproc.Tag_Name) from [etag].[Energy_Processed] eproc
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Id = eproc.Tag_Id
    INNER JOIN [etag].[Energy_Stg] estg1 ON estg1.Tag_Name = tproc.Tag_Name
               AND ep.Active_MW = estg.Active_MW
               AND ep.End_Datetime = estg.End_Datetime
              AND ep.Schedule_MW = estg.Schedule_MW 
    INSERT into [etag].[Energy_Processed] (Tag_Id, Start_Datetime, End_Datetime, Schedule_MW, Active_MW, Load_Dt)
    SELECT tproc.Id, estg.Start_Datetime, estg.End_Datetime, Schedule_MW, Active_MW, GETUTCDATE()  FROM [etag].[Energy_Stg] estg
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Tag_Name = estg.Tag_Name
    WHERE estg.Id BETWEEN @minEId AND @maxEId AND
    estg.Tag_Name NOT IN (
    SELECT DISTINCT (tproc.Tag_Name) from [etag].[Energy_Processed] eproc
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Id = eproc.Tag_Id
    INNER JOIN [etag].[Energy_Stg] estg1 ON estg1.Tag_Name = tproc.Tag_Name
    SQL MERGE:
    MERGE [Forecast_Data_Repository].[etag].[Energy_Archive] enArch
    USING 
    (SELECT ep.Tag_Id, ep.Start_Datetime, ep.End_Datetime, ep.Schedule_MW, ep.Active_MW, ep.Load_Dt 
    FROM  [etag].[Energy_Stg] estg, [etag].[Energy_Processed] ep
    WHERE estg.Tag_Name IN
    SELECT DISTINCT(tproc.Tag_Name) from [etag].[Energy_Processed] eproc
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Id = eproc.Tag_Id
    INNER JOIN [etag].[Energy_Stg] estg1 ON estg1.Tag_Name = tproc.Tag_Name
    ) AS sourceEP
    ON EXISTS(SELECT sourceEP.Tag_Id)
    WHEN MATCHED THEN
    UPDATE
    SET Tag_Id = sourceEP.Tag_Id,
    Start_DateTime = sourceEP.Start_Datetime,
    End_Datetime = sourceEP.End_Datetime,
    Schedule_MW = sourceEP.Schedule_MW,
    Load_dt = GETUTCDATE()
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (Tag_Id, Start_Datetime, End_Datetime, Schedule_MW, Active_MW, Load_dt)
    VALUES (sourceEP.Tag_Id, sourceEP.Start_Datetime, sourceEP.End_Datetime, sourceEP.Schedule_MW,
    sourceEP.Active_MW, GETUTCDATE())
    OUTPUT
    $action,
    INSERTED.Tag_Id
    --UPDATED.Tag_Name
    INTO @MergeOutput;
    Greg Hanson

    This bit
        ON EXISTS(SELECT sourceEP.Tag_Id)
    Looks wrong. Sould be something like:
       ON sourceEP.Tag_Id = enArch.Tag_Id
    And don't update the matching columns in the UPDATE part, as they already match.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Select statment Query

    Hi,
    I am devloping Query  with the table DBERCHZ1
    it  having  two fields
        V_ ABRMENGE        value  456
       N_ ABRMENGE        value   0.67899
    Here i want  to print as  456.67899  with  one  select  statment.
    is  any way  to sum  in select  statment.
    Thanks

    Hi,
    I have just given a code snippet similar to your requirement.
    DATA:   average TYPE p DECIMALS 2,
            sum     TYPE p DECIMALS 2.
    SELECT AVG( luggweight ) SUM( luggweight )
      INTO (average, sum)
      FROM sbook.
    WRITE: / 'Average:', average,
           / 'Sum    :', sum.
    Just replace with your variables and let me know if it works.
    Thanks,
    Harini

  • Update with a select statement

    hi experts,
    I need some help again.. :)
    I have an insert query here with a select statement.. Juz wondering how to do it in update?
    insert into newsmail_recipient
            (IP_RECIPIENTID,NF_LISTID,NF_STATUSID,D_CREATED,D_MODIFIED,C_NAME,C_EMAIL,USER_ID,NEWSMAIL_ID)
            select newsmail_recipientid_seq.nextval
              , liste
              , 1
              , sysdate
              , sysdate
              , null
              , null
              , ru.nf_userid
              , null
            from roleuser ru, unit u, userinfo ui
            where u.ip_unitid = ru.nf_unitid
            and u.ip_unitid = unit_id
            and ui.ip_userid = ru.nf_userid
            and ui.nf_statusid = 1
            and n_internal = 0
            and ui.ip_userid not in (select user_id
                                       from newsmail_recipient
                                      where user_id = ui.ip_userid
                                        and nf_listid = liste
                                        and nf_statusid = 1);let me know your thoughts.
    Regards,
    jp

    Hi,
    924864 wrote:
    ... I have an insert query here with a select statement.. Juz wondering how to do it in update?How to do what, exactly?
    MERGE can UPDATE existing rows, and INSERT new rows at the same time. In a MERGE statement, you give a table or a sub-query in the USING clause, and define how rows from that result set match rows in your destination table. If rows match, then you can UPDATE the matching row with values from the sub-query.
    Very often, MERGE is easier to use, and perhaps more efficient, than UPDATE just for changing existing rows. That is, while MERGE can do both INSERT and UPDATE, it doesn't have to . You can tell MERGE just to do one or the other if you wish.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Since you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Update/Insert Problem with Oracle Warehouse Builder

    Hello,
    i have update/insert problem with owb.
    Situation: I have a source-table called s_account and a target table called w_account_d. In the target table are already data which was filled trough the source table inserts. Now anyone make changes on data on the target table. This changes should now give further on the source table with an update operation. But exactly here is the problem i can´t map back the data to source because that will create a loop.
    My idea was to set a trigger but i can´t find this component in owb or is anywhere hidden?
    Also i have already seen properties as CDC or conditonal loading in the property inspector of the table, but i have no idea how it works.
    Give it other possibilities to modeling this case? or can anyone me explain how i can implement this eventually with CDC?
    I look forward for your replies :)

    Hi
    thanks for your answer. I follow your suggestion and have set the constraints of both tables into the database directly.Nevertheless it doesn´t work to begin. In the next step i found by right click on a table the listpoint "configure" - I goes to "unique key" --> creation method and set here follow options: Constraint State = ENABLE, Constraint Validation = Validate. That error message that appears before by the deployment disappears yet. Now i start the job to test if the insert/update process works right. Finally it seems to work - but not really.
    My Testscenario
    1. Load the data from source table about the staging area to data warehouse table: Check - it works!
    2. Change one data record in source table
    3. Load the source table with changed data record once again to staging area: Check - it works!
    4. Load new staging area table with the changed data record to data warehouse table: Check it works! BUT, BUT i can not recognize if it is insert or update operation, then under the design window by jobs execution windows is reported "rows selected 98", Rows inserted" is empty and "rows updated" is empty. So i think works not correct, then my opinion if it works correct it should show be "rows updated" 1.
    What can yet now still be wrong or forgotten? Any ideas?
    *By the way think not 98 rows there is not important if you make an update or insert which performance. It is an example table the right tables have million of records.*
    I look forward for your answers :)

  • Only select statements work (update/insert hang)

    Hi, I am running CF MX version 7,0,2,142559 Standard Edition
    and ColdFusion is hanging everytime I attempt an insert or update
    statement again Oracle 8i and 9i using the jdbc thin driver and an
    odbc socket driver.
    Select statements work fine. I have tried everything I could
    think of and I get the same results. All rights are given to the
    datasource and the user. I can do insert and update statement via
    another application (Toad) with the same Oracle user.
    Any suggestions??? I don't see any hot fixes for this but
    that doesn't mean one doesn't exist.
    Also, many times it causes the system cpu utlization to stick
    at 100% until I restart ColdFusion.
    Thanks for any help.

    Hi,
    I had similar results on Oracle 10G while using cfmx 7.02. I
    actually updated the macromedia_drivers.jar from the coldfusion
    support site.
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=42dcb10a
    An update to the datadirect JDBC drivers. Try that. If not,
    make sure you have the latest JDBC drivers from Oracle. Since
    previous versions would make the update/insert;s hang.

  • Update table with select from another table

    Hallo,
    I'd like to update table b with codes from a mapping table a.
    a has:
    town_id, town_code, town_name
    b has town_code, town_id, town_population, town_zip_code,...
    Table a has all the details - town_id, town_code and town_name and acts as the mapping between town_id and town_code
    In table b, town_code is null. I want to update the column b.town_code with town_code from table a where a.town_id = b.town_id.
    How will the update query look like?
    I tried
    UPDATE B SET town_code = (SELECT A.town_code FROM A,B WHERE A.town_id=B.town_id)
    and I get the error 'single-row subquery returns more than one row'
    Will appreciate your assistance

    This is what I did.
    First, I created and populated the TOWN_INFO table:
    CREATE TABLE "TOWN_INFO"
    (     "TOWN_ID" NUMBER,
         "TOWN_CODE" NUMBER,
         "E_MAIL" CHAR(15 BYTE)
    Table Created.
    insert all
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3024,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3040,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3052,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3065,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3066,'[email protected]')
    select * from dual
    5 rows created.
    The following creates and populates the mapping table:
    CREATE TABLE "TOWN_MAPP"
    (     "TOWN_CODE" NUMBER,
         "TOWN_ID" VARCHAR2(255 BYTE),
         "TOWN_NAME" CHAR(6 BYTE)
    insert all
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3024,'1001','TOWN_1')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3040,'1003','TOWN_3')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3052,'1002','TOWN_2')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3065,'1004','TOWN_4')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3066,'1006','TOWN_6')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3088,'1007','TOWN_7')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3020,'1009','TOWN_9')
    select * from dual
    7 rows created.
    And now the update query:
    UPDATE TOWN_INFO
    SET TOWN_CODE=(SELECT B.TOWN_CODE FROM TOWN_MAPP B, TOWN_INFO C
    WHERE B.TOWN_ID=B.TOWN_ID)
    SET TOWN_CODE=(SELECT B.TOWN_CODE FROM TOWN_MAPP B, TOWN_INFO C
    ERROR at line 2:
    ORA-01427: single-row subquery returns more than one row
    Thanx in advance
    Edited by: user9954260 on Apr 13, 2010 7:40 AM
    Edited by: user9954260 on Apr 13, 2010 7:44 AM

  • Strange results with Insert statement having select query

    Hi all,
    I am facing a strange issue with Insert statement based on a select query having multiple joins.
    DB- Oracle 10g
    Following is the layout of my query -
    Insert into Table X
    Select distinct Col1, Col2, Col3, Col4, Function(Col 5) from Table A, B
    where trunc(updated_date) > = trunc(sysdate-3)
    and join conditions for A, B
    Union
    Select Col1, Col2, Col3, Col4, Function(Col 5) from Table C, D
    trunc(updated_date) > = trunc(sysdate-3)
    and join conditions for C, D
    Union
    .... till 4 unions. all tables are residing in the local Database and not having records more than 50,000.
    If I execute above insert in a DBMS job, it results into suppose 50 records where as if I execute the select query it gives 56 records.
    We observed following things-
    a) no issue with size of tablespace
    b) no error while inserting
    c) since query takes lot of time so we have not used Cursor and PLSQL block for inserting.
    d) this discrepancy in number of records happens frequently but not everytime.
    e) examined the records left out from the insert, there we couldn't find any specific pattern.
    f) there is no constraint on the table X in which we are trying to insert. Also tables A, B, C....
    I went through this thread -SQL insert with select statement having strange results but mainly users are having either DB Links or comparison of literal dates, in my case there is none.
    Can somebody explain why is the discrepancy and what is the solution for it.
    Or atleast some pointers how to proceed with the analysis.
    Edited by: Pramod Verma on Mar 5, 2013 4:59 AM
    Updated query and added more details

    >
    Since I am using Trunc() in the where clause so timing should not matter much. Also I manually ruled out records which were updated after the job run.
    >
    The first rule of troubleshooting is to not let your personal opinion get in the way of finding out what is wrong.
    Actually this code, and the process it represents, is the most likely CAUSE of the problem.
    >
    where trunc(updated_date) > = trunc(sysdate-3)
    >
    You CANNOT reliably use columns like UPDATED_DATE to select records for processing. Your process is flawed.
    The value of that column is NOT the date/time that the data was actually committed; it is the date/time that the row was populated.
    If you insert a row into a table right now, using SYSDATE (8am on 3/5/2013) and don't commit that row until April your process will NEVER see that 3/5/2013 date until April.
    Here is the more typical scenario that I see all the time.
    1. Data is inserted/updated all day long on 3/4/2013.
    2. A column, for example UPDATED_DATE is given a value of SYSDATE (3/4/2013) in a query or by a trigger on the table.
    3. The insert/update query takes place at 11:55 PM - so the SYSDATE values are for THE DAY THE QUERY BEGAN
    4. The data pull begins at 12:05 am (on 3/5/2013 - just after midnight)
    5. The transaction is COMMITTED at 12:10 AM (on 3/5/2013); 5 minutes after the data pull began.
    That data extract in step 4 will NEVER see those records! They DO NOT EXIST when the data pull query is executed since they haven't been committed.
    Even worse, the next nights data pull will not see them either! That is because the next pull will pull data for 3/5/2013 but those records have a date of 3/4/2013. They will never get processed.
    >
    Job timing is 4am and 10pm EST
    >
    Another wrinkle is when data is inserted/updated from different timezones and the UPDATED_DATE value is from the CLIENT pc or server. Then you can get even more data missed since the client dates may be hours different than the server date used for the data pull process.
    DO NOT try to use UPDATED_DATE type columns to do delta extraction or you can have this issue.

  • Update data from ODS to ODS with infopackage selection

    Hi,
    I am trying to update data from one ODS to another ODS with selection criteria in InfoPackage which is created manually.For Full load I can give selection criteria in InfoPackage. When I initialize data Selection is greyed out even selections for Full load exists. Please advise me how to give selections for delta loads from ODS to ODS loads.
    Thanks in advance.
    Ram

    Once you started an ODS as destination in FULL mode from a DS you cannot get back.
    So if you want to update from ODS to ODS using Change Log but considering only some data records you could create an Update Routine with a Start Routine that DELETES undesired records (e.g. DELETE DATA_PACKAGE WHERE ...) and then start an Init-Delta Loading.
    Hope it helps
    GFV

  • Problem with data selection when inserted through textarea

    hi there,
    i am inserting data from textarea into a database field
    and then displaying the inserted data it is displaying properly but as a continuous string
    i want to display it as it was inserted with new line
    like if i have inserted through <textarea>
    hello
    all
    there
    it is displaying like
    hello all there
    i want to display as it was
    i have three pages as given below and my database field is varchar (using oracle 9i)
    1.first.html
    <html>
    <body>
    <form method="post" action="insert.jsp">
    <textarea name="text">
    </textarea>
    <input type="submit"></input>
    </form>
    </body>
    </html>2.insert.jsp
    <%@ page import = "java.io.*"%>
    <%@ page import="java.sql.*" %>
    <%!
    String txt;
    %>
    <%
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con =DriverManager.getConnection("jdbc:odbc:ods","scott","tiger");
         txt= request.getParameter("text");
         out.println(txt);
         PreparedStatement ps = con.prepareStatement("insert into text values('"+txt+"')");
         ps.executeUpdate();
         out.println("values inserted successfully");
    %>3.display.jsp
    <%@ page import = "java.io.*"%>
    <%@ page import="java.sql.*" %>
    <%
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con =DriverManager.getConnection("jdbc:odbc:ods","scott","tiger");
         PreparedStatement ps = con.prepareStatement("select * from text");
         ResultSet rs=ps.executeQuery();
         while(rs.next())
         out.println(rs.getString(1));
    %>thanx & regards
    sweety

    This is a feature of HTML. Its the way it is supposed to work.
    If you view source on your generated jsp page, you should see the html exactly mirrors what you typed in the text area
    If you don't want it acting this way then either
    1 - put it in a text area again
    2 - put <pre> tags around what you want do display unformatted
    or
    3 - Change all new lines to <br> in the html
    This is what you want in the html:
    <pre>
    Mulitple
      line
    Data
    </pre>

  • Hello there - how can I share my iTunes library between two users on the same computer? I put the library in a shared folder between both and have selected this library on both as well, but when I update iTunes with music etc it only appears on one?

    Hello there - how can I share my iTunes library between two users on the same computer? I put the library in a shared folder between both and have selected this library on both as well, but when I update iTunes with music etc it only appears on one?

    Thank you Joe - I tried this but it's only showing a teensy amount of music - the stuff on the second users account as opposed to the giagntic library on the 'main' account. I actually went to a Genius Bar and they said that apple doesn't really want you to share music between accounts - parents don't want to hear their kids music etc. Which seemed strange, but it might be the case sadly   Thanks anyway!

Maybe you are looking for

  • Advice Needed please - spreading bill payments

    Dear All Unfortunately and stupidly have rung up a very large bill for the last quarter and can't afford the single payment, can't really afford 3 payments either, would like to spread the amount over 12 months or whatever but not even sure if this i

  • How to allocate the workflow to the action defnitions in solution manager

    Hi, we are having solution manager with the CHARM configured, and currently we are looking for the trigger of mail and workitem for change of action. the work flow is designed for that, but how to assign the workflow to the condition and processing t

  • Issue with Deployment of SOA application which contains rule

    Hi, I am working on SOA OrderBooking Workshop When i create a rule and try to deploy the application on my machine i am getting error message . But the same application when i try to deploy on my colleague machine its works perfectly fine. Note : The

  • IPod Touch stopped detecting Wifi

    Hi, I've had my iPod for a while now and recently it hasn't detected any wifi around the house, or anywhere at all. I've turned it off, reset settings, and restored it. I don't think the problem is my router because I have 3 laptops around the house

  • CR 2008 and Dynamic Parameters

    I have a report that has been "upgraded" over a number of years and thus a number of versions of Crystal Reports.  The basic issue is that it has 2 dynamic parameters that are showing up as plain textboxes in CR 2008 SP3 instead of a dropdown.  This