Update selected fields
HelloWhat is the effective way to update the selected fields in the selected record in a single script.
Rgds
sexy
Vanessa wrote:
I was a little confused with cursors...
A cursor is a "+" SQL program +.
You send a SQL UPDATE query to the database. The database must compile this SQL source code into something that she can understand and execute. It analyzes the SQL source, and it transformed into binary executable instructions. You can see how this program binary executable by looking at the plan execution of the SQL code source.
These binary executable is called a cursor.
The database will give you a unique handle for this cursor. Using this handle, you can call this binary program and pass it data - and it will process these data and return the results (if any).
For example, you send the following source SQL in the database:
Program ---> 'update emp set salary = :NEWSAL where emp_id = :EMPID' --> SQL Engine
The engine of the SQ analysis, creates a cursor, and you will return a handle.
SQL Engine ---> cursorHandle=1234 ---> Program
You can now use this slider handle to call this binary program and pass data to address - in this case, the new salary for a specific employee:
Program ---> execute cursorHandle 1234( 2,343.23, 1456 ) --> SQL Engine
Program ---> execute cursorHandle 1234( 4,000.53, 1457 ) --> SQL Engine
Program ---> execute cursorHandle 1234( 3,234.00, 1458 ) --> SQL Engine
Program ---> commit --> SQL Engine
And when done with this slider, the program tells the SQL engine to close the cursor, so the SQL engine can release the resources it uses for this cursor.
And these steps are the same if you are using SQL * Plus, Java, c#, or PL/SQL.
In PL/SQL, you can do this with an implicit cursor (you do not define the cursor in your code, PL/SQL does for you behind the scenes):
procedure UpdateSalary( newSalary number, empID number ) is
begin
update emp set salary = newSalary where emp_id = empID;
end;
-- in the main program
begin
.. code ..
UpdateSalary( 2,343.23, 1456 );
UpdateSalary( 4,000.53, 1457 );
UpdateSalary( 3,234.00, 1458 );
.. code ..
commit;
end;
Or you can do it in PL/SQL using an explicit cursor, where you are dealing directly with the slider handle itself.
Whatever it is, the interaction between the program and the SQL engine remains the same - you give a source SQL and it gives you a handle to the cursor.
Writing code of good performance means that you re - use this slider again and again and again - handle calling the same binary program, each time with different data to deal with.
How do NOT to IT--that this code creates 3 different sliders... to do exactly the same thing. This is not scalable, impact on performance and can cause problems with memory fragmentation in the SQL engine.
begin
update emp set salary = 2,343.23 where emp_id = 1456;
update emp set salary = 4,000.53 where emp_id = 1457;
update emp set salary = 3,234.00 where emp_id = 1458;
commit;
end;
Tags: Database
Similar Questions
-
I want to update the field of choice of option on the selection of another field of choice of option
Hello...
I want to update the field of choice of option on the selection of the value of the choice field another option.
Thanks in advance
Welcome on the support forums.
use
to set the new choices in the field. It should update automatically, otherwise you could try to call invalidate.
-
Change/update user field defined in a scheduled task
I wrote a notification task to send an e-mail to a manager who has used contract with a contract that expires.
Once we isolate a user with a contract about to expire, send us a notification to the Manager. The date on which the notification is sent must be stored in the USR in a field defined by the user, "USR_UDF_LASTSENT."
Update this field USR_UDF_LASTSENT, this is where I'm having trouble.
I tried to use the UserManager in a couple of ways. Suppose I've isolated a single user using SearchCriteria and the UserManager and have a single user called "currentUser" object I want to store a Date object in the field defined by the user "USR_UDF_LASTSENT". Date now = new Date();
I tried: currentUser.setAttribute ("USR_UDF_LASTSENT", today); It will work without error, but when I check the DB there is no change to the attribute.
With a defined instance of the UserManager userManager, I tried: userManager.modify ("USR_UDF_LASTSENT", today, currentUser); That errored out with this error - oracle.iam.identity.exception.NoSuchUserException: IAM - 3054135:No user found for criteria 2 USR_UDF_LASTSENT-9/24/13:58 PM.:USR_UDF_LASTSENT:9/24/13 14:58. Looks like he did a search rather than a change.
I also tried using the Manager of the entity in the following way:
Date now = new Date();
< String, Object > HashMap mapAttrs = new HashMap < String, Object > ();
mapAttrs.put ("USR_UDF_LASTSENT", today);
EntityManager entMgr = Platform.getService (EntityManager. class);
entMgr.modifyEntity ("user", currentUser.getEntityId (), mapAttrs);
But he returns this error: failure: oracle.iam.platform.entitymgr.UnknownAttributeException: User: [USR_UDF_LASTSENT]
Is my entityType, 'User' inappropriate in this case? What should be used here?
How can I set or update this user defined field from a scheduled task?
Thank you guys. I went to the system of identity and selected management console 'Export' below 'Management System' which, I think Kevin may have been referring to. I had a the AttributeDefinitions xml export for our user-defined fields. In this file, there is a header for the attribute I was looking for:
...
...
usr_udf_lastsent ...
I put the string 'LastSent' instead of USR_UDF_LASTSENT in the version EntityManager in my attempt at this task. I think that's what Kevin and delhi have come.
It does not work:
...
Date now = new Date();
HashMap
mapAttrs = new HashMap () ; mapAttrs.put ("USR_UDF_LASTSENT", today);
EntityManager entMgr = Platform.getService (EntityManager.class);
entMgr.modifyEntity ("user", currentUser.getEntityId (), mapAttrs);
...
But this fact:
...
Date now = new Date();
HashMap
mapAttrs = new HashMap () ; mapAttrs.put ("LastSent", today);
EntityManager entMgr = Platform.getService (EntityManager.class);
entMgr.modifyEntity ("user", currentUser.getEntityId (), mapAttrs);
...
I wonder if currentUser.setAttribute ("LastSent", today); would work... Hmm.
-
Trying to update a field with the RANK function
Hello world
I'm trying to update a field using a PL/SQL function rank. When I'm doing it, I get a "+ ORA-01427: einreihig subquery returns more than one row +", and it's just that sometimes I have the same value more than once.
All the world is facing this issue before? I mean try to update a field using the RANK function?
Please don't hesiate to contact me, if any additional information is required.
Best regards.
UPDATE spd_f_mkt_DC_2
SET RANKING_ID =)
SELECT PLUS RANK()
(
KPI_MKT_ID PARTITION
ORDER BY F_MKT_KPI DESC
)
OF SPD_F_MKT_DC_2
)UPDATE spd_f_mkt_DC_2 a SET RANKING_ID = ( SELECT rnk FROM ( SELECT ROWID rid, RANK() OVER(PARTITION BY KPI_MKT_ID ORDER BY F_MKT_KPI DESC) rnk FROM SPD_F_MKT_DC_2 ) WHERE a.ROWID = rid ) /
SY.
-
Update several fields... need advice.
Hi all
I have a bit of a problem with the update of several fields in a table...
Lets say we have two tables. Table one is called t_employe for example:
To set random data in the table:create table t_employe ( year number, line varchar2(1), counter number, value number)
OK second table would be:insert all into t_employe (year, line,counter, value) values(2011,'3','2946','3344') into t_employe (year, line,counter, value) values(2011,'3','2947','4433') into t_employe (year, line,counter, value) values(2011,'3','2948','4455') into t_employe (year, line,counter, value) values(2011,'3','2949','5544') select * from dual
Data:create table to_update ( year number, line varchar2(1), counter number, date_pos_1 date, value_pos_1 number, date_pos_2 date, value_pos_2 number, date_pos_3 date, value_pos_3 number, date_pos_4 date, value_pos_4 number, date_pos_5 date, value_pos_5 number)
OK, now what I want to do is to update the fields in the table to_update where value_pos is NULL. To explain this better imagineinsert all into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5) values(2011,'3','2946',sysdate,'5434',null,null,null,null,null,null,null,null) into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5) values(2011,'3','2947',sysdate,'11',sysdate,'123',null,null,null,null,null,null) into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5) values(2011,'3','2948',sysdate,'33',sysdate,'44',sysdate,'8908',null,null,null,null) into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5) values(2011,'3','2949',sysdate,'1',sysdate,'2',sysdate,'343',sysdate,'78',null,null) select * from dual
Collums are from left to right in the order value_pos_1, the value_pos_2, the value_pos_3... Now, I would check for each line
If value_pos_1 is null if it is then updated. Finist this row and move them to another. If not go to value_pos_2 in
same rank and check again if the null value. If it's updated, if not, again to go forward. Each value_pos_X cullum has a date_pos_x cullom
to be made same day as Value_pos_ cullums (if value_pos_X is null then date_pos_X coresponding will be null as well - is)
a fact in my table).
So is it feasible using only a single update?
I managed to write a select statement by using the clause of the case that makes these things perfectly only for value_pos_X fields. I wonder if I can use in my
Update statement?
Suggestions how to extract it from?select case when a.value_pos_1 is null then b.value else case when a.value_pos_2 is null then b.value else case when a.value_pos_3 is null then b.value else case when a.value_pos_4 is null then b.value else case when a.value_pos_5 is null then b.value else to_number('99999','9999,99') end end end end end as value from to_update a,t_employe b where a.year = b.year and a.line= b.line and a.counter = b.counter
Thank you!SQL> select * 2 from to_update 3 / YEAR L COUNTER DATE_POS_ VALUE_POS_1 DATE_POS_ VALUE_POS_2 DATE_POS_ VALUE_POS_3 DATE_POS_ VALUE_POS_4 DATE_POS_ VALUE_POS_5 ---------- - ---------- --------- ----------- --------- ----------- --------- ----------- --------- ----------- --------- ----------- 2011 3 2946 27-AUG-11 5434 2011 3 2947 27-AUG-11 11 27-AUG-11 123 2011 3 2948 27-AUG-11 33 27-AUG-11 44 27-AUG-11 8908 2011 3 2949 27-AUG-11 1 27-AUG-11 2 27-AUG-11 343 27-AUG-11 78 SQL> merge 2 into to_update a 3 using ( 4 select a.rowid rid, 5 b.value 6 from to_update a, 7 t_employe b 8 where a.year = b.year 9 and a.line= b.line 10 and a.counter = b.counter 11 ) b 12 on ( 13 a.rowid = b.rid 14 ) 15 when matched then update set value_pos_1 = nvl2(value_pos_1,value_pos_1,b.value), 16 value_pos_2 = nvl2(value_pos_1,nvl2(value_pos_2,value_pos_2,b.value),value_pos_2), 17 value_pos_3 = nvl2(value_pos_1 + value_pos_2,nvl2(value_pos_3,value_pos_3,b.value),value_pos_3), 18 value_pos_4 = nvl2(value_pos_1 + value_pos_2 + value_pos_3,nvl2(value_pos_4,value_pos_4,b.value),value_pos_4), 19 value_pos_5 = nvl2(value_pos_1 + value_pos_2 + value_pos_3 + value_pos_4,nvl2(value_pos_5,value_pos_5,b.value),value_pos_5) 20 / 4 rows merged. SQL> select * 2 from to_update 3 / YEAR L COUNTER DATE_POS_ VALUE_POS_1 DATE_POS_ VALUE_POS_2 DATE_POS_ VALUE_POS_3 DATE_POS_ VALUE_POS_4 DATE_POS_ VALUE_POS_5 ---------- - ---------- --------- ----------- --------- ----------- --------- ----------- --------- ----------- --------- ----------- 2011 3 2946 27-AUG-11 5434 3344 2011 3 2947 27-AUG-11 11 27-AUG-11 123 4433 2011 3 2948 27-AUG-11 33 27-AUG-11 44 27-AUG-11 8908 4455 2011 3 2949 27-AUG-11 1 27-AUG-11 2 27-AUG-11 343 27-AUG-11 78 5544 SQL>
Or yhis is perhaps more readable:
merge into to_update a using ( select a.rowid rid, b.value from to_update a, t_employe b where a.year = b.year and a.line= b.line and a.counter = b.counter ) b on ( a.rowid = b.rid ) when matched then update set value_pos_1 = case when value_pos_1 is null then b.value else value_pos_1 end, value_pos_2 = case when value_pos_1 is not null and value_pos_2 is null then b.value else value_pos_2 end, value_pos_3 = case when value_pos_1 + value_pos_2 is not null and value_pos_3 is null then b.value else value_pos_3 end, value_pos_4 = case when value_pos_1 + value_pos_2 + value_pos_3 is not null and value_pos_4 is null then b.value else value_pos_4 end, value_pos_5 = case when value_pos_1 + value_pos_2 + value_pos_3 + value_pos_4 is not null and value_pos_5 is null then b.value else value_pos_5 end /
SY.
-
Update the field Date according to the date of another field
Hi I have a field called "contract end Date" which I update manually according to the contract, and a field called "notify contract end Date" I want to be updated automatically with the "end of contract date" - 45 days.
Is this possible via workflow? can someone give me the syntax that works? If I want to manually insert the value of the field 'Date to end the contract to notify' it will overwrite it?
Thank you, DavidHello!
Create your workflow on your object type, select the before saving the trigger modification event, put the following condition:
[< contract end date >] <>MEADOW ("< the contract end date > '")
And in action, update the field End Date of the contract to notify with end Date of contract - 45 and check the replacement value. You contract end Date field must be with the type date.
I hope this will help, do not hesitate to ask for more!
Max
-
PDF form will not calculate the selected fields as soon as there is a numeric value entered.
All selected fields and as soon as there is a digital value entered, the total field displays nothing, not even a 0. It worked yesterday so I'm not sure what the question is today. I hesitate to do it again because this form has a ton of fields.
Things to check:
-That there is no error message in the JS Console
-The field calculation order is correct (IE, that there is no 'delay' in the order in which the fields are correct results)
-
Help with a script of positioning at the Center so it updates all fields?
Hello
At work, we use a form that the shows were each employee assigned for the day, I built. We have some personal part-time and I did it so that they appear in red where appear normal black of the employee. This works very well, my question is when a new employee is hired or going part-time full-time, I'll have to go into each field and change this script. There are 60 total frames so as you can imagine it takes a lot of time to update a single employee. Here is a sample of the script I use to designate if the name must be black (full time) or red (part-time).
Is it possible that I can point all the fields in one place? Then I have to only update a field and he difficulty all?
If (event.value == "BRACKETT" | ") Event.Value == "Deleted" | "
Event.Value == "P. BOWMAN" | "
Event.Value == "TILLER" | "
Event.Value == "Edwards" | "
Event.Value == "Mejia" | " Event.Value == "Rogers" | " Event.Value == "Laskey" | "
Event.Value == "Houser' |"
Event.Value == "Brooks" | "
Event.Value == "Gordon") event.target.textColor = color.red; "
else event.target.textColor = color.black;
Thank you very much
David
Here's what the function should look like when you place the code in a JavaScript document:
function validateEmpName() {}
If (event.value == "BRACKETT" | ") Event.Value == "Deleted" | "
Event.Value == "P. BOWMAN" | "
Event.Value == "TILLER" | "
Event.Value == "Edwards" | "
Event.Value == "Mejia" | " Event.Value == "Rogers" | " Event.Value == "Laskey" | "
Event.Value == "Houser' |"
Event.Value == "Brooks" | "
Event.Value == "Gordon") event.target.textColor = color.red; "
else event.target.textColor = color.black;
}
Then, call this function in the Validate event each field like this:
Custom script validate
validateEmpName();
I chose this name of function, because he had a sense, but you are free to name it anything you want.
-
Import Format script to update multiple fields
Following my previous post yesterday (Import Format script required for work in several areas , now I need my script import to Update several fields (two) at the same time, based on criteria across multiple fields. ) So far, I can use DW. Utilities.fParseString to assess values across several fields, but now I need to update not only the field in question, but also an additional field at the same time. For example:
Function TBService (strField, strRecord)
"How to upgrade a second field at the same time?
Dim strField2 As String
If left (strField, 1) = "S" Then
If DW. Utilities.fParseString (strRecord, 3, 8, ',') = 'B1110"Then
strField2 = "N101.
On the other
strField2 = 'network n/a '.
End If
TBService = strField
On the other
TBService = "Service s/o".
End If
End Function
Is it still possible? Should I look for to create an event script that would work subsequent to importation? Or is it possible here in the import script?The second field you are trying to manipulate should have its own import script.
-
Why can I I cannot access the update selection 11 el update server?
Understand that there is an update of ACR for 11 items but when I go to the "update" selection in the Editor Help menu I always get the message that the update server is not available. You will never have this problem with other Adobe products.
No microsoft adapters are present. It uses the buil - in Realtek wireless card.
8 windows currently running on this computer.
I will go and try on my desktop which is still under windows 7 and let you know.
-
Script for updating a field for the current year
Is it possible to have an update of field at the end of the current year? Example 20-(dashes to change it for any year). I think that it is not possible, but if anyone knows how this is possible I'd really appreciate help. Thank you
Sorry, I guess I need to change throughout the year, not only at the end. Thank you
I tried a few scripts that I found here, such as; year (dateAdd ("yyyy", 1, now()))) with no luck. I confess that I don't know about scripts and can be a bad thing. The script goes on the Action tab as a javascript or somewhere else (validation?) Any advice or assistance would be appreciated. I use Acrobt Pro version 9.
Going by your post you wanted the year is displayed in a text field, I gave the code to go into the script will count for this field. If you want to use it somewhere else (e.g. a mouseup), then use the variable 'year' in this script. In a calculation script, any value you assign to "event.value" is what will show on the field during the calculation.
-
I would like to be able to apply the spelling correction of selected fields in the forms I created using LiveCycle Designer 8.2 at runtime, as opposed at design time. I understand that version 8 LCD has a spelling corrector new OWL for form designers. But I want to say check the data entered by users using Acrobat Reader. And I want to apply the spelling correction automatically on only selected fields.
Currently it seems that fill out my forms, users must know how manually right-click on each field, and then select "Spell Check" from the dialog box to check spelling mistakes in the data that the user entered into the form.
I would like to discover a way to apply the correction spelling in certain areas, as well as I am able to do in forms created using Acrobat Pro. Acrobat Pro, I can set a property for each field to require the spell check. but this feature seems to be missing in Livecycle Designer.
I have check the object model for XFA forms hoping I could find a method I can call a JavaScript file, check the spelling based on an event such as onBlur. But I have not found a method of spelling.
Am I missing something simple? Is there a way to define each field out controls when a user is filling out the form using the free software Acrobat Reader?
Our users are not sophisticated and forcing spell check each field separately just doesn't cut it...
Any help on this will be greatly appreciated.
Thank you!
-David Bartholomew
Hi David,
Two things...
At design time has set the locale of the form to that coming out Acrobat checks. For example the locale English (United States) and English (United Kingdom) have Spellers; However the English (Ireland) does not work. Check the warnings tab to see if the spell checking is supported for your locale.
If your locale form supports spell checking, so you can go to the script of the button below.
If you form local does NOT support spell checking, Stephanie has a great work-around to force spell (http://forums.adobe.com/message/2233945#2233945).
Put a normal button on the form and in the click event must have the following:
app.execMenuItem ("spelling: spell check");
Which will open the checker spelling for all fields. Thanks to Paul for extract all elements of menu available (http://forums.adobe.com/message/1912914#1912914).
Good luck
Niall
-
Model outfit do not update form fields
I use a model defined in the ActionScript code that refers to a gateway, DAO and beans that are extracted variations of a ColdFusion example generated by the wizard. I am able to release and to see that data comes back fine from the remote call, and my < model > object data is correct, because I use Alert.show () to see. However, even if the data in the mxml model are visible and correct, is not to update the fields that are related to IT... with one exception...
In fact, it works if I hit "Refresh" browser after loading at once. However there is another issue with the update, as the history.js file is apparently causing the page to keep refreshing until randomly, it stops or stops on a javascript error ["line: 494-'null ' is null or not an object]. To the point where it stops, I am able to pull up data without a problem.
I use a Flex Builder "generated by the Wizard" project of ColdFusion as a reference and the only difference I see is that they use a WindowManager to bring up the form with the data in it. I hope that's not the problem, but before I'll rebuild my application in this way, I'd love to hear if anyone else has had a similar experience, or it recognizes my problem.
Related to the data in a model had to be updated somehow? I appreciate all help.
I just tested on FireFox and got the same results. It loads only after a refresh. -
Using a variable as a SELECT field
I try to get shipping to a different weight and postal codes. I query a table to get a zip code provided by the user area. This works. Then, I want to use this area to retrieve the shipping cost for a specific weight of another table. I put the box as a variable and use it as follows: SELECT #Zone # FROM Ground WHERE Wt = weight # #. If I use the name of the actual area instead of the variable, everything works fine. When I use the variable, however and try out of her results with the variable #Zone #, I get the original name in the field name box, not the rate that is listed under this domain name
It is good to use a variable of the way I have? If so, how to get the result? If not, is there another way to get a field name for a query from another query? Thank you.You can use a variable to dynamically change the select field, but it is rarely a good idea.
Here's how you would do in this case:
SELECT
#Zone # AS ShippingEstimate
Of
On the ground
WHERE
WT = #weight #.
#weight # kilograms, to the shipping area: #Zone #, cost #MaintenanceNightmare.ShippingEstimate # Euros.
The suggestion to normalize your database, was a good thing.
-
Asynchronous flash chart where update select list value changes
Hi devs,
I groped with flash graphics with dynamic when update select list point of changes in value.
First of all, I used the function of Denes Kubicek [http://htmldb.oracle.com/pls/otn/f?p=31517:229 | http://htmldb.oracle.com/pls/otn/f?p=31517:229:3039869356317498] update the value of the session from my dynamic selection list after change:
That has worked well. Then has been to change the update interval chart flash and:<script language="JavaScript" type="text/javascript"> function fnc_setItem (pItem) { var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=dummy',0); get.add(pItem,$x(pItem).value) gReturn = get.get(); get = null; } </script>
Home > Application Builder > application 150 > Page 1 > Flash chart attributes > update >
Asynchronous update = Yes
Update interval (seconds) = 5
My report is automatically updated every 5 seconds. But how can I make it work just with the change in the value of the selection list?
The function is used to refresh the report: apex_RefreshChart (1, '2258227549390282', ' de');
Patrick Wolf was a good example for her: [http://www.inside-oracle-apex.com/auto-refresh-flash-charts-in-apex-30/ | http://www.inside-oracle-apex.com/auto-refresh-flash-charts-in-apex-30/]
But I couldn't make it work properly.
Thanks in advance
TobiasHello Tobias,.
Having defined with function of the Dene session state, you can refresh the table to help:
apex_RefreshChart ($v ('pFlowStepId'), $v('Pxx_REGION_ID').substr (1), navigator.language);
PXX_REGION_ID is the ID of the region of the chart area. You can set that in the bottom of the region to help;
$s ("Pxx_REGION_ID", "#REGION_ID #");
See [example: http://apex.oracle.com/pls/otn/f?p=41715:29]
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this response in marking it as useful or Correct ;-)
Maybe you are looking for
-
Available to add the second internal hard drive to 17-e117dx
Hello Can you let me know, if there is provision to add the second internal hard drive for HP Pavilion e117dx 17. If so, one) is there requirments or the specifications of the hard disk (any make or model); (b) what equipment will be needed and where
-
Several cameras for machine vision
We would like to use Vision Builder I do Visual inspection of our products. Due to the large size of the object, we might need several cameras to do this. Is it possible to use information from several cameras to Vision Builder or do I have to use se
-
Windows Live Photo Gallery does not recognize my CD/DVD burner. How can I fix?
I installed Live Photo Gallery (twice), but it does not recognize my CD/DVD burner, which works OK otherwise. How can I fix? PCubedP
-
I searched this but have not found exactly the same problem I'm on a laptop with Windows 7. Recently, we changed our server to be online only. This means that all of our readers are now thanks to dropbox or something similar. A disc remained in my re
-
Scroll effects for adobe edge animated and responsive design
HelloHow can I stop "Animation" with piece on parchment for the animate and make sensitive edge elements.Thank you