Update query with case
my table: workingdateSNO name startdate
1 ss 12/01/2011
2 bb 11/01/2011
I can update name or date start or two .i will pass a new date, name of update through front end.
I need to validate the condition in the event, that is when the new date after check if it is higher, then start date. If it is higher, then it should be updated with the new start date.
If not, it must be updated, it will be the old value.
I use it under request
Update workingdate set name = 'sss', startdate =)
case
When
(TO_DATE('2011-12-10','yyyy-MM-dd') > (select TO_DATE(startdate,'yyyy-MM-dd') from the workingdate, when sno = 1))
then TO_DATE('2011-12-10','yyyy-MM-dd')
on the other
Select TO_DATE(start_date,'yyyy-MM-dd') in the workingdate, when sno = 1
end
)
where sno = 1;
but when I run the above query, it shows me
Error report:
SQL error: ORA-00936: lack of expression
00936 00000 - "missing expression.
* Cause:
* Action:
How could I solve this problem...
Check this
UPDATE workingdate
SET NAME='sss',
startdate=(CASE WHEN (TO_DATE('2011-12-10','yyyy-MM-dd') > startdate THEN TO_DATE('2011-12-10','yyyy-MM-dd') ELSE start_date END)
WHERE sno=1;
See you soon
Kanchana
Tags: Database
Similar Questions
-
Update query with join statement
Hi guys, would check how to write a query to update with the inner join statement? The case is like this, I need to update PRD_ID on TBL A as below, based on the information of lookup table. The keys are based on the A03 column to the table time to condition only select records in LOOKUP_TBL where PRD_ID = 110001 then update to TBL_A for those who match the data and FIX_FLT = 1
I have an update query and it works in SQL SERVER but not in ORACLE
Update a PRD_ID = B.PRD_ID set
Inner TBL_A A join B LOOKUP_TBL
On A.A03 = B.A03
AND A.FIX_FLT = 1 AND B.PRD_ID = '110001';
TBL_A
PRD_ID A03 FIX_FLT TXN DATE 1 A1 1 1 23/10/2010 1 A2 1 1 10/24/2010 1 A3 3 2 10/25/2010 1 A4 3 2 10/26/2010 1 A5 3 1 27/10/2010 LOOKUP_TBL
PRD_ID A03 NOTE 110001 A1 NULL VALUE 110001 A2 NULL VALUE 110005 A3 NULL VALUE 110005 A4 NULL VALUE 110001 A5 NULL VALUE You can write updates like this in Oracle. It's called updatable join views. Something like this:
Update
(select a.prd_id a_prd_id
b.prd_id b_prd_id
Inner TBL_A A join B LOOKUP_TBL
On A.A03 = B.A03
AND A.FIX_FLT = 1 AND B.PRD_ID = '110001'
)
Set a_prd_id = b_prd_id;But you must have the constraints appropriate in place, otherwise you will get the error "key preserved table.
-
Update query with a random order
I have a survey, in the response table tool, I want to be able to scramble the order of the question. (built in apex)
I have a column to the display order of issue, I would like to update this column with the results of the query... below how can I do this?
I can't have a question about the order even as another.
----------------------
Select question_id, rownum question_order
BeO
Select question_id, question_order
of wi_survey2_question
where survey_id =: p2_survey_id
ORDER BY dbms_random.value
)
------------------------
query result looks like this:
1 153
2 152
154 3
4 155
5 156
----------------------------
Thanks, Jade
Published by: Vanadium on 19/05/2010 15:25Hello
I would like to use MERGE, something like this:
MERGE INTO wi_survey2_question dst USING ( WITH random_order AS ( SELECT question_id FROM wi_survey2_question WHERE survey_id = :ps_survey_id ORDER BY dbms_random.value ) SELECT question_id , ROWNUM AS rn FROM random_order ) src ON (src.question_id = dst.question_id) WHEN MATCHED THEN UPDATE SET dst.question_order = src.rn ;
-
Hi, I have the following requirement based on the terms
Here's the test tables and data
The expected output is:create table test_r_cd (id , role_code,org_id) as select 100,'LOC' ,10 FROM DUAL UNION ALL select 100,'LIQ',20 FROM DUAL UNION ALL SELECT 100,'STE' ,30 FROM DUAL CREATE TABLE TEST_SEC_TYP(id,type) as select 100,1 from dual union all select 100,2 from dual select * from test_r_cd cd ,TEST_SEC_TYP typ where cd.role_code in (case when (typ.type =1 ) then ('LOC','LIQ') when (typ.type = 2) then ('STE') ELSE null end )
Thank youorg_id role_code type 10 'LOC' 1 20 'LIQ' 1 30 'STE' 2
SQL> select * 2 from test_r_cd t1,test_sec_typ t2 3 where t1.ID = t2.id 4 and case when role_code in ('LOC','LIQ') then 1 5 when role_code = 'STE' then 2 6 else null end = t2.type; ID ROL ORG_ID ID TYPE ---------- --- ---------- ---------- ---------- 100 LOC 10 100 1 100 LIQ 20 100 1 100 STE 30 100 2
-
Is it possible to update a query with another query?
I'm trying to update a query with another query (see the attachment of the code). Here is my setup: I have a table in an Access database in which I enter a string in a form and an update. This string is a single record in another table in the same data source. The first table has one record to provide the second, which has many and will have more. Basically what I was asking is: is this a valid thing to do in coldfusion? If this isn't the case, please help with a method to alter. I'm still new to coldfusion.
The overall effect, I'm going to do is to display a folder as a profile of truck recommended on the website: www.truckerstoystore.net. Currently, I get an error when I try to view the page with the current configuration of the query.
Check out this page to see the error: www.truckerstoystore.net/currentTOW2.cfm
Assistance in this matter is greatly appreciated.
------------------------------------------------------------------------------------------ -----------------------------------------------------------------------The owner of the column has a data type of character and thus the value must be in single quotes
WHERE owner = "#Owner #
But as your learning, I suggest using cfqueryparam
WHERE owner =
Ken
-
Report of update SQL query with line selector. Update process.
I have a report of update SQL query with the selectors in line.
How to identify line selector in a process update on the page.
I want to update some columns with a value of an area of selection on the page.
With the help of the base:
UPDATE table_name
SET Column1 = value
WHERE some_column = some_value
I would need to do:
UPDATE table_name
SET column1 =: P1_select
WHERE [line selector] =?
Now sure how to identify [line selector] and/or validate it is checked.
Thank you
BobIdentify the name of the checkbox of the source of the page element, it should be of the fxx format (f01, f02... f50).
Suppose that we f01.for i in 1 .. apex_application.g_f01.count loop UPDATE CONTRACTS SET SIP_LOAD_FLAG = :P16_STATUS where
= apex_application.g_f01(i); --i'th checked record' primary key end loop; -
Update multiple columns with case
I have this and I wanted to have it in a single update to the case when then etc. Anyone?
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 11 AND CIITM_CODE = 2;
--8288 lines are updated.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 2
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 12 AND CIITM_CODE = 2;
-513 lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 3
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 13 AND CIITM_CODE = 2;
-39 lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 4
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 14 AND CIITM_CODE = 2;
-15 updated lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 5
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 15 AND CIITM_CODE = 2;
-5 lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 6
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 16 AND CIITM_CODE = 2;
-4 lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 7
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 17 AND CIITM_CODE = 2;
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9,
CIITM_NUMIT = CASE CIITM_ITEM_RATE
11. WHEN CAN CIITM_NUMIT
OF OTHER CIITM_ITEM_RATE - 10
END
WHERE CIITM_APPLICATION = 7
AND CIITM_ITEM_RATE BETWEEN 11 AND 17
AND CIITM_CODE = 2;
SY.
-
Possible BUG: af:query with several LOVs throws bitIndex exception
Hi all
I use the af:query for the search component and I get constantly "bitIndex < 0:-1 error" when searching on a LOV (by typing the value in the part of the LOV not using inputtext does not popup LOV).
Installation program:
I use Jdev 11.1.2.1 with JDEVADF_11.1.2.1.0_GENERIC_110907.2314.6081.
Using the schema HR, I created the entity departments and a Department display object based on the entity.
I created 2 objects of basis for the LOVs SQL view (not from entities not):
1. view LOV departments - select * from departments
2 view of the LOV locations - select * from places
The two views of Lov were created using the wizard with all the default values.
In my opinion main departments (based on the entity), I created 2 LOVs for LocationId and for DepartmentId.
The LOV for DepartmentId returns 2 attributes, DepartmentId and DepartmentName both are mapped to the corresponding attributes in the main view of Department. (I did using the popup "Edit the list of values", in the section 'List return values').
Finally, I dragged the "all searchable attributes" from the control panel of data to a test page, creating a group of ADF query with table
The error:
I type a valid service id in the LOV DepartmentId within the research section and I get the "bitIndex < 0:-1 error.» No results are returned.
When the server running with - Djbo.debugoutput = console I see the following error messages:
CtrlAttrs < JUCtrlValueBinding > < setInputValue > [18415]: exception caching: oracle.jbo.AttrValException: Houston-27019: the get method for attribute "DepartmentName" in the PREMISESof VIEW_USAGE_internal_vci_def_values is not resolved.
< DCBindingContainer > < cacheException > [18416] * updated BindingContainer cache EXCEPTION: oracle.jbo.AttrValException
< DCBindingContainer > < cacheException > [18417] java.lang.IndexOutOfBoundsException: bitIndex < 0:-1
at java.util.BitSet.get(BitSet.java:441)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1823)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1962)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:824)
at oracle.adf.model.bean.DCDataRow.getAttributeInternal(DCDataRow.java:366)
at oracle.adf.model.bean.DCCriteriaValueRowImpl.getAttributeInternal(DCCriteriaValueRowImpl.java:241)
at oracle.jbo.server.ViewRowImpl.getAttrInvokeAccessor(ViewRowImpl.java:906)
at oracle.jbo.server.ViewRowImpl.getAttribute(ViewRowImpl.java:854)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:1213)
at oracle.jbo.uicli.binding.JUCtrlListBinding.setTargetAttrsFromLovRow(JUCtrlListBinding.java:2799)
at oracle.jbo.uicli.binding.JUCtrlListBinding.setTargetAttrsFromLovRowAndUpdateMRU(JUCtrlListBinding.java:2712)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlLOVBinding.setInputValueInRow(FacesCtrlLOVBinding.java:1163)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2926)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2889)
to oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$ AdfCriterionValues.set (FacesCtrlSearchBinding.java:3589)
at javax.el.ListELResolver.setValue(ListELResolver.java:240)
at oracle.adfinternal.view.faces.model.AdfELResolver.setValue(AdfELResolver.java:162)
at oracle.adfinternal.view.faces.model.AdfELResolverProxy.setValue(AdfELResolverProxy.java:71)
at com.sun.faces.el.DemuxCompositeELResolver._setValue(DemuxCompositeELResolver.java:255)
…
Note:
The search works as expected if I only have a LOV attached to the main view. (if I don't have the Department LOV attached as described above everything works fine)
If both LOVs of DepartmentLOV and LocationsLOV return a single value, the departmnetId and the locationId, without mapping any additional return attributes research as planned as well.
This is test case the simplest I could create to reproduce the error I see in our code.
Here is a link to my test project: [http://www.2shared.com/file/QxZJDfax/bitIndexTest.html]
Help, please
I'm looking for workarounds / fixes.
Any advice would be greatly appreciated.
Thank you
SashaHi Sasha,
which seems related to the bug 12851501 - ARRAYINDEXOUTOFBOUNDSEXCEPTION LIFTING OF VIEWROWSTORAGE CLASS
expected to be fixed in JDeveloper 11.1.2.2.0If you have access to My Oracle Support, there are here available patch (patch 12851501).
Kind regards
Didier.
-
Need help writing an update / insert with linked tables
I am new to ColdFusion. I am learning to write querys and creates a small application to collect information from visitors to my web site. (It's also a good way for me to learn this language) I'm having a problem and it is not only the way to use an update / insert with related tables. I don't know if I'm still gather the appropriate variables to compare them to existing DB records until his execution is the update or insert some querys. Can someone help me, show me how can I update / insert related tables and maybe tell me if I create the varibales good to the compairison? This is my code, I commented out.
<! - creating a variable to compare with the db table - >
< cfset userIP = ('#CGI.) REMOTE_ADDR #') ><! - run the query and compare the cfset cell remote_addr - >
< name cfquery = 'userTracking' datasource = "" #APPLICATION.dataSource # "dbtype ="ODBC">"
SELECT REMOTE_ADDR
Of user_track
WHERE REMOTE_ADDR = #userIP #.
< / cfquery ><!-if the record exists, then run this update-->
< cfif userTracking EQ userIP >
< cfquery datasource = "#APPLICATION.dataSource #" >
UPDATED user_track, trackDetail
SET user_track. REMOTE_ADDR = < cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">.
user_track. Browser = < cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
user_track.visits = visits + 1,
trackDetail.date = < cfqueryparam value = "#Now ()" # "cfsqltype ="CF_SQL_TIMESTAMP">,"
trackDetail.path = < cfqueryparam value = "#Trim (PATH_INFO)" # "cfsqltype ="CF_SQL_LONGVARCHAR">"
WHERE REMOTE_ADDR = < cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">
< / cfquery >
< cfelse ><! - if it isn't, then insert a new record-->
< datasource = "" #APPLICATION.dataSource # cfquery "dbtype ="ODBC">"
INSERT INTO user_track, trackDetail
(user_track. REMOTE_ADDR, user_track.browser, user_track.visits, trackDetail.userID, trackDetail.date, trackDetail.path)
VALUES)
< cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">.
< Len (Trim (HTTP_USER_AGENT)) GT 1 cfif >
< cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
< / cfif >
visits + 1,
< cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
< cfqueryparam value = "" #user_track.userID # "cfsqltype ="CF_SQL_VARCHAR">,"
< cfqueryparam value = "#Now ()" # "cfsqltype ="CF_SQL_TIMESTAMP">,"
< cfqueryparam value = "#Trim (PATH_INFO)" # "cfsqltype ="CF_SQL_LONGVARCHAR">"
)
< / cfquery >
< / cfif >
I'm close on this? This throws any errors, but it is not no longer works. It is so obviously wrong. I get a cfdump the end of my query of compairison, but once it hits the stated case, it is lost.
Thanks for your time no matter who.Newbie
You must define the variable before you can use it. You try to use it on line 1 of your model.
-
Update fails with error code 48 9.
Original title: code9C48
I get this update failed with... 9 ethical c 48... any information would be greatly appreciated... Thank you
Hi TeresaReynolds,
· Update fails with error code 9 48?
· Are you facing this problem with a particular update or all updates?
· Remember to make changes to the computer, after which the issue started?
Try the following steps:
Step 1:
Temporarily disable the antivirus on the computer running software and check if it helps:
Disable the anti-virus software
Caution:
Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you do not disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network during the time that your antivirus software is disabled, your computer is vulnerable to attacks.Step 2:
Reset Windows components updates default and check to see if it helps:
How to reset the Windows Update components?
I hope this helps.
-
Update user with Org units using NSAPI
We have a requirement where we need to update users with different organizational units with an external system. The integration guide indicates an NSAPI that may be used for this operation, no one create/update. It just says that we must use the XML from a details person Get API and use it as a query XML.
The problem that we face is to find where to place the new Org Unit details in the request XML. If someone knows about this detail.
Is this still the correct API for the fulfilment of the condition or we're looking at the wrong thing here
That's why the requirements a bit clearer.
If you are to be drawn from the external system rather that push to the PSAB, then I think that using the above mentioned SDK might be better suited since it is for the most part it that it was designed for, however, is probably a bit more complex to implement than the REST API.
If you're always going the way of the use of the REST API, based on what I've seen and read that this API does not account of associatedOrganizationalUnits , which is where you update the members of the ORGANIZATIONAL unit, I can't see another way for you to do so through the current REST API.
A third option is to create a service within the CPSC updates a user using the tasks Directory included in the plan, this service can then be consumed using the API of requisition, the downside of this is that there is a demand generated for each update.
-
KB2856373 update fails with error 80070026
I tried to install the KB2856373 update and Windows Update has been fails with an error code of 80070026 each attempt.
I perform an installation of Windows 8 x 64 (March 30, 2013). I have run Windows Update repair tool to repair Windows Update components. He found no other problems, and this has not solved the problem. I downloaded the standalone update, rebooted my computer for a clean boot and tried to install it, it did not work. I don't have any other anti-malware or anti-virus installed. In addition, I ran system update tool with no luck.
Any help would be greatly appreciated.
Thank you!
So, I think I have traced the origin of my problem:
My main hard drive is a 120 GB SSD, as a result, I also have a traditional 1.5 TB hard drive installed. In order to avoid the write cycles and free up space on my SSD, I used the symbolic links to redirect the C:\Users D:\Users. This causes generally no problems because everything is redirected without problem. However, in the case of this update, it must be C:\Users in C:\Users instead symbolically linked to D:\Users.I have no idea why this problem occurs, but I think at least determine the root cause can help people in the same situation as me and MS software engineers fix this with less of a headache I had.Thanks a lot for your help. -
help me out with a query with an output that has own text.
help me out with a query with an output that has own text.
For example select name from tbl_name
Ben "is my name"-> should be the output
Hello
3cc59f7b-B8C1-4EFA-8385-e0d8720a689c wrote:
help me out with a query with an output that has own text.
For example select name from tbl_name
Ben "is my name"---> should be the output
Sorry, it is not clear what you want.
If the table contains only "Ben", then you can get the output above using a query like this:
SELECT name. '' my name is' ' AS name_plus
FROM tbl_name;
I hope that answers your question.
If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: https://forums.oracle.com/message/9362002#9362002
-
Unable to get the update on my case
How can I get an update on my case 0217279450? Opened for four days and I didn't get an answer to.
Thank you very much.
Since this is an open forum, not Adobe support... you must contact Adobe personnel to help
Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">===>
Don't forget to stay signed with your Adobe ID before accessing the link belowCreative cloud support (all creative cloud customer service problems)
http://helpx.Adobe.com/x-productkb/global/service-CCM.html -
Automatic update fails with error #16824
I just deployed a new version of my app and AutoUpdate updates fail with the dreaded #16824 error.
However, I have not upgraded my SDK between releases, nor I have changed anything in my other than the version numbers update.xml. And the build and deploy process is automated, so that should not have changed either. What could be going on here?
Old update.xml:
<?xml version='1.0' encoding='UTF-8'?> <update xmlns='http://ns.adobe.com/air/framework/update/description/1.0'> <version>2.1.22</version> <url>http://ramp.leancoder.com/client/downloads/ramp.air</url> </update>
New update.xml:
<?xml version='1.0' encoding='UTF-8'?> <update xmlns='http://ns.adobe.com/air/framework/update/description/1.0'> <version>2.1.26</version> <url>http://ramp.leancoder.com/client/downloads/ramp.air</url> </update>
The two versions were built with:
$bin/adt -version adt version "2.0.2.12610"
This error, in this case, is the result of a self-signed certificate has expired.
Generate a new certificate and using the "adt - migrate" command (description here) solved the problem.
Maybe you are looking for
-
Memory of 8 MB late 2009 IMAC. Occurs at random, double click on the screen to get back to full size
-
Hey now good people! I have an iPod classic, 160 gb. Until very recently, I had no problem with my music playing on it, but now it won't play some songs. What I've done so far: -It is a PC brand new that I just built in recent weeks. There win 10 Pro
-
Card ethernet Pavilian HP500-A60:
I have a desktop model Pavilion HP500-A60. I just opted for Time Warner Cable because they offered 200 Mbps internet speed. He module is connected to my computer with an ethernet cable and it has a wifi wireless to my TV. I got a speetest and you can
-
How to use the Audio speakers 5.1 on Satellite P105-S9722
Hello I have a P105-S9722 Satellite with Windows Vista Edition full and connected to my home theater with mini plug on cable Toslink. I have sound but only in my front speakers. In my home theater when I connect any hardware supports 5.1 a blue light
-
Repartitioning and system restore issues
I have a laptop Pavilion DV6-6193 running Windows 7 x 64 Edition Home Premium, and I want to set up in an environment multiboot (Fedora, Ubuntu, Win7 Professional and the existing Win 7 Home Premium). However, since the original factory configuration