Bad Update Query
This query is giving me an error:
UPDATE tmpnewAttyReq
SET FIrmID = LawFirms.Firm_ID
FROM LawFirms
WHERE LawFirms.Firm_ID = tmpNewAttyReq.FIrmID;
When I run it, I get an error that says:
"Syntax error (missing operator) in query expression 'Lawfirms.Firm_ID FROM Lawfirms'"
But, I have no idea what's wrong???
Try this AFTER BACKING UP database.
UPDATE tmpnewAttyReq
SET FIrmID = LawFirms.Firm_ID
FROM LawFirms INNER JOIN tmpNewAttyReq
ON LawFirms.LawFirmName = tmpNewAttyReq.FIrmName;
Build a little, test a little
Similar Messages
-
Update query which taking more time
Hi
I am running an update query which takeing more time any help to run this fast.
update arm538e_tmp t
set t.qtr5 =(select (sum(nvl(m.net_sales_value,0))/1000) from mnthly_sales_actvty m
where m.vndr#=t.vndr#
and m.cust_type_cd=t.cust_type
and m.cust_type_cd<>13
and m.yymm between 201301 and 201303
group by m.vndr#,m.cust_type_cd;
help will be appreciable
thank you
Edited by: 960991 on Apr 16, 2013 7:11 AM960991 wrote:
Hi
I am running an update query which takeing more time any help to run this fast.
update arm538e_tmp t
set t.qtr5 =(select (sum(nvl(m.net_sales_value,0))/1000) from mnthly_sales_actvty m
where m.vndr#=t.vndr#
and m.cust_type_cd=t.cust_type
and m.cust_type_cd13
and m.yymm between 201301 and 201303
group by m.vndr#,m.cust_type_cd;
help will be appreciable
thank youUpdates with subqueries can be slow. Get an execution plan for the update to see what SQL is doing.
Some things to look at ...
1. Are you sure you posted the right SQL? I could not "balance" the parenthesis - 4 "(" and 3 ")"
2. Unnecessary "(" ")" in the subquery "(sum" are confusing
3. Updates with subqueries can be slow. The tqtr5 value seems to evaluate to a constant. You might improve performance by computing the value beforehand and using a variable instead of the subquery
4. Subquery appears to be correlated - good! Make sure the subquery is properly indexed if it reads < 20% of the rows in the table (this figure depends on the version of Oracle)
5. Is tqtr5 part of an index? It is a bad idea to update indexed columns -
UPDATE QUERY can't update table
Hi,
During 1500-2000 concurrent users, DB Transaction locks occur. So that Update query can't update table and we get inconsistent data. How can we avoid this inconsistent data?? Why we get transaction locks??
Eg. In update query it update the status of user with completed; but because of transaction lock update query can't update status of user it remains uncompleted. So we can get wrong status of user(inconsistent data). Why UPDATE query update the status
of user???
update table set status='completed', date=@p2,score=@p3 where id=@p1You are not getting inconsistent data, you are getting the data according to the isolation level you are running under. The isolation level determines the locking model and therefore determines any bad dependencies you may experience. Reducing the bad dependencies
through higher isolation level will lower concurrency. *This* is the core concept of Transactional Processing theory.
Furthermore there is not really such a thing as a DB Transaction lock - at least not in the way you mean. SQL server does use DB locks (such as Shared transaction workspace and Exclusive transaction workspace) but the highest level of lock escalation is
the object level (heap or btree) so those are the things you are really interested in. In the ideal would you want all Exclusive, Shared and U locks to be taken at the RID (heaps) or Key (cluster tables) level - and only have few of them per query.
In conclusion think carefully about your query and how it is implimented under the covers by the database engine.
Regards,
Mark Broadbent.
Microsoft Certified Master
Contact me through twitter |
blog | sqlcloud
Please click "Propose as answer" if a post solves your problem
or/and vote the post up if it's been helpful. -
Hello
I'm trying to write an update query either in a single statement or stored procedure that updates a numeric column based on a date column. I do this using:
UPDATE DATE SMSCLOSED_CTYWOA SET 'date_action_start' = to_number(to_char('action_date' ,'MMDDYY')); No big deal. The problem is both column names have apostrophe's in their name (i.e. '). When I run this query the 'action_date' segment returns an error:
ERROR at line 1:
ORA-01747: invalid user.table.column, table.column, or column specification
Any advice would be appreciated.
Thanks in advance.If you had a normal table, like:
Name Null? Type
DATE_ACTION_START NUMBER(6)
ACTION_DATE DATE
the command would be:
UPDATE smsclosed_ctywoa
SET date_action_start = TO_NUMBER(TO_CHAR(action_date,'MMDDYY'));
However, if you have a table like:
Name Null? Type
'date_action_start' NUMBER(6)
'action_date' DATE
which is a really poor table design, then the command would be:
UPDATE smsclosed_ctywoa
SET "'date_action_start'" = TO_NUMBER(TO_CHAR("'action_date'",'MMDDYY'));
Note that, in both cases, there is no DATE after the word UPDATE.
In the second case, if your column names have apostrophes and are in lower case, which is a really bad design, then you need to enclosed them in double quotes.
Another thing you should be aware of is that, because date_action_start is a number field, you will be losing the leading zeroes, so July 9, 2001 will be 70901, not 070901.
It looks like you need to seriously reconsider your table design.
null -
Use select & update(query) at the same time
I'm sorry to trouble you.
I am racking my brains to find a solution to the problem.
I don't search a problem in my source.
I maked every effort.
I am tired to death.
I wanna use (select & update(query)) at the same time.
The Source compiled but have not access to DB
plz help me.
Can you give me a hand?
sorry my bad English..
link my source
http://www.netian.com/~111nice/bangnew.javacan you clearly explain whats problem and what error your are getting
-
[JPA] CONCAT in update query
Hello.
I'm trying the new JPA API using TopLink and other implementations such as Hibernate.
Everything in my simple tests seems to work fine, but an update query doesn't produce what i'm expecting. In this case, Hibernate works perfectly...
For information i'm using the Derby database, version 10.1.2.1, in client-server mode, and the last build 36 of the TopLink glassfish JPA RI (from Oracle site)...
The query works on a simple entity named 'Thing', trying to change a string/varchar property value using the CONCAT function :
"update Thing t set t.description = CONCAT(t.description, '-UPDATED') where t.identifier like '%3-%'"
Enabling finest logs, the following translation of the statement appears :
UPDATE THING SET DESCRIPTION = VARCHAR(DESCRIPTION || '-UPDATED') WHERE (THING_IDENTIFIER LIKE '%3-%'
I've tried the same SQL statement dierctly against the derby db, and for sure it doesn't work, ending with the same bad values ! For example, for an original field value "Test...T#3-1172242788995", the resulting updated value is "Test...T#3-1172" instead of the expected "Test...T#3-1172242788995-UPDATED"...
An idea ? Should I specify the target derby base somewhere ?
Thanks for your help...Hello.
After more tests, it seems the problem comes from Derby, that truncates the strings using the VARCHAR function.
Does any one know why Top Link uses the VARCHAR function for its translation of the JPA's CONCAT ?
Thanks. -
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.
Maybe you are looking for
-
Problem using the clone stamp tool in cs6 64 bit
I am trying to use the clone stamp tool, however each time I alt click on a PC runing system 7- 64 bit and try to clone an area, I get a window stating that I have not defined an area. Alt clicking again does not solve the problem. I work in a compu
-
Ducker does not appear as an insert
Ducker does not appear as an insert in my window. Should it not be located within dynamics? Is it possible that the software did not install? How can I get it?
-
How to control scrubbing with the keyboard?
The headline is already the question: I would like to use the keyboad to fast forwad in songs. In the 'itunes a-z' there is only an info how to do this with the mouse. Arrow Keys do not seem to work for this, they only switch to the next or previos s
-
"Aperture quit unexpectedly" on launch.
I have read the Apple advisory, and have reinstalled the app 2 times. But it still crashes on launch every time. This is but one of the problems I have encountered since upgrading to the latest versions of all the Apple software. Help!
-
Having problems with IMPORT...
SOURCE DB = HP UX running 10.2.0.2 TARGET DB = Linux running same. I ran a full export on my source db, and everything went fine. I pulled the dmp file across to my target db and validated that the file sizes were the same. When i run the import, it