Update query doubt
I have table with two columns as given below ....
Name sex
ab m
ac m
ad m
ae m
ba f
bb f
bc f
bd f
I have to change all 'm' to 'f' and all 'f' to 'm'..... I have tried this using rowid and collection and I was able to do this. Is there other way to do this with simple SQL query????? Please somebody help....
thanks in advance
Prabu.....
update your_table
set s_e_x = (case s_e_x
when 'm' then 'f'
when 'f' then 'm'
end
where s_e_x in ('m','f');
Similar Messages
-
I have a problem using update query, for updating one column in a table with another column in another table. For eg say i have two tables, collector and survey
Fields in Collector:
col_n_account_num
col_v_email
col_n_phone_number
Fields in survey
sur_v_question_id
sur_n_account_num
sur_v_response
update collector
case when sur_v_question_id=collector_email then col_v_email=sur_v_response end,
case when sur_v_question_id=collector_phone then col_n_phone_number=sur_v_response end
Thanks in advance
Regards,
sswrite two simple update statements
update collector set col_v_email =
(select sur_v_response from survey
where sur_v_question_id=collector_email )
and
update collector set col_n_phone_number =
(select sur_v_response from survey
where sur_v_question_id=collector_phone) -
Wriet Back --- Update query issue
Hi Freinz,
I have a requirement where user needs to write back some values.
The table (product_tbl) that has to be update is of the following staructure.
col 0:Product
col 1:Actual Rev
col 2:Derived Rev
col 3:Estimated Rev
i have enabled write back for col 1, col 2 , col 3 ...
Also in the write back template i have the insert query as" Insert into product_tbl (Actual Rev,Derived Rev,Estimated Rev) values (@{c1},@{c2},@{c3}) "
I am supposed to have a update query also ...
My doubt is as below...
Product is the key column and this colum is not editable.
How shud my update query look like..as user will be entrying the values based on the product field..
Apprecaite ur immediate help..
Many Thanks,
Mithu...Hi,
Try this:
UPDATE produc_tbl
SET Actual Rev = {@1} ,
Derived Rev = {@2},
Estimated Rev = {@3}
WHERE
PRODUCT = @{@0}
Regards John
http://obiee101.blogspot.com/ -
Optimization of Update Query???
Hello guys!
I just finished writing an update query, which works but takes forever (approximately 20-30 seconds). Do you have any ideas how it can be optimized in order to run faster? Would it be reccomendable to create a new view that includes only the required columns for the Inner-Select Statement? Right now there are about 20 columns in VT_TBL_PUNKTDATEN_JOIN. Could the statement be written differently to speed up the execution???
Here is the statement:
begin
UPDATE TBL_PUNKTDATEN v SET v.INT_ZAEHLFAKTOR_BESTAND = :P700_INT_ZAEHLFAKTOR_BESTAND
WHERE EXISTS (SELECT p.INV_PT_ID_SUB FROM VT_PUNKTDATEN_JOIN p WHERE
(p.STR_GEBIET_MAIN = :P700_STR_GEBIET) and (p.STR_LRT_MAIN = :P700_STR_LRT) and (v.INV_PT_ID_SUB = p.INV_PT_ID_SUB));
end;I'm really curious if you have any solution for this!
I Appreciate your effort!
Bye,
Sebastianskahlert wrote:
@ Sven W.
I receive an ORA-01779 error (cannot modify a column which maps to a non key-preserved table).I thought that this would happen (based on your table names), but it was worth a try.
The problem is which table is the parent and which one is the child table. When joining two tables via a foreign key relationship the child table will be the so-called key-preserved table. This means one row from the source table can be matched to exactly one row in the joined output (=view).
In your case you can't use the update construct I suggested. It would work if you want to update the other table p.
However you could measure how long the join select is running and compare that to the update part. This can give a first indication if the select is slow or the update.
A further try can be to change the correlated subquery into an uncorrelated subquery. I doubt that this will help since the oracle optimzier can do this transformation by itself. Other than that you need to give us more information about table sizes and execution plans. You can always trace the update and see where the time is spent.
uncorrelated
UPDATE TBL_PUNKTDATEN v
SET v.INT_ZAEHLFAKTOR_BESTAND = :P700_INT_ZAEHLFAKTOR_BESTAND
WHERE v.INV_PT_ID_SUB IN (SELECT p.INV_PT_ID_SUB FROM VT_PUNKTDATEN_JOIN p
WHERE p.STR_GEBIET_MAIN = :P700_STR_GEBIET
and p.STR_LRT_MAIN = :P700_STR_LRT);Edited by: Sven W. on Aug 19, 2009 1:17 PM -
I was wondering if you could have a cfif statement inside of a update query. See example below. Is there a better way of doing it? thanks.
<cfquery DATASOURCE="xxx" name="update">
UPDATE plant_gen_info
SET levels_complete = #URL.var0#
<cfif IsDefined("URLvar13">
,Q1_answer = #URL.var13#
</cfif>
WHERE ID = #session.member_id#
</cfquery>TheScarecrow,
Yes, dynamic query statements can be assembled using <cfif>. I would suggest you switch your IsDefined() to a StructKeyExists() and strongly suggest you make good use of <cfqueryparam>:
<cfquery DATASOURCE="xxx" name="update">
UPDATE plant_gen_info
SET levels_complete = <cfqueryparam value="#URL.var0#" cfsqltype="****">
<cfif StructKeyExists(URL, "var13")>
,Q1_answer = <cfqueryparam value="#URL.var13#" cfsqltype="****">
</cfif>
WHERE ID = <cfqueryparam value="#session.member_id#" cfsqltype="****">
</cfquery>
I put a "****" placeholder for cfsqltype attributes because I'm not sure which would be appropriate for your variables. See the help docs for more on the cfqueryparam and cfsqltype.
-Carl V. -
Insert and update query to calculate the opening and closing balance
create table purchase(productid number(5) ,dateofpurchase date,
qty number(5));
create table inventory(invid number(5),productid number(5),
idate date,openingqty number(5),closingqty number(5));
Records in inventory:
1,1,'01-jan-2009', 10, 20
2,1,'03-jan-2009', 20, 30
3,1,'04-jan-2009', 40, 50
when I enter the purchase invoice for 15 qty on 02-jan-2009
after say '15-jan-09' , a new record should get inserted
with opening balance = (closing balance before 02-jan-2009)
and all the opening and closing balance for that product should
get affected.
If the invoice for 20 qty is entered for the existing date say
'03-jan-2009' in inventory , then the closing balance
for 03-jan-2009 should get updated and all the following records
should get affected.
I need the insert for the first one and update query for the
second one.
Vinodh<strike>You can do this in one statement by using the merge statement</strike>
Hmm, maybe I spoke too soon.
Edited by: Boneist on 25-Sep-2009 13:56
Thinking about it, why do you want to design your system like this?
Why not simply have your purchases table hold the required information and then either work out the inventory on the fly, or have a job that calls a procedure to add a row for the previous day?
If you continue with this design, you're opening yourself up to a world of pain - what happens when the data doesn't match the purchases table? Also when is the inventory cut-off to reset the opening/closing balances? Monthly? Annually? Weekly? If it's set to one of those, what happens when the business request the inventory for a particular week?
Edited by: Boneist on 25-Sep-2009 13:59 -
Hello,
I was hoping anyone could provide ideas on the best way to do an update query based on an if then else statement I am using Oracle 11 on a linux server. I am writing within a perl script. I've researched online and saw some examples using case. Below is the basic query logic I am trying to implement. I would really appreciate any suggestions.
Thanks,
JC
If the MAINT_CENTER IN ('ENOC1CENTER','PMCTGAAHSDC','ATTCSPCRT01','ATTCSPCWS01','NTNLWHS4NSA') AND CAC1=’S’ and substring(CKT_ID,4,2) IN ('KQ','KR','KS','KP','L1','L2','L3','VL') and askme_temp.CKT_ID = heci.CKT_ID then SUBPRODUCT =’IPAG’
ELSE If the MAINT_CENTER IN ('ENOC1CENTER','PMCTGAAHSDC','ATTCSPCRT01','ATTCSPCWS01','NTNLWHS4NSA') AND CAC1=’S’ and substring(CKT_ID,4,2) IN ('KQ','KR','KS','KP','L1','L2','L3','VL') AND REGION=’SE’ then SUBPRODUCT =’METRO_E’
ELSE If the MAINT_CENTER IN ('ENOC1CENTER','PMCTGAAHSDC','ATTCSPCRT01','ATTCSPCWS01','NTNLWHS4NSA') AND CAC1=’S’ and substring(CKT_ID,4,2) IN ('KQ','KR','KS','KP','L1','L2','L3','VL') then SUBPRODUCT =’OPT_E_MAN’Hi,
Welcome to the forum!
CASE sounds like a good idea to me.
For example:
UPDATE table_x
SET subproduct = CASE
WHEN askme_temp.CKT_ID = heci.CKT_ID
THEN 'IPAG'
WHEN region = 'SE'
THEN 'METRO_E'
ELSE 'OPT_E_MAN'
END
WHERE maint_center IN ( 'ENOC1CENTER'
, 'PMCTGAAHSDC'
, 'ATTCSPCRT01'
, 'ATTCSPCWS01'
, 'NTNLWHS4NSA'
AND cac1 = 'S'
AND SUBST (ckt_id, 4, 2) IN ('KQ', 'KR', 'KS', 'KP', 'L1', 'L2', 'L3', 'VL')
AND ...
;CASE expressions are evaluated in the order in which you write them, so if askme_temp.ckt_id = heci.ckt_id (whatever those things are), subproduct will be set to 'IPAG'. It won't matter whether region is 'METRO_E' or not; if the 1st condition is TRUE, the first THEN value is returned, and the other WHEN expressions aren't even evaluated.
What do you want to do if none of those conditions are met?
Any conditions that are common to all the rows being UPDATEd can be put in the WHERE clause; they don't have to be repeated in the CASE expression.
Remember, MERGE is often more convenient to use than UPDATE.
Edited by: Frank Kulash on Jul 27, 2011 3:23 PM -
Hello :),
I am a MS SQL Server expert [;)]. trying to learn ORACLE.
I tried to assign some value to a variable in an update query. I got error message that virtual columns are not allowed. This is very important to get rolling effect.
Can some one please guide me about how to get rolling effect if we can not assign a value to a variable in an update query.
Thanx in advance.
Nishuhello sgalaxy and gintsp, thanx for ur reply.
My reply is so late because for some reason I was not able to log on to this site.
There is some good reason why I need this. I am giving code and error messages below, please guide me.
==============================
I am trying this thing in procedure. I am using ORACLE DATABASE EXPRESS EDITION
Here is the code.
create or replace procedure "PROC1"
is
TYPE Bal_Collect IS TABLE OF NUMBER;
Collt Bal_Collect := Bal_Collect(100);
begin
Update empAccount Set Bal = Collt(Collt.Last) Returning Bal BULK COLLECT INTO Collt;
end;
Error message
Compilation failed,line 6 (02:20:45)
PLS-00425: in SQL, function argument and return types must be SQL type
Compilation failed,line 6 (02:20:45)
PL/SQL: ORA-00904: : invalid identifier
Compilation failed,line 6 (02:20:45)
PL/SQL: SQL Statement ignored
BUT FOLLOWING UPDATE STATEMENT WORKS
Update empAccount Set Bal = Collt(1) Returning Bal BULK COLLECT INTO Collt; -
Update query not working from edit page
Next incident with the guestbook saga:
Successful execution of gb_entry_mstr_det_e.cfm with URL:
http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=14 all have database current info...this is good, but:
textboxes
Problem 1:
the SELECT field does not does not reflect/display the correct option I know exists in the database
the database field whence this SELECT object is supposed to display is a number, not text.
now,...
Problem 2:
Clicked on "Update Your Entry" button at bottom of edit page (to update by going to gb_confirm_update.cfm)
<INPUT
TYPE="submit"
NAME="submit"
VALUE="Update Your Entry">
then, arriving at the gb_confirm_update.cfm page, ...
Got an error (below) executing the page: gb_confirm_update.cfm with resulting URL:
http://www.benoitsystems.com/ww/bd/gb/gb_confirm_update.cfm?call_number=#gb_entryID#
--- snippet from template gb_confirm_update.cfm
<CFQUERY DATASOURCE="9130.ww" NAME="ww_gb_ud">
UPDATE gb_entries
SET
gb_entry_stts_='form.gb_entry_stts_',
gb_entry_nm_f='form.gb_entry_nm_f',
gb_entry_nm_l='form.gb_entry_nm_l',
gb_entry_nm_l_dspl_x=form.gb_entry_nm_l_dspl_x,
gb_entry_tce='form.gb_entry_tce',
gb_entry_tce_dspl_x=form.gb_entry_tce_dspl_x,
gb_entry_cy='form.gb_entry_cy',
gb_entry_stt='form.gb_entry_stt',
gb_entry_instr='form.gb_entry_instr',
gb_entry_m='form.gb_entry_m',
gb_entry_del_x=form.gb_entry_del_x
WHERE gb_entryID=form.gb_entryID
</CFQUERY>
--- end snippet ---
=================================================
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4.
The error occurred in E:\benoitsystems.com\wwwroot\ww\bd\gb\gb_confirm_update.cfm: line 2
1 : <!--- <CFUPDATE DATASOURCE="9130.ww" TABLENAME="gb_entries"> --->
2 : <CFQUERY DATASOURCE="9130.ww" NAME="ww_gb_ud">
3 : UPDATE gb_entries
4 : SET
SQL UPDATE gb_entries SET gb_entry_stts_='form.gb_entry_stts_', gb_entry_nm_f='form.gb_entry_nm_f', gb_entry_nm_l='form.gb_entry_nm_l', gb_entry_nm_l_dspl_x=form.gb_entry_nm_l_dspl_x, gb_entry_tce='form.gb_entry_tce', gb_entry_tce_dspl_x=form.gb_entry_tce_dspl_x, gb_entry_cy='form.gb_entry_cy', gb_entry_stt='form.gb_entry_stt', gb_entry_instr='form.gb_entry_instr', gb_entry_m='form.gb_entry_m', gb_entry_del_x=form.gb_entry_del_x WHERE gb_entryID=form.gb_entryID
DATASOURCE 9130.ww
VENDORERRORCODE -3010
SQLSTATE 07002
Please try the following:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Remote Address 71.233.234.226
Referrer http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=14
Date/Time 21-Jul-10 03:11 PM
=================================================
I have every NAME of each object matching, verbatum, in the UPDATE query, and every database field name correct in teh query also.I was encouraged to send snippets in an another submission, and now I believe it is best that I "lay my cards on the table"
Here's my hand:
Pages in question for your review:
http://www.benoitsystems.com/ww/bd/gb/gb_mstr.cfm click on the pencil (the toilet will delete the record.
http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=21 go to bottom of webpage and click “Update Your Entry”
http://www.benoitsystems.com/ww/bd/gb/gb_confirm_update.cfm?call_number=#gb_entryID#
In your review of the above (should you choose) before clicking on the pencil, look at the status on the master listing record you will be editing, and feel free to edit. Most statuses will be “Hold”
Two dummy MS Access database tables:
Table 1: "gb_entries" (Guestbook)
field 1: gb_entries_ID (Autonumber - Long Integer)
field 2: gb_entries_dt (date/time)
field 3: gb_entries_nm_f (Text)
field 4: gb_entries_nm_l (Text)
field 5: gb_entries_nm_stts_ (Number field - Byte (not bit)) (fed by gb_sttsID)
couple other text fields
field 6: gb_entries_em (Text)
field 7: gb_entries_cy (Text)
field 8: gb_entries_stt (Text)
field 9: gb_entries_nm_l_dspl (Yes/No or True/False)
field 10: gb_entries_m (Memo type)
Table 2: "gb_stts_rf" (Guestbook Status Reference)
field 1: gb_sttsID (Autonumber - Long Integer)
field 2: gb_stts (Text)
Two Templates:
This is the edit page (where a person with administrative access may edit the status or change the spelling for someone, etc.):
<!--- This query fills the form with the chosen record data (except for the darned SELECT object) ---> <CFQUERY NAME="edit_entry" DATASOURCE="9130.ww"> SELECT * FROM gb_entries WHERE #call_number#=gb_entryID </CFQUERY>
<!--- This query is for the select dropdown of guestbook status options (set to default on “Hold” from gb_nw.cfm) ---> <CFQUERY NAME="q_stts" DATASOURCE="9130.ww"> SELECT * FROM gb_stts_rf </CFQUERY>
<HTML>
<HEAD>
<TITLE>Woodwindology Guestbook Entry Edit Page</TITLE> <CFOUTPUT QUERY="incl_css_bd">#incl_code#</CFOUTPUT>
</HEAD>
<BODY
BGPROPERTIES="fixed">
<DIV ALIGN="center">
<IMG
SRC="<CFOUTPUT>#baseurl#</CFOUTPUT>md/img/ut/ttl/pg/guestbook.gif"
BORDER="0">
<BR>
<IMG
SRC="<CFOUTPUT>#baseurl#</CFOUTPUT>md/img/ut/ttl/sub/edit_entry.gif"
BORDER="0">
<BR>
Developer View
</DIV>
<TABLE>
<TR>
<TD>
<TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="5"
CELLSPACING="0">
<TR>
<TD VALIGN="top">
<FORM
NAME="f_gb_entry_mstr"
ACTION="gb_confirm_update.cfm?call_number=#gb_entryID#"
METHOD="post">
<CFOUTPUT QUERY="edit_entry">
<B>Entry ID:</B>
#gb_entryID#
<INPUT
TYPE="hidden"
NAME="gb_entryID"
VALUE="#gb_entryID#">
<P>
<B>Entry Date and Time:</B>
#DateFormat("#gb_entry_dt#","mmmm d, yyyy")# #TimeFormat("#gb_entry_dt#","h:mm tt")#
<P>
<B>Entry Status:</B>
<SELECT
NAME="gb_entry_stts_"
VALUE="#gb_entry_stts_#">
</CFOUTPUT>
<CFOUTPUT QUERY="q_stts">
<OPTION VALUE="#gb_sttsID#">#gb_stts#</OPTION>
</CFOUTPUT>
</SELECT>
<P>
<CFOUTPUT QUERY="edit_entry">
<B>Guest's First Name:</B>
<INPUT
TYPE="text"
NAME="gb_entry_nm_f"
VALUE="#gb_entry_nm_f#">
<P>
<B>Guest's Last Name:</B>
<INPUT
TYPE="text"
NAME="gb_entry_nm_l"
VALUE="#gb_entry_nm_l#">
<BR>
Display Last Name:
<INPUT
TYPE="radio"
NAME="gb_entry_nm_l_dspl_x"
VALUE="Yes">
Do Not Display Last Name:
<INPUT
TYPE="radio"
NAME="gb_entry_nm_l_dspl_x"
VALUE="no">
<P>
<B>Your Email Address:</B><BR>
<INPUT
TYPE="text"
NAME="gb_entry_tce"
VALUE="#gb_entry_tce#"
SIZE="40"
MAXLENGTH="40">
<BR>
Uncheck the box to keep email private:
<INPUT
TYPE="checkbox"
NAME="gb_entry_tce_dspl_x"
VALUE="#gb_entry_tce_dspl_x#">
<P>
<SPAN CLASS="emph01">*</SPAN> Your City:
<INPUT
TYPE="text"
NAME="gb_entry_cy"
VALUE="#gb_entry_cy#"
SIZE="30">
<P>
<SPAN CLASS="emph01">*</SPAN> Your State:
<INPUT
TYPE="text"
NAME="gb_entry_stt"
VALUE="#gb_entry_stt#"
SIZE="30">
<BR>
<B>Instruments Played:</B>
<BR>
<TEXTAREA
COLS="45"
MAX="50" -
Sender jdbc adapter - no update query
hi ,
i am using pi 731 single stack.
the scenario is - PI has to pick data from view of a hana database. i am using jdbc sender for it.
pi will not have access to update the table,only pi can read the view of database.So,PI can't use UPDATE query.
If in jdbc sender channel ,I use SELECT query only and no UPDATE query - will it work ? what will happen if there are 100 records in the view and PI failed after fetching 43 records..will it pick from 44th record next time OR it will start from 0 again ?
rgdsHi SAP PI,
It has no sense to use the sender JDBC without update query because then always will be taken the same records.
If you cant update the source DB you only have the choice to talk with the DB administrators that they develop for you a stored procedure that it has to do the work to get different records in every PI access.
If the PI record process fail with impossible source database update update, the only way (afaik) is to do a PI alert and to communicate it to db sender administrators. There are another option like to store the data in a intermediate table, and so on but all possibilities that i can think now are not to enough good.
Regards. -
Update query not working in the JDBC sender Communication channel
Hi,
We are working on JDBC to File scenario. As per the configuration, XI should pick the data from SQL database every 20 secs and should update the corresponding flag. We are using subquery in the select and update statement as both header and detail tables are involved.
Now the issue is, select query is working fine but update statement is not working as expected. It is somehow updating some other records rather than doing for the ones selected by the adapter.
Moreover logSQLstatement is also not working. Hence we are unable to identify the records which are getting updated.
Please advise.Hi Rumi,
See Question 8. Transaction Handling (Sender) in [SAP Note 831162 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 JDBC Adapter|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=831162].
8. Transaction Handling (Sender)
Q: If I have the following configured in a JDBC Sender:
Select Query:
SELECT column FROM TABLENAME WHERE FLAG = "TRUE"
Update Query:
UPDATE TABLENAME SET FLAG = "FALSE" WHERE FLAG = "TRUE"
How do I know that the JDBC adapter will not update newly added rows (rows that were
added between the time that the SELECT and UPDATE queries were executed) that were
not read in the initial SELECT query?
A: The SELECT and the UPDATE are run in the same DB transaction, i.e. both statements
have the same view on the database.
Make sure that both statements use the same WHERE clause. An additional
requirement for the correct operation of this scenario is the configuration of
an appropriate transaction isolation level on the database
(i.e., repeatable_read or serializable). You might also consider using a
"SELECT FOR UPDATE" statement instead of a plain SELECT statement to
ensure proper locking on the database. "SELECT FOR UPDATE"
is not supported in MS SQL database. In this case please make use of an
appropriate transaction isolation level on the database. For more details
please contact your DB vendors.
After, see Transaction Handling Issues in [SAP Note 1039779 - JDBC Adapter issues(Escape character,Transaction handling)|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1039779].
Best Regards.
Pedro Baroni -
How to use xs:date() in an update query?
I cannot test xs:date attributes in an "update" query. In a "select" query, all work fine.
This is the sample schema:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) -->
<xs:schema xmlns:tns="http://OracleTest" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" targetNamespace="http://OracleTest" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="MyComplexType">
<xs:sequence>
<xs:element minOccurs="0" name="FirstChild">
<xs:complexType>
<xs:attribute name="A" type="xs:string" />
<xs:attribute name="B" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="ID" type="xs:string" />
<xs:attribute name="DateAttr" type="xs:date" />
</xs:complexType>
<xs:element xdb:defaultTable="MyElement" name="MyElement" type="tns:MyComplexType" />
</xs:schema>
This is a sample XML document:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) -->
<tns:MyElement ID="ID1" xmlns:tns="http://OracleTest" DateAttr="2008-03-14" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://OracleTest http://OracleTest.xsd">
<tns:FirstChild A="a" B="b" />
</tns:MyElement>
If I check the DateAttr attribute in a xquery, it works fine:
select xmlquery('declare default element namespace "http://OracleTest"; collection("/Testing")/MyElement[@DateAttr=xs:date(''2008-03-14'')]' returning content).getclobval() from dual
If I execute an update, like this:
UPDATE RESOURCE_VIEW SET RES = deleteXML(RES, '/oraxdbr:Resource/oraxdbr:Contents/Testing/MyElement[@DateAttr=xs:date(''2008-03-14'')]','xmlns:oraxdbr="http://xmlns.oracle.com/xdb/XDBResource.xsd" xmlns="http://OracleTest"')
WHERE equals_path(RES, '/Testing/test1.xml') = 1
I get the error:
SQL Error: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00607: Invalid reference: 'date'.
31011. 00000 - "XML parsing failed"
Where is the problem?
Thank you!
MirkoHi,
Correct me if I'm wrong, but didn't xs:date() came with xpath 2.0?
deleteXML supports xpath 1.0 .
XMLQuery supports xpath 2.0.
That's why the error "Invalid reference: 'date'".
what function supports which version read Re: Which version of XPathAnts -
Why update query takes long time ?
Hello everyone;
My update query takes long time. In emp ( self testing) just having 2 records.
when i issue update query , it takes long time;
SQL> select * from emp;
EID ENAME EQUAL ESALARY ECITY EPERK ECONTACT_NO
2 rose mca 22000 calacutta 9999999999
1 sona msc 17280 pune 9999999999
Elapsed: 00:00:00.05
SQL> update emp set esalary=12000 where eid='1';
update emp set esalary=12000 where eid='1'
* ERROR at line 1:
ORA-01013: user requested cancel of current operation
Elapsed: 00:01:11.72
SQL> update emp set esalary=15000;
update emp set esalary=15000
* ERROR at line 1:
ORA-01013: user requested cancel of current operation
Elapsed: 00:02:22.27Hi BCV;
Thanks for your reply but it doesn't provide output, please see this.
SQL> update emp set esalary=15000;
........... Lock already occured.
>> trying to trace >>
SQL> select HOLDING_SESSION from dba_blockers;
HOLDING_SESSION
144
SQL> select sid , username, event from v$session where username='HR';
SID USERNAME EVENT
144 HR SQL*Net message from client
151 HR enq: TX - row lock contention
159 HR SQL*Net message from client
>> It does n 't provide clear output about transaction lock >>
SQL> SELECT username, v$lock.SID, TRUNC (id1 / POWER (2, 16)) rbs,
2 BITAND (id1, TO_NUMBER ('ffff', 'xxxx')) + 0 slot, id2 seq, lmode,
3 request
4 FROM v$lock, v$session
5 WHERE v$lock.TYPE = 'TX'
6 AND v$lock.SID = v$session.SID
7 AND v$session.username = USER;
no rows selected
SQL> select MACHINE from v$session where sid = :sid;
SP2-0552: Bind variable "SID" not declared. -
We have an update query recently brought to my attention that is running extremely slow on Oracle 11.2.0.1 against a secure file binary XML table using
update /*+ NO_XML_DML_REWRITE */croutreach.action set object_value = :1 where actn_id = :2 .
I am told the majority/near majority of the ~ 16 fields are updated. Also this table has numerous predefined virtual columns with fn based indexes on them.
My first inclination was to recast this using the Oracle updatexml function. I was told, the /*+ NO_XML_DML_REWRITE */ hint would also be necessary here.
update /*+ NO_XML_DML_REWRITE */
<tble_name> a
set a.object_value = updatexml(a.object_value ...).
Last year our dba's were instructed by Oracle Support to use this hint, as the update wasn't updating any records w.o any error msgs.
+1. Hoping to find out if anyone has run across using this hint in some capacity and what was their experience?+
In trying to optimizie this update statement, I'll start from scratch not using the /*+ NO_XML_DML_REWRITE */ hint and will commence with using the updatexml function with setting up an xmlindex.
+2. Hoping to receive some suggestions on creating the proper xmlindex - figuring an unstructured index. If get some good performance with the xmlindex; hoping to retire some of the virtual column usage.+
+3. Any suggestions on living with virtual columns in conjunction with xmlindexes? See the action table definition and associated ivirtual columns and indexes. This table seems over indexed...+
REATE
TABLE "CROUTREACH"."ACTION" OF XMLTYPE
CONSTRAINT "ACTN_ID_PK" PRIMARY KEY ("ACTN_ID") USING INDEX PCTFREE 10
INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT
1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1
FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE
DEFAULT) TABLESPACE "ACME_DATA" ENABLE
XMLTYPE STORE AS SECUREFILE BINARY XML
TABLESPACE "ACME_DATA" ENABLE STORAGE IN ROW CHUNK 8192 CACHE READS LOGGING
NOCOMPRESS KEEP_DUPLICATES STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1
MAXEXTENTS 2147483645 PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT)
ALLOW NONSCHEMA ALLOW ANYSCHEMA VIRTUAL COLUMNS
*"ACTION_DEF_URN"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/srvContextPointer/outreachActionDefInfo/@actionDefUrn
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50))),
*"STAT_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/@status_dt'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
WITH
TIME ZONE))),
*"ACT_DEF_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/srvContextPointer/outreachActionDefInfo/@actionDefId'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(20))),
*"CORRL_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/correlationId'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50))),
*"STAT_RSN"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/statusReason'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(30))),
*"ACT_APPNT_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/actionAppointment/appointment_dt'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
WITH
TIME ZONE))),
*"UPDT_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/@update_dt'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
WITH
TIME ZONE))),
*"CRET_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/@create_dt'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
WITH
TIME ZONE))),
*"ACT_SEQ"* AS (CAST(TO_NUMBER(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/srvContextPointer/outreachActionDefInfo/@sequence'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2)) AS NUMBER(10))),
*"SERVICE_DEF_URN"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";
/action/srvContextPointer/serviceDefUrn'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(100))),
*"ASSIGN_TEAM_CD"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/assignment/@teamCategoryCode'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50))),
*"ASSIGN_STAFF_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
/action/assignment/staffProfileId'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50))),
*"ACTION_TYPE"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)
declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; (::)
local-name-from-QName(QName("http://www.cigna.com/acme/domains/actions/2010/03",/action/@xsi:type))
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50))),
*"ACTN_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";/action/@id'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50))),
*"STATUS"*AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";/action/@status'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(20))),
*"ACME_MBR_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";/action/acmeMemberId'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50)))
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ;
CREATE UNIQUE INDEX *"CROUTREACH"."SYS_C0014547"* ON "CROUTREACH"."ACTION"
"SYS_NC_OID$"
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ;
CREATE UNIQUE INDEX *"CROUTREACH"."SYS_IL0000082156C00003$$"* ON "CROUTREACH".
"ACTION"
PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576
MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST
GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "ACME_DATA" PARALLEL (DEGREE 0 INSTANCES 0) ;
CREATE UNIQUE INDEX *"CROUTREACH"."ACTN_ID_PK"* ON "CROUTREACH"."ACTION" (
"ACTN_ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT) TABLESPACE "ACME_DATA" ;
CREATE
INDEX *"CROUTREACH"."ACTION_STAT_RSN_IDX"* ON "CROUTREACH"."ACTION"
"STAT_RSN"
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ;
CREATE
INDEX *"CROUTREACH"."ACTION_UPDT_DT_IDX"* ON "CROUTREACH"."ACTION"
"UPDT_DT"
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ;
CREATE
INDEX *"CROUTREACH"."ACTION_CRET_DT_IDX"* ON "CROUTREACH"."ACTION"
"CRET_DT"
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ;
CREATE
INDEX *"CROUTREACH"."ACTION_STAT_DT_IDX"* ON "CROUTREACH"."ACTION"
"STAT_DT"
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ;
CREATE
INDEX *"CROUTREACH"."ACTION_MBRID_TYP_STAT_IDX"* ON "CROUTREACH"."ACTION"
"ACME_MBR_ID",
"ACTION_TYPE",
"STATUS"
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ;
CREATE
INDEX *"CROUTREACH"."ACT_ACTDEF_URN_IDX"* ON "CROUTREACH"."ACTION"
"ACTION_DEF_URN"
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ;
CREATE
INDEX *"CROUTREACH"."ACTION_ACT_DEF_ID_STATUS_IDX"* ON "CROUTREACH"."ACTION"
"ACT_DEF_ID",
"STATUS"
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ;Any suggestions much appreciated.
Regards,
Richard Blanchardodie 63
update /*+ NO_XML_DML_REWRITE */croutreach.action set object_value = :1 where actn_id = :2 .
This update pattern is used in the production environment and is slowing the environment down as more xml content is increased. In a new release build, this update pattern against the action table described earlier, is particularly problematic.
Have some more information on the /*+ NO_XML_DML_REWRITE */ hint. It turns out, last year, updates statements would intermittently fail to correctly update silently failing. An Oracle Service Request was created. Over the span of about 5 mnths, Oracle determined a very low level Oracle kernel bug was the culprit. Oracle As a result of this SR, Oracle SUpport created BUG 11939507 <ORA-08102: index key not found during update on xmltable with a virtual column>. This bug is viewable on metalink. Oracle claims this bug has only been oberved on In the interim to 11.2.0.3, Oracle Support mentioned to use /*+ NO_XML_DML_REWRITE */; thus disabling piecewise update.
Here's preface information on this bug:
Bug 11939507: ORA-08102: INDEX KEY NOT FOUND DURING UPDATE ON XMLTABLE WITH VIRTUAL COLUMN
Bug Attributes
Type B - Defect Fixed in Product Version 12.1
Severity 2 - Severe Loss of Service Product Version 11.2.0.1
Status 80 - Development to Q/A Platform 23 - Oracle Solaris on SPARC (64-bit)
Created 30-Mar-2011 Platform Version 10
Updated 13-Feb-2012 Base Bug -
Database Version 11.2.0.1
Affects Platforms Generic
Product Source Oracle
Hdr: 11939507 11.2.0.1 XDB 11.2.0.1 BINARY PRODID-5 PORTID-23
Abstract: ORA-8102: INDEX KEY NOT FOUND DURING UPDATE ON XMLTABLE WITH VIRTUAL COLUMN*** 03/30/11 12:22 pm ***
BUG TYPE CHOSEN =============== code
Component: XML Database =======================
DETAILED PROBLEM DESCRIPTION ============================
The issue happens intermittently when running a batch program with 50 concurrent sessions that involves high concurrent updates.
DIAGNOSTIC ANALYSIS =================== reproducible testcase on customer dummy data reproduced by Thomas.
WORKAROUND? =========== No
TECHNICAL IMPACT ================ Customer is experiencing this error which is critical to the application because it causes a home health care provider to possibly lose a couple hours worth of work and have to start from scratch. The condition has only accessed concurrently from about 40 threads
RELATED ISSUES (bugs, forums, RFAs) =================================== Bug 8514561 - ORA-8102 WHEN UPDATING TABLE
HOW OFTEN DOES THE ISSUE REPRODUCE AT CUSTOMER SITE? ==================================================== Intermittent
DOES THE ISSUE REPRODUCE INTERNALLY? ==================================== Intermittent
IS A TESTCASE AVAILABLE? ======================== Yes The good news is, this bug is corrupting a virtual index column.
I'll try test cases using the update pattern; 'update /*+ NO_XML_DML_REWRITE */croutreach.action set object_value = :1 where actn_id = :2 ' - substituting actual values for the bind variables and removing interfering virtual columns. Wil lcompare with and w/o the hint.
This wil address your; "Where does the new values come from? Individual variables?" - and provide sample data.
Presently, this update pattern is used 'blindly' in that when no xml relevent changes are identified, only a couple of the roughly 16 fields are updated - yet the whole document gets updated with this update pattern. When changes occur, the whole document is updated. Will work with updating 1 or 2 fields using updatexml and try the xmlexists function for the predicate.
04/25/12 Update:
odie 63,
Here's a sample xml record from the action securefile binary xml table:
<?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?><action xsi:type="AssessmentActionType" status_dt="2012-01-18T19:38:21.077Z" status="not applicable" create_dt="2012-01-17T23:10:16.173Z" id="dfdfdfdfdfddfdfdfdfdfdf" xmlns:ns5="http://www.xxxxx.ddd/exception/definition/schema/2010/01" xmlns="http://www.xxxxxx.ddd/mmm/domains/actions/2010/03" xmlns:ns6="http://www.xxxxx.ddd/mmm/domains/utility/outcome/2010/03" xmlns:ns7="http://www.xxxxxx.ddd/mmm/domains/common/2010/03" xmlns:ns2="http://www.xxxxx.ddd/mmm/messages/actions/2010/03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="http://www.xxxxx.ddd/mmm/domains/workforce/2010/03" xmlns:ns4="http://www.xxxxxx.ddd/mmm/domains/entitlement/2011/11">
<acmeMemberId>abcdefghijklmnop</acmeMemberId>
<advocacyPlanId>qrstuvwxyz</advocacyPlanId>
<srvContextPointer>
<serviceDefUrn>urn:coderunner:Medical:Definition:ServiceService:11111:7</serviceDefUrn>
<outreachActionDefInfo sequence="1" actionDefUrn="urn:xxxxxxxxxx:Medical:Definition:Action:50813:2" actionDefId="xxxxxx">
<srvContextPath>Access Profile~Why did you access the profile?~Reason for access?</srvContextPath>
</outreachActionDefInfo>
</srvContextPointer>
</action>Started out using this update statement against the virtual column a.actn_id. This column is also indexed as a fbi.
UPDATE /*+ NO_XML_DML_REWRITE */ action A
SET A.object_value = updatexml(A.object_value,'/action/@status','triggered','xmlns="http://www.xxxx.vvv/yyy/domains/actions/2010/03"')
where a.actn_id='888a80be-d69f-464d-b3f7-85b6209f918e';
This statment updates fine with and w/o the hint. This hint takes away the piecewise update of the xml document and relies upon the a.actn_id virtual column.
Then removed the reliance on the virtual column using the xmlexists fn.
First did an alter index 'actn_id_pk invisible' to take the virtual column out of consideration by the optimizer.
UPDATE /*+ NO_XML_DML_REWRITE */ action A
SET A.object_value = updatexml(A.object_value,'/action/@status','triggered','xmlns="http://www.xxxx.vvv/yyy/domains/actions/2010/03"')
where xmlexists('$p/action[@id="'888a80be-d69f-464d-b3f7-85b6209f918e'"]' PASSING object_value as "p");
This update runs but doesn't update any columns - with or without the hint.
Also created a basic unstructured xmlindex to remove the full table scan - which worked fine execution plan-wise.
create index action_xmlindex_ix on action (object_value) indextype is xdb.xmlindex;Per the SR on this, the /*+ NO_XML_DML_REWRITE */ disables piecewise update and is a workaround for the bug surrounding virtual column index usage when having many concurrent sessions and updates against a table with millions of xml documents. Getting rid of the virtual column in the predicate removes the need for the workaround hint.
My problem is This update runs but doesn't update any columns. Maybe am missing something or doing a syntax/semantic error ?
Any assistance much appreciated...
Regards,
Rick Blanchard
Edited by: RickBlanchardSRSCigna on Apr 25, 2012 12:52 PM -
Sender jdbc adapter....update query?
Dear Team,
we are selecting date from master database and client dont want to add any other field for update query.
using select option, how to avoid selecting duplication records.
can i use current date and time for selecting the records for every select statement?
if yes then how to do it and what we need to update in update query??
Regards,
ChinnaHi Chinna,
Check like this below.
The following SQL statement selects the product name, and price for today from the "Products" table:
SELECT ProductName, Price, Now() AS PerDate
FROM Products;
Similarly,
UPDATE ProductName, Price, Now() AS PerDate
FROM Products;
Regards,
Loordh.
Maybe you are looking for
-
How Do I Get to the Organizer in PSE 8 on a Mac?
Greetings: I have downloaded PSE 8 and am using it in trial mode for now on my Mac running Snow Leopard. I can't for the life of me find how to start the photo organizer to create an online album or tag photos on a map. Everything I have read indicat
-
Installation Failure: Windows failed to install the following update with error 0x800F0922
Hi folks, I have a HP Elitebook Folio 9470p. It came with Windows 8, and I installed it on my corporate domain. I was trying to do some Windows updates so I could upgrade it to Windows 8.1, but it fails installing the updates, whether or not I try
-
How to network two macs wirelessly
Need simple instructions on how to network two macs wirelessly
-
Premiere Pro update problem and AME bug
After renaming the folders and emptying the Media Cache database in the Preferences I thought everything was working, that is until I exported my project to the updated Adobe media encoder. There was no audio playing back from the rendered file and m
-
Trouble displaying Windows Explorer file select dialog in RH8
This problem is occurring across RH8: when I select Import Word doc at startup; when I select Baggage File -> New; when I select Insert Image-> Browse . RoboHelp locks up and when I select to End Task in the Windows Task Manager I get a message sayin