Use of update table in Unserialised V3?
HI Pioneers,
Can any one let me know the advantage of Update table in Unserialised V3 update mode?
Thanks,James
hi,
Update table is to store the posted records(V3 update), so the the collective run can pick uprecords from there.
Unserialized V3 update is not used now a days.
Only queued Delta is used
Regards,
Ramesh
Similar Messages
-
Use of Update Table in Delta Extraction ....
Hi all ,
I have a small doubt regarding why there is an update table introduced between statistical table and delta queue in delta extraction process ... why not directly extract data from the statastical table and put it in to the delta queue .....
Kindly help me regarding this ...
Regards ,
Santosh ....Hi Santosh,
I think it is related to resource, batch and memory, problem. Infact you can use only delta queue if you select direct update, but you use this kind of update only for huge amount of data produced in a short period of time.
The two queue let you divide transaction moment to batch collection moment.
Hope this help.
Ciao.
Riccardo. -
Guys,
I need to update table A columns col3, col4, col5 and col6 by table b columns col3, col4, col5 and col6 however table b col5 and col6 values need to come from table c col1.
Means table b col5 and col6 have values in it however i need to replace them with value from table c col1 and need to update table a col5 and col6 accordingly.
table a and table b has col1 and col2 in common.
i am trying something like this.
Update a
a.col3 = b.col3,
a.col4 = b.col4,
a.col5 = (select col1 from table_c c where c.col2=b.col5),
a.col6 = (select col1 from table_c c where c.col2=b.col6)
from table_A a inner join table_b
on a.col1=b.col1 and a.col2=b.col2
can someone help me reframe above update query?
thanks in advance for your help.Try the below:(If you have multiple values, then you may need to use TOP 1 as commented code in the below script)
create Table tableA(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
Insert into tableA values(1,2,3,4,5,6)
create Table tableB(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
Insert into tableB values(1,2,30,40,50,60)
create Table tableC(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
Insert into tableC values(100,50,30,40,2,2)
--Insert into tableC values(200,50,30,40,2,2)
Insert into tableC values(100,60,30,40,2,2)
Select * From tablea
Update a Set
a.col3 = b.col3,
a.col4 = b.col4,
a.col5 = (select col1 from tablec c where c.col2=b.col5 ),
a.col6 = (select col1 from tablec c where c.col2=b.col6 )
from tableA a inner join tableb b
on a.col1=b.col1 and a.col2=b.col2
--Update a Set
--a.col3 = b.col3,
--a.col4 = b.col4,
--a.col5 = (select Top 1 col1 from tablec c where c.col2=b.col5 Order by c.Col1 asc),
--a.col6 = (select Top 1 col1 from tablec c where c.col2=b.col6 Order by c.Col1 asc)
--from tableA a inner join tableb b
--on a.col1=b.col1 and a.col2=b.col2
Select * From tablea
Drop table tablea,Tableb,TableC -
I'm using a view and am able to create a grid that allows editing of one of the columns. Let's call the table where the column is updated "DepartmentFeeDetail." The view has several joins but up till now the column was editable.
Today I needed to join DepartmentFeeDetail with itself to pick up the debit side of a debit/credit pair. I want to show the gl account number for both
the debit and credit on the same row. I also need to update the value for both debit and credit.
I can no longer edit the column to no surprise. When updating using MSSQLMS I get the following error:
View or function 'MyTestView' is not updatable because the modification affects multiple base tables.
What should my strategy be in lightswitch? The grid is populated by a query that includes my lynq expressions in DepartmentFeeRateQuery_PreprocessQuery. The query may return 1000+ rows. I need to allow the accountant to edit either a single row's column
or enter a value in a field outside the grid and click a button "Apply fee rate to entire page."
All this was working fine until the requirement to show the debit side gl account number and to change the debit side value somehow.
I've tried adding a property to DepartmentFeeDetail but the "Is Computed" property wouldn't allow me to uncheck it. Is there a way to add an editable property for each grid row and initialize it to the
current value of the column returned by the view? I could then update a collection when one of the fields changes. If they change the global value and press "Apply fee rate to entire page"
I can update the collection as well.
Scott MitchellWhat I do is instead of using a View I use a updatable
WCF RIA Service.
This is an example of an updateable method:
public void UpdateQuestionDetailForUser(QuestionDetailForUser objQuestionDetailForUser)
// Get the current user
string strCurrentUserName = System.Web.HttpContext.Current.User.Identity.Name;
// We are under Forms Authentication so if user is blank then we
// are debugging and we are TestUser
if (strCurrentUserName == "")
strCurrentUserName = "TestUser";
// Check for an existing Answer for this Question for this User
var objSurveyAnswer = (from SurveyAnswers in this.Context.SurveyAnswers
where SurveyAnswers.SurveyQuestion.Id == objQuestionDetailForUser.QuestionId
where SurveyAnswers.UserName == strCurrentUserName
select SurveyAnswers).FirstOrDefault();
if (objSurveyAnswer != null)
try // This is an update ****
// Set values
objSurveyAnswer.Choice = Convert.ToInt32(objQuestionDetailForUser.SelectedChoice);
objSurveyAnswer.Comment = objQuestionDetailForUser.Comments;
// Update LightSwitch Database
this.Context.SaveChanges(
System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
catch (Exception ex)
throw new Exception("Error inserting QuestionId " + objQuestionDetailForUser.QuestionId, ex);
else // This is an Insert ****
// Query the GetAllQuestionsForUser method because it calculates if a Question
// is Active or not for the QuestionId being inserted
// If it is not in the collection, do not allow the insert
var objUserQuestion = (from QuestionForUser in this.GetAllQuestionsForUser()
where QuestionForUser.UserName == strCurrentUserName
where QuestionForUser.QuestionId == objQuestionDetailForUser.QuestionId
select QuestionForUser).FirstOrDefault();
if (objUserQuestion != null)
try
// Get the Survey Question
var objSurveyQuestion = (from SurveyQuestions in this.Context.SurveyQuestions
where SurveyQuestions.Id == objQuestionDetailForUser.QuestionId
select SurveyQuestions).FirstOrDefault();
// Create a SurveyAnswer object
SurveyAnswer objNewSurveyAnswer = this.Context.CreateObject<SurveyAnswer>();
// Set values
objNewSurveyAnswer.UserName = strCurrentUserName;
objNewSurveyAnswer.Choice = Convert.ToInt32(objQuestionDetailForUser.SelectedChoice);
objNewSurveyAnswer.Comment = objQuestionDetailForUser.Comments;
objNewSurveyAnswer.SurveyQuestion = objSurveyQuestion;
// Update LightSwitch Database
this.Context.SurveyAnswers.AddObject(objNewSurveyAnswer);
this.Context.SaveChanges(
System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
catch (Exception ex)
throw new Exception("Error inserting QuestionId " + objQuestionDetailForUser.QuestionId, ex);
else
throw new Exception("Error inserting Answer. Answer is not marked Active.");
Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
http://LightSwitchHelpWebsite.com -
Update table using merge or Update statement
Hi All,
We have oracle 10G R2 On windows...
We have tables BROK_DEALER_MAP and DTRMIS_REPORT.
create table BROK_DEALER_MAP
SL_NO NUMBER,
BROK_DLR_CODE VARCHAR2(30),
EMP_TAG VARCHAR2(30),
REMARKS VARCHAR2(60),
CONS_CODE VARCHAR2(30),
BROK_DLR_NAME VARCHAR2(50),
BROKER_TYPE VARCHAR2(30),
BROK_DLR_0 VARCHAR2(30),
CATG_DESC VARCHAR2(60),
Category VARCHAR2(30));
desc DTRMIS_REPORT
SL_NO
POSTED_DATE
ZONE
AMC_REGION
CITY
BROK_DLR_CODE
BROK_DLR_NAME
SUB_BROKER
B_TYPE
FOLIO_NO
INVESTOR_NAME
TAX_NO
INV_TAG
SCHEME_CODE
SCHEME_NAME
SCH_CLASS
TRXN_MODE
CHN_TAG
FP_COUNT
FP_AMOUNT
AP_COUNT
AP_AMOUNT
PUR_COUNT
PUR_AMOUNT
SIP_COUNT
SIP_AMOUNT
SI_COUNT
SI_AMOUNT
RED_COUNT
RED_AMOUNT
SO_COUNT
SO_AMOUNT
DR_COUNT
DR_AMOUNT
STP_COUNT
STP_AMOUNT
NET_SALES
DISTRIBUTOR_TYPE
SCHEME_TYPE
FOCUS_PRODUCT
RM_CODE
RM_NAMEtable BROK_DEALER_MAP doesn't have any duplicate records.
table DTRMIS_REPORT have more than 2 lacks duplicate records.
Now i want to update table DTRMIS_REPORT (DISTRIBUTOR_TYPY COLUMN) With the values of BROK_DEALER_MAP (CATEGORY COLUMN).
For that i have written merge statement like below
merge into dtrmis_report a
using brok_dealer_map b
on (a.brok_dlr_code=b.cons_code)
when matched then
update set a.Distributor_type=b.category
where a.brok_dlr_code=b.cons_code;IT's giving error saying ORA-30926: unable to get a stable set of rows in the source tables.
How to update the table.
Please help.Chanchal Wankhade wrote:
IT's giving error saying ORA-30926: unable to get a stable set of rows in the source tables.That means there are duplicate records in your source table.
Please post the output of the below
select cons_code
from brok_dealer_map
group by cons_code
having count(*) > 1;In case of duplicate CONS_CODE, you need to decide with which the target table should get updated
And are you seriously giving a where condition in merge like you posted..?
Edited by: jeneesh on Dec 19, 2012 9:56 AM -
Function module or BAPI that is used to update the records in RBKP table.
Hello All,
Can anybody please give me the name of any Function module or BAPI that is used to update the records in RBKP table.
Please help me
I need to change the fiscal year in RBKP table
Thanks in Advance,
Regards,
LIJOHi,
You can use the BAPIs,
BAPI_ACC_INVOICE_RECEIPT_CHECK Accounting: Check Invoice Receipt (OAG: LOAD PAYABLE)
BAPI_ACC_INVOICE_RECEIPT_POST Accounting: Post Invoice Receipt (OAG: LOAD PAYABLE)
Hope this helps.
Regards,
Renjith Michael. -
Is it possible that my update stats used only correct tables?
Whenever there is a schedule maintenance run I receive a error:
Executing the query "UPDATE STATISTICS [Perf].[PerfHourly_F65954CD35A54..." failed with the following error: "Table 'PerfHourly_F65954CD35A549E886A48E53F148F277' does not exist.". Possible failure reasons: Problems with the query, "ResultSet"
property not set correctly, parameters not set correctly, or connection not established correctly.
Is it possible that my update stats used only correct tables?
ThanksUse below script ...(change if required)
USE [dbname]
go
DECLARE @mytable_id INT
DECLARE @mytable VARCHAR(100)
DECLARE @owner VARCHAR(128)
DECLARE @SQL VARCHAR(256)
SELECT @mytable_id = MIN(object_id)
FROM sys.tables WITH(NOLOCK)
WHERE is_ms_shipped = 0
WHILE @mytable_id IS NOT NULL
BEGIN
SELECT @owner = SCHEMA_NAME(schema_id), @mytable = name
FROM sys.tables
WHERE object_id = @mytable_id
SELECT @SQL = 'UPDATE STATISTICS '+ QUOTENAME(@owner) +'.' + QUOTENAME(@mytable) +' WITH ALL, FULLSCAN;'
Print @SQL
EXEC (@SQL)
SELECT @mytable_id = MIN(object_id)
FROM sys.tables WITH(NOLOCK)
WHERE object_id > @mytable_id
AND is_ms_shipped = 0
END
Or use below for required table only but it will not execute only generate script, make change as per ur requirements:
SELECT X.*,
ISNULL(CASE
WHEN X.[Total Rows]<=1000
THEN
CASE
WHEN [Percent Modified] >=20.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN --20% Small Table Rule'
END
WHEN [Percent Modified] = 100.00
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN --100% No real Stats Rule'
--WHEN X.[Rows Modified] > 1000
--THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN --1000 Rows Modified Rule'
ELSE
CASE
WHEN X.[Total Rows] > 1000000000 --billion rows
THEN CASE
WHEN [Percent Modified] > 0.1
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 1B Big Table Rule'
END
WHEN X.[Total Rows] > 100000000 --hundred million rows
THEN CASE
WHEN [Percent Modified] > 1.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 100M Big Table Rule'
END
WHEN X.[Total Rows] > 10000000 --ten million rows
THEN CASE
WHEN [Percent Modified] > 2.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 10M Big Table Rule'
END
WHEN X.[Total Rows] > 1000000 --million rows
THEN CASE
WHEN [Percent Modified] > 5.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 1M Big Table Rule'
END
WHEN X.[Total Rows] > 100000 --hundred thousand rows
THEN CASE
WHEN [Percent Modified] > 10.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 100K Big Table Rule'
END
WHEN X.[Total Rows] > 10000 --ten thousand rows
THEN CASE
WHEN [Percent Modified] > 20.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 10K Big Table Rule'
END
END
END,'') AS [Statistics SQL]
FROM (
SELECT DISTINCT
DB_NAME() AS [Database],
S.name AS [Schema Name],
T.name AS [Table Name],
I.rowmodctr AS [Rows Modified],
P.rows AS [Total Rows],
CASE
WHEN I.rowmodctr > P.rows
THEN 100
ELSE CONVERT(decimal(8,2),((I.rowmodctr * 1.0) / P.rows * 1.) * 100.0)
END AS [Percent Modified]
FROM
sys.partitions P
INNER JOIN sys.tables T ON P.object_Id = T.object_id
INNER JOIN sys.schemas S ON T.schema_id = S.schema_id
INNER JOIN sysindexes I ON P.object_id = I.id
WHERE P.index_id in (0,1)
AND I.rowmodctr > 0
) X
WHERE [Rows Modified] > 1000
ORDER BY [Rows Modified] DESC
Please click "Propose As Answer"
if a post solves your problem, or "Vote As Helpful" if a post has been useful
to you -
Updating ARDT table without using direct update statement
hi,
can any one guide me how to update REMARK field in the ADRT table without using direct UPDATE statement. It would be helpful if any one can tell me the bapi or a function module with a sample code.Hi
<b>SZA0 Business Address Services (w/o Dialog) </b> ADDR_PERSONAL_UPDATE
ADDR_PERSON_UPDATE
ADDR_PERS_COMP_UPDATE
ADDR_UPDATE
these are the four function modules which will update the (Business Address Services) reward if usefull
check these is there any help ful for u or not -
How to update multiple row using procedure in table
Hi,
create or replace procedure TESTLEDGER1(var_date varchar2)
as
var_date1 date;
CURSOR C1 IS
select DISTINCT ta.accountid,day PROCESSDATE,
(NVL(payment,0))PAYMENT,NVL(TOTALDUE,0)TOTALDUE,NVL(currentbillamount,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_v2
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,REFUND,trunc(createdate) createdate FROM vwrefund)F,
( SELECT ACCOUNTID,
TRUNC(CREATEDATE)CREATEDATE,
sum(TOTALDUE)/100 TOTALDUE,sum(currentbillamount)currentbillamount
FROM SYNTBLTDEBITDOCUMENT
group by ACCOUNTID, TRUNC(createdate))debit,
(SELECT ACCOUNTID accountid,TRUNC(createdate)CREATEDATE, SUM(totalamount)PAYMENT
from syntbltcreditdocument
where CREDITDOCUMENTTYPEID IN ('CDT01','CDT04')
-- AND ACCOUNTID='ACC000003014'
group by accountid,TRUNC(createdate))credit
where ta.accountid=a.accountid(+)
and ta.accountid=b.accountid(+)
--and ta.accountid=pay.accountid(+)
and ta.accountid=debit.accountid(+)
and ta.accountid=credit.accountid(+)
and ta.accountid=f.accountid(+)
and ta.day=a.fromdate(+)
--and ta.day=pay.createdate(+)
and ta.day=debit.createdate(+)
and ta.day=credit.createdate(+)
and ta.day=b.paymentdate(+)
and ta.day=f.createdate(+)
and trunc(ta.day)=to_date(var_date,'DD-MON-YY');
begin
select distinct processdate into var_date1 from ledgerdetail;
FOR V1 IN C1 LOOP
UPDATE LEDGERDETAILtest
SET PAYMENT=v1.payment,
TOTALDUE=v1.TOTALDUE,
CURBILL=v1.curbill,
SRF=v1.srf,
SBPNT=v1.sbpnt,
SRV=v1.srv,
SBF=v1.sbf,
SBV=v1.sbv,
EF=v1.ef,
EV=v1.ev,
TSRV=v1.tsrv,
TSUB=v1.tsub,
TEQE=v1.teqe,
DT=v1.dt,
PDEP=v1.rdep,
PNT=v1.pnt,
EQP=v1.eqp,
DTR=v1.dtr,
DRF=v1.drf,
UNADJ=v1.unadj
where accountid=v1.accountid
and processdate=v1.processdate;
--DBMS_OUTPUT.PUT_LINE('INSERTED ROW');
commit;
end loop;
end;
I have created above procedure to update table column....but i am getting run time error....
Error report:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "CRESTELVIEWSPRD501.TESTLEDGER1", line 70
ORA-06512: at line 1
01422. 00000 - "exact fetch returns more than requested number of rows"
*Cause: The number specified in exact fetch is less than the rows returned.
*Action: Rewrite the query or change number of rows requested
how to resolve this error...
Pl give me solution...
thanks in advance.Hi:
You have to make sure that join condition joins one record to one record not to a group of records.
Saad,
http://saadnayef.blogspot.com/ -
Error in updating table J_1PART2
Hi,
I am getting an error while saving the excise invoice as 'error in updating table J_1PART2'.
What would have gone wrong?????? please help!!!
Thanks ,
RamyaDiscussion moved from SAP ERP Sales and Distribution (SAP SD) to Internationalization and Unicode
Please use Internationalization and Unicode for you CIN related queries -
Error in updating table J_1IEXCHDR,J_1IEXCDTL in tcode J1IJ
Hi,
while cancelling excise invoice in Tcode J1IJ ,
we are getting 'error in updating table J_1IEXCHDR,J_1IEXCDTL'.
what is missing or tell the procedure to resolve the issue.
Regards,Discussion moved from SAP ERP Sales and Distribution (SAP SD) to Internationalization and Unicode
Please use Internationalization and Unicode for you CIN related queries -
Bapi : BAPI_ALM_ORDER_MAINTAIN not updating table AFVU-USR08
Hi,
I have a requirement to update table AFVU-USR08.I am actualy dealing with tcode IW32/IW33 where in we need to update operation-->enhancement tab.I am using BAPI : BAPI_ALM_ORDER_MAINTAIN to do this.I am testing the BAPI directly( Not called in any program ),I can see a message like so and so order saved under notification,But there is no entry in table AFVU-USR08.
If any one have come across this prob. and got the sol. Pl. share it with me.
Your solution will be more helpful.
Thanks,
Bharani.Hi Ferry,
1. I have also tried ur given code before BAPI_TRANSACTION_COMMIT.
l_fname = 'SOBKZ'.
l_fvalue = 'U'.
CALL FUNCTION 'CO_BH_MOD_SINGLE_FIELDS'
EXPORTING
aufnr_imp = wa_meth-objectkey(12)
field1 = l_fname
value1 = l_fvalue.
but this program is giving dump for only this particular Value saying that This is PROTECTED field.
Can anyone help me out on How to Update Special Stock Indicator on Components Tab of Maintenance Order (IW32).
If anyone has faced such type of problem & solved it then please let me also.
2. Which BADI to use for Updating Special Stock Indicator when we press enter on Components tab in Transaction IW32 ?..
Thanks in advance,
Hope to get the solution soon from all SAP gurus.
and help will be appriciated .
Gaurav. -
How can I use the update operation in a VC Model
Hello experts,
i try to to use the update operation in my VC model. I have developed an AS wich return a table. Now i want to update a table row. So I add the update operation to my model. But it doesn´t work. I mapped all attribute between the table and the update service. The event name is submit.
Another strange thing is: If i try to update in the service browser it cames the error message that the vandatory attribute ... is missing.
Any ideas??
Thanks
MarcoHi Marco,
In this case it is possible that your update service requires a mandatory parameter which you are not providing.
When you drag your service onto the VC screen, right click on the service and test it.It will give you a clear picture of which parameters are required by the service and besides you can also use some test data to check if the service is working properly.
Do let me know if this helps.
Thanks,
Gaurav. -
How to use the updated value in the same update statement
Hello,
I just wonder how to use the updated new value of other column in the same udpate statement. I am using Oracle 11.2, and want to update the two columns with one update statement as following:
create table tb_test (id number(5), tot number(5), mon_tot number(5));
update tb_test set (tot = 15, mon_tot = tot *15) where id = 1;
...I would like to update both tot and mon_tot column, the value of mon_tot shall be determinted by the new value of tot.
Thanks,
Edited by: 939569 on 1-Feb-2013 7:00 AMEdit: example added
SQL> create table tb_test
2 ( id number(5)
3 , tot number(5)
4 , mon_tot number generated always as (tot*15) virtual
5 );
Table created.
SQL> insert into tb_test (id, tot) values (1, 5);
1 row created.
SQL> select * from tb_test;
ID TOT MON_TOT
1 5 75
1 row selected.
SQL> update tb_test
2 set tot = 15
3 where id = 1;
1 row updated.
SQL> select * from tb_test;
ID TOT MON_TOT
1 15 225
1 row selected. -
Creating a better update table statement
Hello,
I have the following update table statement that I would like to make more effecient. This thing is taking forever. A little background. The source table/views are not indexed and the larger of the two only has 150k records. Any ideas on making more effecient would be appreciate.
Thanks.
Ryan
Script:
DECLARE
V_EID_CIV_ID SBI_EID_W_VALID_ANUM_V.SUBJECT_KEY%TYPE;
V_EID_DOE DATE;
V_EID_POE SBI_EID_W_VALID_ANUM_V.POINT_OF_ENTRY%TYPE;
V_EID_APPR_DATE DATE;
V_CASE_CIV_ID SBI_DACS_CASE_RECORDS.CASE_EID_CIV_ID%TYPE;
V_CASE_DOE DATE;
V_CASE_POE SBI_DACS_CASE_RECORDS.CASE_CODE_ENTRY_PLACE%TYPE;
V_CASE_APPR_DATE DATE;
V_CASE_DEPART_DATE DATE;
V_SBI_UPDATE_STEP SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP%TYPE;
V_SBI_CIV_ID SBI_DACS_CASE_RECORDS.SBI_CIV_ID%TYPE;
CURSOR VALID_CIV_ID_FROM_EID IS
SELECT EID.SUBJECT_KEY,
TO_DATE(EID.PROCESS_ENTRY_DATE),
EID.POINT_OF_ENTRY,
TO_DATE(EID.APPREHENSION_DATE),
DACS.CASE_EID_CIV_ID,
TO_DATE(DACS.CASE_DATE_OF_ENTRY,'YYYYMMDD'),
DACS.CASE_CODE_ENTRY_PLACE,
TO_DATE(DACS.CASE_DATE_APPR,'YYYYMMDD'),
TO_DATE(DACS.CASE_DATE_DEPARTED,'YYYYMMDD'),
DACS.SBI_UPDATE_STEP,
DACS.SBI_CIV_ID
FROM SBI_EID_W_VALID_ANUM_V EID,
SBI_DACS_CASE_RECORDS DACS
WHERE DACS.CASE_NBR_A = EID.ALIEN_FILE_NUMBER;
BEGIN
OPEN VALID_CIV_ID_FROM_EID;
SAVEPOINT A;
LOOP
FETCH VALID_CIV_ID_FROM_EID INTO V_EID_CIV_ID, V_EID_DOE, V_EID_POE,V_EID_APPR_DATE,V_CASE_CIV_ID, V_CASE_DOE,V_CASE_POE,V_CASE_APPR_DATE,V_CASE_DEPART_DATE,V_SBI_UPDATE_STEP,V_SBI_CIV_ID;
DBMS_OUTPUT.PUT_LINE('BEFORE');
EXIT WHEN VALID_CIV_ID_FROM_EID%FOUND;
DBMS_OUTPUT.PUT_LINE('AFTER');
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_CASE_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 1
WHERE V_CASE_CIV_ID IS NOT NULL
AND V_CASE_CIV_ID <> 0;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 2
WHERE V_SBI_CIV_ID IS NULL AND V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE = V_CASE_POE
AND V_EID_APPR_DATE = V_CASE_APPR_DATE
AND V_EID_APPR_DATE = V_CASE_DEPART_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 3
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE = V_CASE_POE
AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 4
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE = V_CASE_POE
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4 ;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 5
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE <> V_CASE_POE
AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 6
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_POE = V_CASE_POE
AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 7
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 8
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 9
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE = V_CASE_POE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 10
WHERE V_SBI_UPDATE_STEP = 0
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;
END LOOP;
CLOSE VALID_CIV_ID_FROM_EID;
COMMIT;
END;
-----Thats it. Thanks for your help.
RyanPlease use [ code] or [ pre] tags to format code before posing:
DECLARE
V_EID_CIV_ID SBI_EID_W_VALID_ANUM_V.SUBJECT_KEY%TYPE;
V_EID_DOE DATE;
V_EID_POE SBI_EID_W_VALID_ANUM_V.POINT_OF_ENTRY%TYPE;
V_EID_APPR_DATE DATE;
V_CASE_CIV_ID SBI_DACS_CASE_RECORDS.CASE_EID_CIV_ID%TYPE;
V_CASE_DOE DATE;
V_CASE_POE SBI_DACS_CASE_RECORDS.CASE_CODE_ENTRY_PLACE%TYPE;
V_CASE_APPR_DATE DATE;
V_CASE_DEPART_DATE DATE;
V_SBI_UPDATE_STEP SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP%TYPE;
V_SBI_CIV_ID SBI_DACS_CASE_RECORDS.SBI_CIV_ID%TYPE;
CURSOR VALID_CIV_ID_FROM_EID IS
SELECT EID.SUBJECT_KEY,
TO_DATE(EID.PROCESS_ENTRY_DATE),
EID.POINT_OF_ENTRY,
TO_DATE(EID.APPREHENSION_DATE),
DACS.CASE_EID_CIV_ID,
TO_DATE(DACS.CASE_DATE_OF_ENTRY,'YYYYMMDD'),
DACS.CASE_CODE_ENTRY_PLACE,
TO_DATE(DACS.CASE_DATE_APPR,'YYYYMMDD'),
TO_DATE(DACS.CASE_DATE_DEPARTED,'YYYYMMDD'),
DACS.SBI_UPDATE_STEP,
DACS.SBI_CIV_ID
FROM SBI_EID_W_VALID_ANUM_V EID,
SBI_DACS_CASE_RECORDS DACS
WHERE DACS.CASE_NBR_A = EID.ALIEN_FILE_NUMBER;
BEGIN
OPEN VALID_CIV_ID_FROM_EID;
SAVEPOINT A;
LOOP
FETCH VALID_CIV_ID_FROM_EID INTO V_EID_CIV_ID, V_EID_DOE,
V_EID_POE,V_EID_APPR_DATE,V_CASE_CIV_ID, V_CASE_DOE,
V_CASE_POE,V_CASE_APPR_DATE,V_CASE_DEPART_DATE,V_SBI_UPDATE_STEP,V_SBI_CIV_ID;
DBMS_OUTPUT.PUT_LINE('BEFORE');
EXIT WHEN VALID_CIV_ID_FROM_EID%FOUND;
DBMS_OUTPUT.PUT_LINE('AFTER');
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_CASE_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 1
WHERE V_CASE_CIV_ID IS NOT NULL
AND V_CASE_CIV_ID <> 0;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 2
WHERE V_SBI_CIV_ID IS NULL AND V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE = V_CASE_POE
AND V_EID_APPR_DATE = V_CASE_APPR_DATE
AND V_EID_APPR_DATE = V_CASE_DEPART_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 3
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE = V_CASE_POE
AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 4
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE = V_CASE_POE
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4 ;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 5
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE <> V_CASE_POE
AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 6
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_POE = V_CASE_POE
AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 7
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 8
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 9
WHERE V_SBI_UPDATE_STEP = 0
AND V_EID_DOE = V_CASE_DOE
AND V_EID_POE = V_CASE_POE;
UPDATE SBI_DACS_CASE_RECORDS
SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 10
WHERE V_SBI_UPDATE_STEP = 0
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;
END LOOP;
CLOSE VALID_CIV_ID_FROM_EID;
COMMIT;
END;Peter D.
Maybe you are looking for
-
Payroll Error....
Hello Experts, I have an issue while I am running payroll.... Issue is as follows....... there are semi-monthly employees..... for whome the payment date for 24th pay period (16/12/2009-31/12/2009) is on 05/01/2010. But when I am running the payroll
-
How can I get print dialog box to show accurately?
My print dialog box shows the image too large. If I go to print it prints correctly. I have tried updating drivers and reinstalling Illustrator. It has been happening since new update to CC.
-
Migrating Best-bets and Visual Best-bets to SharePoint Online
Hello Experts, I understood that ther is a promoted result feature in the query rules section that can be used as an equivalent of FAST best-bets and visual best-bets. But in our FAST search 2010, we have close to 2000 of them. How is it possible to
-
Flash MX 2004 and Zoomify3.0 custom buttons
Hi all, I am using Flash MX 2004 and Zoomify3.0. Anyone know how or where i can find tutorials on how to change the zoomify standardtoolbar into custom buttons in flash mx buttons? Zoomify website makes it sound easy but they dont tell you how. Thank
-
Hello Can anyone help me with this one I have a client that creates a SOAP header. I have some server-side code that creates a string value. Can someone tell me how I pass back the string value to my client SOAP header. I'm using Apache AXIS Many Tha