How to performance an UPDATE query in EJB project

Hi all,
I would appreciate help very much in knowing how to update rows in database when using EJB projects. Select queries are widely explained but nothing about update ones.
Thanks in advance.

869357 wrote:
No it's not running, giving some error.That is because SQL server construct is different than that of Oracle.
Try with
update table1 a set a.id = (select min(b.id) from table2 b where a.dept = b.dept);
However, due the repeated department values will not give you the desired output.

Similar Messages

  • How to run an update query on results from a spreadsheet

    Hey there,
    I am new to this kinda thing.
    I received a spreadsheet that has 2 tabs, 1 is called SQL Results, and has a ton of data. 1 is called SQL Statement and has a select statement in the first cell.
    I was told to run an update query using the spreadsheet, and was given this:
    = CONCATENATE("Update CARDMEMBERISSUE set CURRSTATUSCD = 'ACT', DATELASTMAINT = sysdate where AGREENBR = ",A2," and MEMBERNBR = ",B2," and ISSUENBR = ",C2,";")
    = CONCATENATE("Insert into CARDMEMBERISSUEHIST (AGREENBR, MEMBERNBR, ISSUENBR, EFFDATETIME, CARDSTATCD, STATREASON, DATELASTMAINT, DATESENT) values (",A2,",",B2,",",C2,",sysdate,'ACT',null,sysdate,null);"
    I am not sure what to do or how to run this.
    This is the what the lines in the spreadsheet look like, including column header, A1 is blank.
    A B C etc
         AGREE NBR      MEMBERNBR ISSUE NBR CURRSTATUSCD PREFIX CARD NBR AGREETYPCD OWNER PERS NBR     EXT CARD      ISSUE DATE     
    2     12          1     44     ISS g     22 22 19/10/2011

    The =concatenate bits are Excel formulae. Assuming they correctly written, they will generate a set of individual sql statements. The first concaenatewill generate a set of update statements against the CardMemberIssue table, and the seond will generate a set of insert statement to the CardMemberIssueHist table.
    You should be able to just paste the generated statements into whatever tool you are using to run sql to execute them. Before you do that though, make sure that you issue:
    alter session set cursor_sharing=force;before pasting anything in.
    john

  • Performance of update query for single column vs multiple column

    Hi All,
    I could not find any answer for this, does it ever matter in terms of performance updating single column versus multiple column in a single update query.
    For eg. table consisting of 15 columns, what would be the difference in performance when one column is update in the single query against another update query where 15 columns are updated.
    Please do keep in mind my table columns in actually could be around 150+.
    Thanks for any information provided.

    If updated columns aren´t on where clause , then the only impact of 15 columns will be a increase on redo generation, and a possible chainning row.
    So since the redo is one of the things that have a large impact, the answer is yes.
    The performance will be slower.
    Regards
    Helio Dias.
    http://heliodias.com
    OCE SQL, OCP 9i

  • How to execute a update query when the particular date changes

    hi all,
    i am using date base 11.1.0.6.0,
    i am trying a small update query it should fire when particular date changes in year.
    i think for trigger but i didn't get how to execute it.
    Regards,
    Pavan

    Hi, Pavan,
    Use dbms_scheduler to run a procedure at a given time (or at repeatedly, at given times).
    A trigger is good for re-acting to certain actions in the database, someone INSERTing a row in a given table, for example. Nothing will necessarily be happening when you want your procedure to run, so a trigger is not good in this case.

  • How to perform auto update in staging database using warehouse builder ?

    Hi ,
    here our client requirement is?
    our client want to transfer data from their production database to staging database using warehouse builder.and also what ever the update occur in production database
    that must be reflected in staging database.
    here we are transfering data from product-db to staging using etl(maping--insert/update operator )
    it is transfering fine.but it is not automaticaly updating in staging db with new update in production database?
    can any body give me the details how to achive it.
    Thanks & regards,
    k azamtulla khan.

    Hi,
    firstly there are two threads for the same issue from youself(excluding this one) which is a waste of others time so kindly refrain from doing so and use one thread.
    OWB: how can automatic updation  perform in staging database using OWB
    OWB: how to use insert/update table operator for target table
    secondly, with regards to the options , here are some options:
    1. Use trigger for update.
    2. Use materialized view(refresh on commit)
    3. Use oracle advance queing mechanism (OAQ) for queing the recent inserted/updated records.
    Kindly close other threads and maintain just one thread.
    Regards
    Message was edited by: Rado
    user647181

  • How to perform insert, update and delete in a table component

    hi all,
    i am using a table component in my page. I want to retreive data from multiple tables as well as perform insertion, updation and deletion operation.The changes should be affected in the corresponding tables. can anyone provide a solution for my problem.
    Thanks in advance
    regards,
    prasant

    There is a great tutorial for insert, update and delete records in a table.
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    Hope it helps.
    Thanks,
    Moumita

  • How To Perform Parallel UPDATE When Trigger is ENABLE On Table.

    select *from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionIs there any way to perform PARALLEL UPATE on a table which has a trigger?
    One of my ETL performs a large UPDATE (14 Million update) everyday on a production hot table. Eventhough PDML is enable at session level (also TABLE.DEGREE=8), Oracle is doing serialized UPDATE.
    As per Oracle documents, it is documented behavior.
    Here is my Execution plan when i put the trigger ENABLE
    | Id  | Operation              | Name                | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |
    |   0 | UPDATE STATEMENT       |                     |       |       |  6443 (100)|          |       |       |        |      |            |
    |   1 |  UPDATE                | ACCOUNT             |       |       |            |          |       |       |        |      |            |
    |*  2 |   PX COORDINATOR       |                     |       |       |            |          |       |       |        |      |            |
    |   3 |    PX SEND QC (RANDOM) | :TQ10000            | 72487 |  3610K|  6443   (3)| 00:01:18 |       |       |  Q1,00 | P->S | QC (RAND)  |
    |*  4 |     FILTER             |                     |       |       |            |          |       |       |  Q1,00 | PCWC |            |
    |   5 |      PX BLOCK ITERATOR |                     | 72487 |  3610K|  6443   (3)| 00:01:18 |   KEY |   KEY |  Q1,00 | PCWC |            |
    |*  6 |       TABLE ACCESS FULL| ACCOUNT             | 72487 |  3610K|  6443   (3)| 00:01:18 |   KEY |   KEY |  Q1,00 | PCWP |            |
    Predicate Information (identified by operation id):
         8 - filter("SET_OF_BOOKS"='1' AND "GL_BATCH_ID">(-10) AND ("JOURNAL_ENTRY_TYPE_ID"<2400 OR
                  "JOURNAL_ENTRY_TYPE_ID">=3000) AND "ACCOUNTING_DATE">=TO_DATE(' 2010-08-11 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "ACCOUNTING_DATE"<TO_DATE(' 2010-08-12 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))When i disable trigger
    | Id  | Operation                | Name     | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
    |   0 | UPDATE STATEMENT         |          |   726 | 27588 | 11899   (2)| 00:02:23 |        |      |            |
    |   1 |  PX COORDINATOR          |          |       |       |            |          |        |      |            |
    |   2 |   PX SEND QC (RANDOM)    | :TQ10001 |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,01 | P->S | QC (RAND)  |
    |   3 |    INDEX MAINTENANCE     | ACCOUNT  |       |       |            |          |  Q1,01 | PCWP |            |
    |   4 |     PX RECEIVE           |          |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,01 | PCWP |            |
    |   5 |      PX SEND RANGE       | :TQ10000 |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,00 | P->P | RANGE      |
    |   6 |       UPDATE             | ACCOUNT  |       |       |            |          |  Q1,00 | PCWP |            |
    |   7 |        PX BLOCK ITERATOR |          |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,00 | PCWC |            |
    |*  8 |         TABLE ACCESS FULL| ACCOUNT  |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,00 | PCWP |            |
    Predicate Information (identified by operation id):
       8 - filter("SET_OF_BOOKS"='1' AND "GL_BATCH_ID">(-10) AND ("JOURNAL_ENTRY_TYPE_ID"<2400 OR
                  "JOURNAL_ENTRY_TYPE_ID">=3000) AND "ACCOUNTING_DATE">=TO_DATE(' 2010-08-11 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "ACCOUNTING_DATE"<TO_DATE(' 2010-08-12 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))I cannot disable trigger due to some business reasons.
    Is there any way to speed up UPDATE ?

    No, you cannot perform parallel dml with a trigger present.
    If you are updating the bulk of the rows and can take an outage, you can
    disable the trigger, perform the update, enable the trigger
    OR
    copy to another table, performing the update in the select, rename the tables and add the trigger on the new table
    Hemant K Chitale

  • How to call external jar files in EJB project for CE

    Hi,
    I would be thankful if someone could help me with this -
    I need to call the external jar files into my EJB project - Here is what I have done and am getting runtime exception as  -
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    1. Created a EJB  project" HelloWorld "  using Java perspective in NWDS 7.1 called with client as HelloWorldClient and EAR project as HelloWorldEAR.
    2. Am working on HelloWorld project (1st one).
    3. In my code I am instantiating a class which is a class in one of  the external jar file that I need to refer in my project.
    4. I have set the Java Build path but it works only for the compile time and fails during runtime.
    5. Have read I need to create external library DC and refer in my project "HelloWorld".
    Can anyone help me with exact steps what needs to be done - during creation of external library project and then for my "HelloWorld" EJB project. How would I be able to reference or set the external library project in my EJB project?
    Looking forward to hear from experts.
    Thanks,
    Shiv
    Edited by: Shiv Khullar on Aug 30, 2010 9:39 PM

    Hi Edson,
    I tried it , but it still gives me runtime exception.
    javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    Steps I performed are -
    1. Created a library project and created 2 Public parts "Compilation" and "Assembly"
    2. Build the library project.
    Now in my EJB project using Project Explorer - set the classpath and added both compilation jar and assembly jar files.
    This is how the classpath entries for external library looks like -
    <classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkAssembly/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkAssembly.jar"/>
         <classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkCompilation/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkCompilation.jar"/>
    I have also added the jar files I used in my external library project as "User Library" from Java Build Path . I dont do it , then the code fails during compilation itself.
    Regards,
    Shiv

  • How to tune the update query?

    HI Expert,
    Our client is facing a performance problem.
    Every alternate day they use to run a load on the database.
    Database is RAC and when they execute a load database used to get hang.
    Everytime we have to regather a stats, after that the update statement execute.
    They are also saying that the query is taking time to execute.
    previously it used to execute fast.
    It would be great if you expert help to find out the bottleneck and solutions.
    this stats i generated before creating the indexes on PRIM_IND column
    SQL> Update /*+ index(IND) */ ENT_HUB.ADDR set PRIM_IND=0 where PRIM_IND=1 and SCD_ACTV_IND=1;
    1477866 rows updated.
    Execution Plan
    Plan hash value: 2784578406
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | UPDATE STATEMENT | | 1321K| 7743K| 25185 (1)| 00:05:03 |
    | 1 | UPDATE | ADDR | | | | |
    |* 2 | TABLE ACCESS FULL| ADDR | 1321K| 7743K| 25185 (1)| 00:05:03 |
    Predicate Information (identified by operation id):
    2 - filter("PRIM_IND"=1 AND "SCD_ACTV_IND"=1)
    below stats i generated after creating the index.
    SQL> Update /*+ index(addr IND) */ ENT_HUB.ADDR set PRIM_IND=0 where PRIM_IND=1 and SCD_ACTV_IND=1;
    1478212 rows updated.
    Execution Plan
    Plan hash value: 736707583
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | UPDATE STATEMENT | | 622K| 2432K| 102K (1)| 00:20:33 |
    | 1 | UPDATE | ADDR | | | | |
    |* 2 | TABLE ACCESS BY INDEX ROWID| ADDR | 622K| 2432K| 102K (1)| 00:20:33 |
    |* 3 | INDEX RANGE SCAN | IND | 1245K| | 2382 (1)| 00:00:29 |
    Predicate Information (identified by operation id):
    2 - filter("SCD_ACTV_IND"=1)
    3 - access("PRIM_IND"=1)
    Thanks,

    user646034 wrote:
    Hi,
    Currently we are using without index.
    however we are not getting performance improvement.
    Please suggest us what can we do to achieve the performance again.
    ThanksDon't update that many rows?
    Not sure what else we can offer you for assistance, it's possible you could change the process flow of your application to not need to update the rows (possibly decode values upon the insert) or change the data model, etc....
    But that's all outside the scope of possibility based on the information you've provided.
    You're doing a LOT (relative to the number of rows in the table) of updating, that takes time and is bound by the laws of physics, we can't alter those here.

  • How to performance tune this query

    I need some inputs on how to do performance tuning on this query to improve performance.
    It takes around 45 secs to run. Is it possible to make any improvements in this by putting hints or writing in another way?
    select count(*)
    as nCount from A ,
    B ,
    C
    WHERE A.COL1 = B.COL1 AND
    A.COl2 <> 'COM' AND
    B.COL2 = C.COL1 AND
    B.COl3 IS NULL AND
    B.COL4 = 'TEST'
    This is the query plan:
    Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE 1 51
    SORT AGGREGATE 1 37
    HASH JOIN 48 K 1 M 51
    TABLE ACCESS FULL A 68 K 998 K 32
    NESTED LOOPS 98 K 2 M 5
    TABLE ACCESS BY INDEX ROWID B 142 K 2 M 4
    INDEX SKIP SCAN XIF37B 142 K 6
    INDEX UNIQUE SCAN XPKC 1 5

    Mcka
    As well as EXPLAIN PLAN, let us know what proportion of rows are visited by this query. It may be that it is not using a full table scan when it should (or vice versa).
    And of course we'd need to know what indexes are available, and how selective they are for the predicated you have in this query ...
    Regards Nigel

  • How to right an update query in oracle using two tables?

    Table1
    ID     Dept
    1     A
    2     B
    3     A
    4     B
    5     C
    6     A
    7     D
    Table2
    ID     Dept
    1     A
    2     B
    3     A
    4     B
    5     C
    6     A
    7     D
    How to update id in Table1 from Table2 on joining condition Table1.dept=Table2.dept
    in Oracle

    869357 wrote:
    No it's not running, giving some error.That is because SQL server construct is different than that of Oracle.
    Try with
    update table1 a set a.id = (select min(b.id) from table2 b where a.dept = b.dept);
    However, due the repeated department values will not give you the desired output.

  • How can perform insert /update /delete in one single mapping.

    Hi,
    I want to is there any logic by which we can create 2-3 pipeline in a mappings like pipelines will work for insert / update /delete or storing soem rejected data according to conditional flag.
    I tried it in a mapping but problem is that when target load order is like ins then upd then delete/reject . if new rec will come then control will pass through ins target . but if rec needs to update or delete then again control is going to ins target not update / delete target.
    We have already given the all conditional flags in filter after lookup and before target .
    all possibilities we checked but didnt got success.
    last option is separate the mappings for insert / update/delete.....etc.
    Is there any solution for this type of problem.
    reply plz if any body have solutions.
    ---Umesh

    Hi Umesh,
    I understand from your query that you want to load target with insert, update and delete rows after runnng the mappping...
    If you are looking for the same then you can use one of the Oracle fetures Oracle Streams: Change Data Capture.
    the Url is:
    http://www.oracle.com/technology/products/bi/db/10g/pdf/twp_cdc_cookbook_0206.pdf
    If any other help required do reply.
    Regards
    Tarang Jain

  • Update query with multiple foreign key parameters

    I am trying to perform an update query on one field that uses multiple foreign key parameters from one table to update the other table. The data in all three foreign key parameter fields are not constant. Accuracy is absolutely critical. I tied this as well as other various scenarios with no success. Can anyone help?
    Update A_table a
    set a.rate = (
    select b.rate
    from B_table b
    where b.id = a.id
    and b.transdate = a.transdate
    and b.orgnum = a.orgnum
    and b.transdate = to_date('31/12/2007', 'dd/mm/yyyy')
    )

    I would check symbols by a user name and number of posts before calling anyone a hot shot, especially damorgon.<br><br>
    Yes version matters (due to bugs and features in each version).<br>
    DDL matters because of indexes and associations.<br>
    Data matters because it makes a difference on how SQL can be written.<br>
    Reasons why an SQL statement don't work is because we aren't looking over your shoulder at your screen.<br><br>
    damorgon did leave off his list that the best place for this question is on the PL/SQL, where they will ask you similar questions in addition to your explain plan and data volumes.

  • To perform database update in a module with AT EXIT-COMMAND addition

    Dear All,
    I have a function code 'EXIT' with function type 'E'. When this function code is triggered, my screen should close.
    In the module that handles this function code (defined with AT EXIT-COMMAND addition), I will prompt the user whether he/she want's to save the data before exiting with the POPUP_TO_CONFIRM_STEP function module. The text message in the dialog box is "Do you want to save before exiting?".
    When the user wants to save the data, a simple UPDATE statement will be executed to write the data on screen to database.
    The problem here is since the module is defined with AT EXIT-COMMAND addition, the data on screen won't be copied to their corresponding variable on the code (correct me if I'm wrong). Therefore, even though database update is performed, the data written to database are no different that the original.
    How to perform database update in a module with AT EXIT-COMMAND addition?
    or
    Is it even a "custom" or a "good practice" to prompt user to save data before exiting?
    Thanks in advance,
    Haris

    With an exit command, if there's anything that would be lost, I would prompt "Data will be lost, do you wish to continue?". If they do, the database is not updated, if they don't, they stay in the transaction.
    This is because the exit command runs before validation. So how can you know the data is correct?
    If you have a button to leave the transaction that isn't an exit command, then you could prompt to save instead. There the choices should be - quit without saving, save and quit, don't quit.
    Doing a database update in an exit command is not a good idea.
    matt
    Edited by: Matt on Mar 15, 2011 11:53 AM

  • Advanced update query

    I am trying to perform an update query on one field that uses multiple foreign key parameters from one table to update the other table. The data in all three foreign key parameter fields are not constant. Accuracy is absolutely critical. I tied this as well as other various scenarios with no success. Can anyone help?
    Update A_table a
    set a.rate = (
    select b.rate
    from B_table b
    where b.id = a.id
    and b.transdate = a.transdate
    and b.orgnum = a.orgnum
    and b.transdate = to_date('31/12/2007', 'dd/mm/yyyy')
    )

    I think most of the new guys post product related questions here because, they might have heard that there is something called forums, they go to google and type oracle forums. When the forums home page opens they directly post in the first link available, which is unfortunately this forum. Probably moving Database forum up, and moving technology network community forums below would solve this problem compared to the number of people who don't even read the forum name before posting.

Maybe you are looking for

  • Can clicking on a component in a pdf mark the number in a corresponding bill of material ?

    Hi, I have a production drawing with graphics and a bill of material. Is there a way with a product like Adobe Writer when clicking on the grahics that a corresponding number in the bill of material is selected ? We need this functionality for a spar

  • Text Highlighting issue with TextSnapshot object

    Hi, I am working with a digital book application. I make use of swf loader to load swf pages created from pdf. I use TextSnapsot to draw inline text highlight on the pages. The highlight is thoroughly retained on the respective pages throughout the s

  • Third Party Plug Ins & RAM

    Hi Guys My MBP is about a year old now with 2GB RAM and 2.4 GHZ processor. Until recently I have been running Logic very nicely for my needs, generally 15-20 audio or software instruments tracks with overloading a rather rare occurance. This is with

  • How to manually select automated text snippets (e.g. auto numbering)

    Hi, I tried looking in the help, cant find anyt I have a few occassions where I need to change the text-color to white, because of the dark background. I created a Character Style called "Negative" where I simply set the Text Color to White. So far s

  • Since 10.0.1 dropping wave files in the arranger leads to a empty region.

    Logic X 10.0.0. had no problems with the directly dropping .wav files from the finder in the arrangement area. since upgrade to 10.0.1 this leads to a event with just a bit noise in it. When I import it via the menu function, the same process leads t