To update table data

create or replace procedure SP_MIS_LEDGER_ON_DEMAND_V2
as
var_date1 date;
VAR_STARTDATETIME DATE;
VAR_ENDDATETIME DATE;
-- VAR_EXECUTE_FOR_DATE DATE;
-- VAR_STATEMENT VARCHAR2(4000);
VAR_ELAPSEDTIME VARCHAR2(50);
VAR_INTRIMSTATUSID NUMBER;
CURSOR c1 IS
select DISTINCT ta.accountid,day PROCESSDATE,(NVL(payment,0))PAYMENT,0 TOTALDUE,0 CURBILL, NVL(srf,0)SRF,NVL(sbpnt,0)sbpnt,NVL(srv,0)SRV,NVL(sbf,0)SBF,NVL(SBV,0)SBV,NVL(EF,0)EF,NVL(EV,0)EV,NVL(TSRV,0)TSRV,NVL(tsub,0)TSUB,NVL(teqe,0)TEQE,NVL(DT,0)DT,NVL(A.dep,0)RDEP,NVL(B.DEP,0)PDEP,NVL(pnt,0)PNT,NVL(eqp,0)EQP,NVL(dtr,0)DTR,NVL(drf,0)DRF,NVL(unadj,0)UNADJ from
(select DISTINCT day ,accountid
from
syntblmaccount, tblmtime where yyyy=2010)ta,
(SELECT accountid,
SUM(srfee)srf,
SUM(srvat)srv,
SUM(subfee)sbf,
SUM(subvat)sbv,
SUM(eqefee)ef,
SUM(eqevat)ev,
SUM(ttlsrv)tsrv,
SUM(ttlsub)tsub,
SUM(ttleqe)teqe,
SUM(dep)dep,
SUM(dt)dt,trunc(FROMDATE)FROMDATE
FROM VWDT_V6
group by accountid, trunc(FROMDATE)
)a,
(SELECT accountid,
SUM(pnt)pnt,
SUM(subpnt)sbpnt,
SUM(eqpnt)eqp,
SUM(dep)dep,
SUM(DEPTRANSFER)dtr,
SUM(DEPREFUNDED)drf,
SUM(unadj)unadj,trunc(paymentdate)paymentdate
FROM vwkt_v4
GROUP BY accountid,trunc(paymentdate)
)b,
(SELECT ACCOUNTID accountid,TRUNC(createdate)CREATEDATE, SUM(totalamount)PAYMENT
from syntbltcreditdocument
where CREDITDOCUMENTTYPEID IN ('CDT01','CDT04')
group by accountid,TRUNC(createdate))credit
where ta.accountid=a.accountid(+)
and ta.accountid=b.accountid(+)
and ta.accountid=credit.accountid(+)
and ta.day=a.FROMDATE(+)
and ta.day=credit.createdate(+)
and ta.day=b.paymentdate(+)
and ta.day =to_date('01-MAY-2010','DD-MON-YYYY');
BEGIN
SELECT MAX(PROCESSDATE) INTO VAR_DATE1 FROM MIS_LEDGER_DETAIL_TEST;
SELECT SYSDATE INTO VAR_STARTDATETIME FROM DUAL;
SELECT SEQ_PRC_STATUS.NEXTVAL INTO VAR_INTRIMSTATUSID FROM DUAL;
FOR c1_rec IN c1
LOOP
EXIT WHEN c1%NOTFOUND;
UPDATE MIS_LEDGER_DETAIL_tEST A
SET A.PAYMENT=c1_rec.payment,
A.TOTALDUE=c1_rec.TOTALDUE,
A.CURBILL=c1_rec.CURBILL,
A.SRF=c1_rec.srf,
A.SBPNT=c1_rec.sbpnt,
A.SRV=c1_rec.srv,
A.SBF=c1_rec.sbf,
A.SBV=c1_rec.sbv,
A.EF=c1_rec.ef,
A.EV=c1_rec.ev,
A.TSRV=c1_rec.tsrv,
A.TSUB=c1_rec.tsub,
A.TEQE=c1_rec.teqe,
A.DT=c1_rec.dt,
A.PDEP=c1_rec.Pdep,
A.RDEP=C1_REC.RDEP,
A.PNT=c1_rec.pnt,
A.EQP=c1_rec.eqp,
A.DTR=c1_rec.dtr,
A.DRF=c1_rec.drf,
A.UNADJ=c1_rec.unadj
where A.accountid=c1_rec.accountid
and A.processdate=C1_REC.processdate
and a.processdate =to_date('01-MAY-2010','DD-MON-YYYY');
END LOOP ;
commit;
SELECT SYSDATE INTO VAR_ENDDATETIME FROM DUAL;
SELECT CAST(VAR_ENDDATETIME AS TIMESTAMP) -
CAST(VAR_STARTDATETIME AS TIMESTAMP) INTO VAR_ELAPSEDTIME
FROM DUAL;
INSERT INTO LedgerStatusSummary (StatusID, ProcedureName, STARTDATETIME, ENDDATETIME, LastExecutionDate,NextExecutionDate,LastModifiedDate,TIMETAKEN,Procedurestatus) VALUES
(VAR_INTRIMSTATUSID,'SP_MIS_LEDGER_ON_DEMAND',VAR_STARTDATETIME,VAR_ENDDATETIME,TRUNC(VAR_DATE1),TRUNC(VAR_DATE1)+1,VAR_STARTDATETIME, VAR_ELAPSEDTIME,'MENUAL');
COMMIT;
EXCEPTION
WHEN OTHERS
THEN DBMS_OUTPUT.PUT_LINE('An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END SP_MIS_LEDGER_ON_DEMAND_V2;
i have 9830 data in MIS_LEDGER_DETAIL_tEST table ... i am updating table data but it is taking more time to update for 01-may-2010 it is not completing execution in 15 min so i abort it...
how to write update query....?? please guide me...
Thanks in advance
exec SP_MIS_LEDGER_ON_DEMAND_V2

Why do you need a cursor or a loop at all? What in your statement can not be accomplished with a simple UPDATE TABLE?
But if you do require a loop, I don't see it, then use BULK COLLECT and FORALL statements
http://www.morganslibrary.org/reference/array_processing.html
And replace this:
SELECT SYSDATE INTO VAR_STARTDATETIME FROM DUAL;
with this:
VAR_STARTDATETIME := SYSDATE;

Similar Messages

  • Update table data based on sheet

    Hi
    I'm still trying to find an easy sollution to the following problem
    I'd like to update the data in a table with the data I have in a sheet
    I found the possibility to insert but I'd like to do an update or even a merge from the sheet with less clicks and no copy paste
    Does HTML DB have this functionallity hidden somewhere?
    I'll have to do this for a large number of sheets with the same structure but different names
    To me the ideal sollution would be the possibility to define a 'profiile' for the sheet in which you can state the table, collumns and join condition
    So when I'm uploading I only have to choose the profile and give the file name as input
    Thanks
    Cindy

    Cindy,
    I'm sure this requirement has already been mentioned and I believe the solution is/was to load in the usual way and then use your own procedure (maybe kicked off by a trigger) to update/insert/whatever on your own tables, and then delete from the upload table ready for the next sheet (or use sqlldr from a script -- could then be called repeatedly in a for loop to run in a whole lot of sheets in one hit -- for the dataloads to a temporary table then kick off the procedure).
    Greg

  • Is there a process/program  to update tables/data after System Refresh?

    We are planning a refresh of SAP R/3 47 and SRM EBP 4.0. Copies of all data from our production system will be refreshed onto our test environment. 
    Is there a program that can be run to reset the "Destination" targets as there is with "source" using BDLS?
    We can copy out certain tables and reimport, but we fear that we may be missing something. If anyone has informatoin on the process for performing a refresh, we would appreciate hearing about it.
    Thanks,
    BIll
    Message was edited by: William Olliver
    Using BDLS and clearing out some of the custom tables (allowing normal programs to rebuild data points) did the trick. 

    Hi Bill,
    BDLS takes care of the table entries that correspond to the Logical System.  This takes care of almost 80-90% of the entries. 
    Keep in mind however, you will need to change all the entries that correspond to an backend RFC destination or other webservers once a copy is made; as those are not updated by BDLS. 
    Some of these are (as it is entirely dependent on the scenarios being implemented):
    DEFINE BACKEND SYSTEMS:
    --IMG>SRM>...
    ORGANIZATION STRUCTURE
    --Use standard program RHOMATTRIBUTES_REPLACE
    --Plus, Change other attributes: POrg,PGrp,Plants...
    EDI/IDOC/ALE entries for partner profiles
    --WE21 etc.
    TWPURLSVR, TWPURLPATH, etc
    --Table entries
    WORKFLOW Verification Steps
    --IMG>Workflow...
    MIDDLEWARE PARAMETERS in R/3 and SRM.
    --Table Entries
    CATALOG ENTRIES
    --IMG>Master Data...
    Hope this helps.
    -Sachin Sethi

  • Wrongly updated table data

    Dear Sir,
    Accidentally, Data is updated wrongly in production server and that table is enabled by CDC.
    Is there any mechanism to restore point in time without restore fullback.
    Cheers,

    you can use CDC table to reverse engineer and get the data but it  can get ugly if you several other changes happening alongside on the same columns. you may also have lost updates..
    be carefull...
    if you do not want to do full restore,. take a snapshot of the CDC table and  test if you can reverse engineer..as i said, i can get messy, depending how complex the envirnoment..
    if all this is done in one transaction, you get the value before and revert it to it if that column was not subsequently changed(which will also be logged in the CDC table) but is the subsequent modification on the column supposed to be modified or was modified
    because of the wrong value...so, you see how it is turning to be messy..
    Hope it Helps!!

  • Cannot update table data based on values of numeric fields

    I have a button on a form with two numeric fields: P11_numeric1 and P11_numeric2.
    I want to be able to either run a stored procedure or execute the update logic. We're on apex 4.0.
    I tried the follow syntax in a process run by a button:
    begin
    schema.procname(:P11_numeric1,:P11_numeric2);
    end;
    And nothing happened.
    If I try to run the proc in toad with hard coded parameter values, the proc works.
    I tried this:
    begin
    update schema.tablename
    set value=:P11_numeric1
    where id=:P11_numeric2;
    commit;
    end;
    And this doesn't work.
    I tried:
    begin
    update schema.tablename
    set value=1
    where id=2;
    commit;
    end;
    And that worked, so I assume the issue is with getting the numeric field values. Am I using incorrect syntax?

    I'm on apex 4.0.2 btw. I had two main problems: 1) the process that my procedure was in was in a sequence number lower than the MRU process sequence number. I didn't want to use the MRU so I changed it to being called by ajax calls only (which I don't have on the page, effectively not firing this process on page submit). Changing the sequence number of the process call to the procedure higher then allowed me to run the stored procedure.
    The next problem was that the fields weren't being passed into the proc.
    It looks like the type of the field made a bit of a difference to sending in the parameter for the procedure. The data is either integer or numeric and if the fields were set to a text field, and the proc was changed to accept varchar2 data and convert using to_number in the proc that the data was accepted and was fine. For the integer fields, I was able to (and wanted to) change the field type to display only as this is a read only screen with an button to save the data. For the numeric fields, for some reason the display field type did not allow the field value to be passed to the stored proc.
    I'll take a look at the session values not getting set but has anyone heard of that happening to display only fields with numeric data specifically?

  • How to update table in EJB QL

    Hi friends,
    Anybody tell me how to modify data in the table using EJB QL....
    I am using XDoclet,Weblogic,EJB,MySQL
    I want to update table data using EJB QL,Xdoclet...Anybody help me
    thanks in advance
    priya

    don't double post. You can edit posts you know, or add a reply with the additional information.
    http://forums.sun.com/thread.jspa?threadID=5417462&tstart=0

  • How to update the data in sqlserver table using procedure in biztalkserver

    Hi,
    Please can any one answer this below question
    how to update the data in sqlserver table using procedure in biztalkserver
    while am using executescalar,typedprocedure getting some warning
    Warning:The adapter failed to transmit message going to send port "SendtoSql1" with URL "mssql://nal126//MU_Stage2?". It will be retransmitted after the retry interval specified for this Send Port. Details
    Please send me asap....
    Thanks...

    Hi Messip,
    A detailed error would have helped us to answer you more appropriately but
    You can follow the post which has step by step instructions, to understand how to use Stored Procedure:
    http://tech-findings.blogspot.in/2013/07/insert-records-in-sql-server-using-wcf.html
    Maheshkumar
    S Tiwari|User
    Page|Blog|BizTalk
    2013: Inserting RawXML (Whole Incoming XML Message) in SQL database

  • Tree table is not reflecting the updated model data changes at the front end

    I have two tables ,
    1) Provider table(tree table)  2)member table
    I have implemented drag and drop functionality using jQuery UI on both tables.
    In my scenario when I drag a member from the member table and drop it on the Provider table and also when I delete an assigned member from the provider table I will update the data fetched from odata model and again I will call the method which binds the data to the provider table so that the table will reflect the changes.
    here is the code,
    on drop:
    $("#Provider tbody tr").droppable({
      drop: function(event){
           oController.AssignMember(oProviderId, oMemberId)
      }).disableSelection();
    Assign member function:   here am updating the model.
    AssignMember : function(oProviderId, oMemberId){
      var oModel = new sap.ui.model.odata.ODataModel("../../../services/provider.xsodata/", true);
      var oParameters = {};
      oParameters.PROVIDER_ID = oProviderId;
      oParameters.MEMBER_ID = oMemberId;
      oParameters.CREATED_ON = new Date();
      oModel.setHeaders({"content-type" : "application/json;charset=utf-8"});
      oModel.create( "/PROVIDERMEMBERS", oParameters, null, function() {
      var oController = sap.ui.controller("adsm.provider.member_assignment_view");
      oController.GetProviderData();
      },function(jqXHR) {
      var errorMessage = jqXHR.response.body;
      var jsondata = JSON.parse(errorMessage);
      sap.ui.commons.MessageBox.alert(jsondata.error.message.value);
    GetProviderData function: here i bind the data to the table
    GetProviderData: function(){
    var oModel = new sap.ui.model.odata.ODataModel("../../../services/provider.xsodata/", true);
    var Context = "/PROVIDERS?expand=ASSIGNEDMEMBERS&$select=NAME,ID,ASSIGNEDMEMBERS/NAME,ASSIGNEDMEMBERS/ID,ASSIGNEDMEMBERS/PROVIDER_ID";
      var oTable = sap.ui.getCore().byId("tblProviders");
      oModel.read(Context, null, null, true, onSuccess, onError);
      function onSuccess(oEventdata){
      var outputJson = {};
      var p = 0;
      var r = {};
      if (oEventdata) {
      r = oEventdata;
      try {
      if (oEventdata.d){
      r = oEventdata.d;
      } catch(e){
      //alert('oEventdata.d failed');
      try {
      if (oEventdata.d.results){
      r = oEventdata.d.results;
      } catch(e){
      //alert('oEventdata.d.results failed');
      try {
      if (oEventdata.results){
      r = oEventdata.results;
      } catch(e){
      //alert('oEventdata.results failed');
      $.each(r, function(i, j) {
      outputJson[p] = {};
      outputJson[p]["NAME"] = j.NAME;
      outputJson[p]["ID"] = j.ID;
      outputJson[p]["PROVIDER_ID"] = j.ID;
      outputJson[p]["DELETE"] = 0;
      var m = 0;
      if (j.ASSIGNEDMEMBERS.results.length > 0) {
      $.each(j.ASSIGNEDMEMBERS.results, function(a,b) {
      outputJson[p][m] = { NAME: b.NAME,
      ID : b.ID,
      PROVIDER_ID: b.PROVIDER_ID,
      DELETE: 1};
      m++;
      p++;
    var oModel = new sap.ui.model.json.JSONModel();
      oModel.setData(outputJson);
      oTable.setModel(oModel);
      function onError(oEvent){
      console.log("Error on Provider Members");
    oTable.bindRows({
      path:"/"
    Its working fine in chrome but in IE the model data gets updated but the table is not reflecting the changes at front end.Can anyone suggest me a possible solution to fix this?
    Please have a look at the attached screen shots.
    Best regards,
    Amala Suganya.

    Hi Amala,
    I think this will help you:
    Disabling Cache for CRUD/FI OData scenarios for a UI5 Application on Internet Explorer
    Kind regards,
    RW

  • How to delete or Update the data in the MEAN table

    Hello Gurus,
    I would like to delete or update the data in the MEAN table...how to do it.
    Precisely I would like to change the status of Main EAN Indicator (field HPEAN).
    Kindly let me know ??
    Rehards
    Senthilll

    programmatically, you may use [BAPI_MATERIAL_SAVEDATA|https://www.sdn.sap.com/irj/scn/advancedsearch?query=bapi_material_savedata&cat=sdn_all] [EAN|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=bapi_material_savedata+ean&adv=false&sortby=cm_rnd_rankvalue]
    Regards,
    Raymond

  • Multi-table data block with update

    My data block is set up by joining 3 tables. Only 1 table is
    set up as updatable. The columns from the other 2 tables are
    set in property palette as not updatable. But when I try to
    update the data block row, I get: FRM-40501 ORACLE error:
    unable to reserve record for update or delete.
    I have tried using an updatable view in the data block and even
    wrote an INSTEAD TRIGGER for the update but I receive the same
    message.
    I appreciate your help.
    Thanks.

    you can try on-update trigger on block level to handle this
    problem.

  • Update the data in user-defined table

    Dear All,
    Is there anyway we can insert / update the data in user-defined table in a batch instead of update it from the interface one by one? Our customer has 1,000+ data need to be imported.
    They are on SAP2007A SP00 PL45, SQL 2005, CA localization. Thanks a lot.
    Regards,
    yuka

    Dear Yuka,
    If it is UDT, you may use any SQL query to insert, update it. It is not under SAP support anyway.
    Thanks,
    Gordon

  • Function module updating the data base table

    Hi,
      This post is regarding the function module not updating the data base table.
    I am calling the FM SD_SHIPMENT_HEADER_CHANGE inside the ZFM. It's returning success an changing the  table c_xvttk_new with the new TDLNR value. But it's not updating the Shipment table VTTK-TDLBR or VT02N Forwarding agent.
    When I directly updating Forwarding agent in VT02N it's updating fine.
    Please let me know what the extra step need to be included to update or COMMIT the FM for updating
    Forwarding Agent(VTTK-TDLNR).
    Best Regards,
    Mahesh

    hi friend,
    This link wont five u the complete help but if u ananyse it  then it might provide u some idea......
    BAPI change shipment doc
    regards
    kanishak

  • Update DIM data in Fact Table

    All -
    I have a TSR dimension data (1 of 12 dimensional attributes) in our forecast fact table which gets updated monthly in our source system and we have to reflect this in our BPC system. What is the best method of updating this data in BPC?
    1. Can I update the TSR directly in the forecast fact table and reprocess the application to reflect this in the cube?
    2. Do I have to negate that entire fact table row with the old TSR and insert a new row with the new TSR and process the cube?
    3. Any other method?
    Thanks for your help.

    You need to explain your requirement a bit more. Why you want to add type or rejection reason in fact table.
    In general you should avoid adding textual data in fact.
    Fact tables are only supposed to store keys and measures. It can hold textual data in case of degenerate dimension ( i.e if the number of records are same in dimension as well as fact ).
    Type or Rejection reason are going to have much less records. You can create a new dimension for them having probably 20 or 30 records.
    Disadvantages of adding textual data in fact is, once the fact has millions of records the fact table updates are going to take huge time and also your reports will take long time.
    If you have a rejection reason dimension with some 20 records, you can use rejection reason in prompts.
    But if the same rejection reason is coming from fact table your prompts performance is going to be very slow since it has to fetch 20 distinct records from millions of records.
    Consider these before adding textual data in facts.
    Thanks
    Edited by: Maqsood Hussain on Dec 5, 2012 9:40 PM

  • Dynamically Update External Table Data

    I loaded a data table from an external csv file. But the csv file is an output from a program that appends a new line to the csv file every couple days.
    I made a Report with the loaded data, but in a couple days when a few new lines of data appear in the csv file, I want my report to update as well.
    Is there a way to create a "Refresh Button" in my application that will load the data from the csv when pressed?
    I have oracle database 11g express with APEX 4.1.1

    Hi,
    what you describe could certainly be achieved, but it would have to be designed and built, it is not going to be provided "out of the box". I would probably go with an external table based on your file and a process that you would build would be callable from the button and this would do some sort of a merge of the external table data into your database table. Apart from being callable on demand, the process could also be made to be a scheduled process that loads the data on a regular basis, say once a day or once an hour, depending on your requirements. To use an external table it is assumed that the file will be available on the database server. If not and the file is available on only a client machine, then doing an on demand load process would still be possible, but a little more difficult.
    Andre

  • Error converting data when updating table

    Hi,
    I need to understand why I cannot gat my update to work properly, I have to concat 4 fields (numbers with leading zeros so I can create a new number with leading 1. My field is already set as a bigint but I cannot convert the resulting string properly
    UPDATE table 
    set field = convert(bigint, '1', strfield1 + strfield2 + strfield3 + strfield4)
                                           1,  001      
    +   0125   + 0045      + 004568 
    The end result need to return the number 100101250045004568  to be inserted into a bigint field but I always get the following error:
    Error converting data type nvarchar to bigint
    If I try a select , it shows the proper result, so what am I missing here

    Guess I will have to wait for our new SQLServer 2012, coming in next week, I have tried every possible cast, convert possibility to make it work.
    Thank you all
    Al
    This should work fro SQL Server 2008 R2
    select CAST(('1'+ strfield1 + strfield2 + strfield3 +strfield4) AS BIGINT);
    web: www.ronnierahman.com

Maybe you are looking for

  • How to remove header on last page of the report?

    I am working on a RTF template for PO report. This is the format of the rtf i have. <?start:body?> <?for-each@section:G_HEADERS?> All header fields <?for-each:G_LINES?> All Line Fields <?end for-each?> --Line End <?end for-each?> --Header End <?end b

  • Error in deploying, EAR file does not contain SAP_MANIFEST.MF

    I just upgraded to SAP Netweaver Developer Studio 7.1 from 7.0, and the process of creating and deploying an EJB archive seems to be quite different. Here are the steps I am following: (1) I create and build an EJB Project called foo. (2) Export the

  • Trouble installing Adobe Acrobat X Professional

    Hi Guys/girls, We had Acrobat X installed and recently we trialed XI. Now trying to go back to X and install it from our DVD we are getting the following error. Can someone help identify what is wrong and causing the issue? Exit Code: 6 Please see sp

  • Oracle Report that should display o/p in two tabs on a same spreadsheet in excel

    Hai,      I have a report that displays Supplier Requirements (Gross) for the specified number of weeks in Reports 10g. This Supplier Requirements Report (SRR) is displayed in excel format when the job is done through concurrent program. I have a req

  • Change term of payments in Documents

    Hi Can the terms of payment be changed to the documents which are already posted. Say i posted documents with 30 days grace, now i changed the terms of payment to 20 days. But the changes did not effect documents already posted. Is there any why by w