Doesn't this basic FK constaint lead to catch22 scenario?
Version:11g
What would you do if you wanted to UPDATE a column in the parent table like the one below?
Its a bit of CATCH-22 situation. I can't update the parent table without updating the child table and i can't update the child table without updating the parent table.
create table parent
(identity number,
ename varchar2(45)
alter table parent
add constraint parent_PK primary key (IDENTITY);
insert into parent values (600,'John');
insert intp parent values (700,'Steve');
create table child
(child_id number,
domainid number,
emp_city varchar2(45)
alter table child
add constraint child_FK1 foreign key (domainid)
references parent (IDENTITY);
insert into child values (1,600,'Amsterdam');
SQL> select * from parent;
IDENTITY ENAME
600 John
SQL> select * from child;
CHILD_ID DOMAINID EMP_CITY
1 600 Amsterdam
SQL> update parent set identity=700 where identity=600;
update parent set identity=700 where identity=600
ERROR at line 1:
ORA-02292: integrity constraint (SCOTT.CHILD_FK1) violated - child record found
SQL> update child set domainid=700 where domainid=600;
update child set domainid=700 where domainid=600
ERROR at line 1:
ORA-02291: integrity constraint (SCOTT.CHILD_FK1) violated - parent key not found
You can use a deferred constraint
Constraint is checked at commit instead of at the end of the DML...
SQL> alter table child
2 add constraint child_FK1 foreign key (domainid)
3 references parent (IDENTITY)
4 INITIALLY DEFERRED;
Tabella modificata.
SQL> insert into child values (1,600,'Amsterdam');
Creata 1 riga.
SQL> select * from parent;
IDENTITY ENAME
600 John
SQL> select * from child;
CHILD_ID DOMAINID EMP_CITY
1 600 Amsterdam
SQL> update parent set identity=700 where identity=600;
Aggiornata 1 riga.
SQL> select * from child;
CHILD_ID DOMAINID EMP_CITY
1 600 Amsterdam
SQL> commit;
commit
ERRORE alla riga 1:
ORA-02091: transaction rolled back
ORA-02292: integrity constraint (BUONI.CHILD_FK1) violated - child record found
SQL> update parent set identity=700 where identity=600;
Aggiornata 1 riga.
SQL> update child set DOMAINID =700 where DOMAINID =600;
Aggiornata 1 riga.
SQL> commit;
Commit completato.Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/]
Edited by: Massimo Ruocchio on Jan 18, 2010 10:06 AM
Similar Messages
-
CS5 doesn't offer basic audio functionality (playback stops on page turn)
I would like to place a sound file and in the exported pdf have the sound file play (via button or playback toolbar), without stopping on page turn. To me, this is a very basic function to ask for. But guess what? CS5 can't do it. Turn the page and the sound stops. Is a workaround converting the sound to a video file? Possibly, but any converted file (to avi or mp4 containers for example) gets an error message when I tried to place it. My question is, can anyone make this basic function work? If not, my second question is, where would I go to submit this issue to developers. Also, I understand it's possible to address this issue on acrobat, but this is not feasible when we're talking about hundreds of audio files in a document.
Hi publicduck, I'm not sure if you meant you embedded swfs or if you exported from indesign to swf with an html file. But your suggestion helped, because after being unable to find any audio format that didn't stop playing on page turn (without the use of a playback controller), I tried exporting to swf instead of pdf, and for some reason, in swf, opened as an html file in firefox, I was able to click on the button to start the mp3, and turn the page, while the mp3 continued. So thanks!
-
I have an Iphone 4, buy my software update says iOS 5.1.1. Doesn't this mean that I have an Iphone 4S?
iOS 5.1.1 supports
iPhone 4S
iPhone 4
iPhone 3GS
iPad 2
iPad
iPod touch (4th generation)
iPod touch (3rd generation)
So, you do not have to worry. You've still got iPhone 4 only. For more information regarding iOS 5.1.1 update visit this link http://support.apple.com/kb/DL1521 -
Why doesn't this update work?
Why doesn't this update work? Can't I sum up two select count(*) in such a subquery?
Thanks
update sales T
set T.field2 = ((select count(*)
from sales t
where t.field1 = trunc(sysdate)) + (select count((*)
from sales t2
where t2.field2 is null));
I get
ERROR at line 4:
ORA-00907: missing right parenthesis
with the * under the +
In other words I want to run
update sales set field = ((select count(*) ..... ) + (select count(*) ..... ))
Edited by: Mark1970 on 26-mar-2010 1.37
Edited by: Mark1970 on 26-mar-2010 1.38My problem is to undestand why I got a syntax error about parenthesis.Because you cannot perform arithmatic operation with a value coming from a subquery in a SET clause of UPDATE
SQL> update emp
2 set sal=(select 1 from dual)+1;
set sal=(select 1 from dual)+1
ERROR at line 2:
ORA-00933: SQL command not properly ended
SQL> select sal from emp
2 where deptno=(select 10 from dual)+10;
SAL
800
2975
3000
1100
3000
SQL> select deptno,sal from emp
2 where deptno=(select 10 from dual)+10;
DEPTNO SAL
20 800
20 2975
20 3000
20 1100
20 3000Try such few examples..
Twinkle -
DIFFERENCES between BASIC SCHEDULING and LEAD-TIME SCHEDULING.
Hello SAP Gurus,
Kindly let me know the differences between BASIC SCHEDULING and LEAD-TIME SCHEDULING.
Looking for your early feedback.
Warm regards,
Kaushik.Hi,
Basic scheduling :
1.Basic dates are calculated.
2.Exact to day.
3.No cap reqmts are generated.
4.uses the inhouse production time from material master.
5.carried out automatically during planning run.
In basic date calculation ( order start date/ order finish date ) the system always
calculates backward scheduling.
1. From the reqmts date the system subtracts the GR processing time to
calculate the order fininsh date.
2. From the order finish date the system subtracts the inhouse production time to calculate the order start date.
3. From the order start date the system subtracts the opening period given in scheduling margin key to calculate the order opening date.
Lead time scheduling :
1.Exact to second
2.ie production start date /time and finish date and time are calculated.
3. cap reqmts are generated.
4. uses times from routing.
5. carried out only if the scheduling mode in MD02 screen is kept with indicator 2.
From the order finish date the system subtracts the float after production to calculate the production finish date.
From the production finish date the individual operations in the routing are scheduled backwards to calculate production start date.
From the production start date the system subtracts the float before production
to calculate order start date.
Regards,
nandha -
Why won't apple allow current "AppleCare" holders upgrade to "AppleCare "? Doesn't this seem unfair for such a giant in the tech industry to not offer such an opportunity?
Sorry - not understanding. What do you mean by "upgrade"? When you purchase an Apple Product, you get AppleCare automatically - 90 Days of Telephone Support, and a 1-Year Warranty.
You can then purchase an AppleCare Protection Plan for Mac, iPod, and Apple TV, or AppleCare+ for iPad or iPhone.
AppleCare Protection Protection Plans can be purchased any time within the 1-year warranty period.
Apple+ must be purchased within 30 days of purchase.
AppleCare Protection Plan extends the warranty to 3 years for Macs, and to 2 years for Apple TV and iPod.
AppleCare+ extends the warranty to 2 years for iPad and iPhone.
There is no "upgrade"....You either purchase the extened warranty protection plan or you don't. And unlike most extended warranty plans, you are NOT required to purchase it at the time you purchase your Apple product.
What's the beef here?
GB -
Please reply to this basic question....
i am using java version 1.4.1
In java home directory it contains bin and jre forlders.
In both of the folders java.exe file is there.
What is the use of having the same file in both directiory......
Please reply to this basic question....One probaly came with the JDK, and one came with the complete JRE that's included in the JDK...
-
Why doesn't this i phone (5c( give me automatic audible notice of an email ?
Michele,
Launch Settings / Notifications Center. There you can alter how the system notifies you. Then scroll down to Mail and adjust its specific notification type.
Also make sure that the Alert sound is turned up in the Sounds portion of Settings.
-Alan -
I have multiple iPhoto albums, so this move is pushing thousands of pictures to each library. Why doesn't this come with a "No, Thanks!" option since I've ALREADY ensured the MobileMe albums were captured? I've never seen Apple force an action like this!
Worse - According to http://support.apple.com/kb/TS4328, "photos you published to MobileMe from your library may be moved from their original events into a new event called "From MobileMe"." - so the forced move has probably scrambled my events in every library. The 'fix'? Search for matching photos and if not found, copy and paste into the desired event. It will take DAYS for me to recover from this undesired and ill-considered forced action.Load your backup from just before this and when you launch iPhoto click on learn more. Go back to iPhoto and in the iPhoto preferences remove all references to MM and do likewise in the system preferences
LN -
Basic Excise Duty + VAT and Basic Excise Duty + CST in Indian Scenario
Friends,
How weu2019ll manage Basic Excise Duty + VAT and Basic Excise Duty + CST in Indian Scenario.
Thanks Expert,
Sukhjinder SinghHi,
In SAP B1, we dont have separate column/table to give Excise / VAT /CST as input. Hence, in SAP B1 we have to give this input of ExciseVAT or ExciseCST as combination.
This combination can be prepared using following path---
Administration--->setup>financial-->Tax
Please reply incase of any problem.
Regards,
Abhishek -
Please help me with this basic JSF question!
Hi,
I m creating a JSF website using Sun Studio Creator, i think the problem i have is quite basic, after a bit research, i still couldn't solve it, i hope someone can help me here, thanks.
This is the scenario:
There are 2 buttons on the page, B1 and B2, when the user clicks on the B1 button, a list box will show up, let's call it List1, say in a light box, but it really doesn't matter where the list box is. There are some options in the list box, when the user clicks on one of the options, another list box will be shown and filled up by an Ajax call to a Servlet, let's call this one List2. Now the user should select one of the options from List2, and click on the button B2, the server should then do something based on the options selected in List2
My problem is how to get the selected value in List2. Normally, if the list box is created in Studio Creator, i can do this:
// this is in the Java file
private Listbox listBox = new Listbox();
public void setListBox ...
public Listbox getListBox ...
public String B2_action() {
Object selectedValue = listBox.getValue();
getSessionBean1().setListBoxSelectedValue(selectedValue);
// do something on the server
...this is what i normally do, but now the List Box is generated by Ajax, there is no such object in the Java file, how can i get the component and do the same thing as above sample does?
Thanks for your help!
best regardsI guess you can first define a pointer to the listBox2, then create instance of it in the action method. After that it won't be problem to reach the selected item.
// this is in the Java file
private Listbox listBox1 = new Listbox();
private Listbox listBox2; //Instance may be created here, I am not sure
public void setListBox1 ...
public Listbox getListBox1 ...
public String B2_action() {
private Listbox listBox2 = new Listbox(); //or instance may be created here
}Edited by: mkahraman on Feb 19, 2008 4:09 AM -
Can anyone say why this basic PB crashes AE?
Hi,
I wrote a basic light wrap filter - it works in PB but crashes AE immidiately when I apply the filter to a layer.
<languageVersion : 1.0;>
kernel efx_lightwrap
< namespace : "efx LightWrap";
vendor : "EFX Filip Kaczorek";
version : 1;
description : "LightWrap";
displayname : "EFX LightWrap";
category : "EFX";
>
dependent float maxd;
dependent float fgam;
input image4 src;
output pixel4 dst;
parameter float thr
<
minValue: 0.0;
maxValue: 0.99;
defaultValue: 0.99;
aeDisplayName: "alpha threshold";
>;
parameter int rad
<
minValue: 0;
maxValue: 20;
defaultValue: 1;
aeDisplayName: "radius";
>;
parameter float gam
<
minValue: 0.0;
maxValue: 1.0;
defaultValue: 1.0;
aeDisplayName: "falloff shape";
>;
parameter float ammount
<
minValue: 0.0;
maxValue: 1.0;
defaultValue: 1.0;
aeDisplayName: "ammount";
>;
parameter pixel3 lightcol
<
minValue: pixel3(0.0,0.0,0.0);
maxValue: pixel3(1.0,1.0,1.0);
defaultValue: pixel3(0.0,0.0,1.0);
description: "Light color.";
parameterType: "colorRGB";
aeDisplayName: "Light color";
aeUIControl: "aeColor";
>;
void evaluateDependents()
maxd=distance( float2(0.0,0.0),float2(float(rad),float(rad)) );
fgam=8.0*gam-7.0;
pixel4 check(pixel4 this_p){
float dist=9999.0;
this_p.a=0.0;
pixel4 p=pixel4(0.0);
float td=0.0;
int i=0;
int j=0;
for(i = -rad; i <= rad; i++)
for(j = -rad; j <= rad; j++)
p=sampleNearest(src,outCoord() + float2(float(i),float(j)));
if(p.a<thr){
td=distance( float2(0.0,0.0),float2(float(i),float(j)) );
if(dist>td){dist=td;}
if(dist<9999.0){
this_p.a=1.0-(dist/maxd);
this_p.a=pow(this_p.a,(1.0-fgam));
this_p.rgb=lightcol;
return this_p;
void
evaluatePixel()
pixel4 s_pix=sampleNearest(src,outCoord());
pixel4 t_pix=s_pix;
pixel4 lw_pix=s_pix;
if(s_pix.a>thr){
lw_pix=check(lw_pix);
if(lw_pix.a>0.0){
t_pix.rgb=s_pix.rgb+(lw_pix.rgb*pixel3(lw_pix.a*ammount));
dst = t_pix;
After some experimenting I think it has something to do with sampling the input image inside the check() function.
If I replace the sampled values with constant ones - it doesn't crash.
If I move all the calculations up to the main evaluatePixel() function - it doesn't crash.
I'd call it a day with that conclusion if it wasn't for the fact that this is basically my template PB and I have many PB filters built exactly the same way that don't crash.
Including a Gaussian Filter that does way more sampling within its sub-function.
So any ideas?In Pixel Bender it runs in both modes.
It crashes on 3 different machines, although all HP
Two different workstations and a laptop (so xeons and i7, FireGLv5600, Quadro 4800, GF230 mobile).
All Win7 x64 and AE CS5.
Like I said, it crashes AE even if I strip the code to only one line in the function: p=sampleNearest...
This seems to be the only thing that gives problems.
Weird thing, THIS IS almost my template filter - I start all my filters looking like that and that one is THE ONLY ONE crashing???
The solution i found was to move the code into the main body - not use a subfunction. Now it works great, though the esthetics of the code suffer -
Why doesn't this cycle work?
drain = true;
onEnterFrame = function(){
if(drain == true){water_mc.waterlv_mc._alpha -= 2;}
if(water_mc.waterlv_mc._alpha < 3){water_mc.waterlv_mc._alpha += 2; drain = !true;}
if(water_mc.waterlv_mc._alpha > 97){drain = true;}
the basic idea is simple, it empties and fills as the frames progress, but It seems to empty and stop when tested. What's going wrong?shintashi,
When code performs in unexpected ways, your best bet is often to do a bit of troubleshooting. One of the quickest, easiest ways to troubleshoot your code is to use the trace() function, which lets you "see" what's going on in your code. For example, try adding the following trace statement to your existing code:
drain = true;
onEnterFrame = function() {
trace(water_mc.waterlv_mc._alpha);
if (drain == true) {
water_mc.waterlv_mc._alpha -= 2;
if (water_mc.waterlv_mc._alpha < 3) {
water_mc.waterlv_mc._alpha += 2;
drain = !true;
if (water_mc.waterlv_mc._alpha > 97) {
drain = true;
When you test your movie again, you'll see the value of waterlv_mc's _alpha property in the Output panel, which might be an eye-opener for you. First, you'll notice that the _alpha property doesn't decrement by 2s, which is one of the quirks of ActionScript 1.0/2.0. The reason for this -- and this is just "one of those things" it's good to know -- is that the _alpha property is stored internally as a value from 0 to 256. The _alpha property "translates" those internal values for you to a range of 0 to 100, which is why the values veer from perfect integers.
This is a bit of a tangent, though, because the real reason waterlv_mc never "refills" is that your if() statements aren't actually set up to accomplish what you want them to. Compare the original code with the following variation:
var drain = true;
onEnterFrame = function() {
trace(water_mc.waterlv_mc._alpha);
if (drain == true) {
water_mc.waterlv_mc._alpha -= 2;
} else {
water_mc.waterlv_mc._alpha += 2;
if (water_mc.waterlv_mc._alpha >= 100) {
drain = true;
if (water_mc.waterlv_mc._alpha <= 0) {
drain = false;
In this case, the first if() statement either decrements or increments (thanks to an else) all in the same statement, depending on the value of drain. First and foremost, you're either decreasing or increasing the value of waterlv_mc's _alpha property. After that, another set of if() statements determines the value of drain. When _alpha is 100 (or higher!) you definitely want to "drain the water," so the drain variable is set to true. On the other hand, when _alpha is 0 (or lower), you want to "refill," so drain is set to false.
Let me know if this makes sense to you!
David Stiller
Contributor, How to Cheat in Adobe Flash CS4
http://tinyurl.com/dpsCheatFlashCS4
"Luck is the residue of good design." -
Why doesn't this simple applescript work any more in ML mail.app (as a rule)
It works only when you right click on the mail message and choose "run rules", but not on incoming messages (without interaction).
The first dialog is shown both when incoming or running manually, but the second dialog (with the id) is only shown when running manually. Nothing is shown in console.log
Any ideas?
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with theMessage in theMessages
display dialog "inside"
set theId to id of theMessage
display dialog "the id is " & theId
end repeat
end tell
end perform mail action with messages
end using terms fromMight it be that any incoming message doesn't have an ID yet ?
Try this:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with theMessage in theMessages
display dialog "inside"
set theTest to (exists id of theMessage)
display dialog theTest
end repeat
end tell
end perform mail action with messages
end using terms from -
What is wrong with this basic line?
This line doesn't compile for me:
assert true : "y";Here is the message:
warning: as of release 1.4, assert is a keyword, and may not be used as an identifier
assert true : "y";
^
not a statement
assert true : "y";
^
';' expected
assert true : "y";
^
I am just trying to learn how to use assert. Some Java tutorial http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html
makes me think my statement should work.
Thanks.You didn't look at a single one of those items in the search, did you?
Ok, here's another link. You will have to read it for yourself though
http://java.sun.com/developer/JDCTechTips/2002/tt0409.html
Maybe you are looking for
-
Help with validation on a manually created tabbed form
version 4.1.1.00.23 Hello, I have a manually created tabbed form that I'm having trouble creating validation on. The page is a Resource Staffing page where PM's can forecast the Resources that will be needed for various projects. The forecast can be
-
When using Apple TV the mirror feature works fine on my iPhone, my daughters ipad and my wife's ipad mini but on my ipad I can only get certain bits to work ie photos, you tube but it will not mirror home screen or photos albums
-
ITunes Constantly "Not Responding" in Windows 8
Hi all, iTunes has been giving me problems for the past while, constantly running incredibly slowing, and showing as "not responding" in my task manager. PC is more then capable (processor, ram, etc, etc) of running it. I've tried the basic things, d
-
For those who complain about no Stop but
If you haven't figured it out already, pressing the Pause button then the Next button is the equivalent of a stop button. It returns the current song to the beginning. I guess Creative ran out of buttons for a stop button and had to use that instead
-
Left Alt+Shift combination
When I click left Alt+Shift in order to change keyboard language, the Edit window (either in Code or in Design view) looses the focus, so I can't type anymore. I have to use the mouse (click where the text should be) and then start typing again. Plea