Hi there
Ur query is :
update payments p
set p.salary = (select amount from diffs d where d.pfno = p.pfno)
For each record from ur payments table, the pfno is matched with diffs table
and corresponding amount is updated as salary. As for each PF no in
payments, there will be an entry in payments table, therefore this is
happening.
If u perform the below query:
select pf_no from payments
minus
select pf_no from diffs
u will find nothing.
Rgds
-----Original Message-----
From: HRproject [mailto:[Email Address Removed] Friday, August 29, 2003 1:14 PM
To: LazyDBA.com Discussion
Subject: RE: Update Statement (Thank you)
Thank you for your overwhelming responses and suggestions. I have
decided to use PL/SQL. Apparently my update statement is updating the
correct rows but I am still worried as to why it is updating all the
rows. Some of you told me that there was nothing wrong with my
statement I tend to agree with you but I would still like to know whay
this statement is not working as expected.
Again Thanks.
Irene
-----Original Message-----
From: HRproject
Sent: 29 August 2003 09:15
To: LazyDBA.com Discussion
Subject: Update Statement
Hello
The weeks semms to be getting worse.
Please tell me what could be wrong with this statement.
update payments p
set p.salary = (select amount from diffs d where d.pfno = p.pfno)
Payments has 3885 records and diffs has 43 records
The above statement is updating 3885 records while it should only be
updating 43 records. There are no duplicates in both the tables.
________________________________________________________________________
___
DISCLAIMER:The information contained in or accompanying this e-mail is
intended for the use of the stated recipient only. It may contain
confidential,proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error,please immediately delete it and
all copies of it from your system, destroy any hard copies of it and
notify the sender. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the
intended recipient.
Any views or opinions presented herein are solely those of the author
and do
not necessarily represent those of the Nation Media Group.
________________________________________________________________________
___
--------
Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to oracledba-[Email Address Removed] subscribe: send a blank email to oracledba-[Email Address Removed] the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
___________________________________________________________________________
DISCLAIMER:The information contained in or accompanying this e-mail is
intended for the
use of the stated recipient only. It may contain confidential,proprietary
or
legally privileged information. No confidentiality or privilege is waived
or
lost by any mistransmission. If you receive this message in error,please
immediately delete it and all copies of it from your system, destroy any
hard
copies of it and notify the sender. You must not, directly or indirectly,
use,
disclose, distribute, print, or copy any part of this message if you are not
the intended recipient.
Any views or opinions presented herein are solely those of the author and do
not necessarily represent those of the Nation Media Group.
___________________________________________________________________________
--------
Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to oracledba-[Email Address Removed] subscribe: send a blank email to oracledba-[Email Address Removed] the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
----------------------------------------------------------- NOTICE
------------------------------------------------------------
This email and any files transmitted with it are confidential and are solely
for the use of the individual or entity to which it is addressed. Any use,
distribution, copying or disclosure by any other person is strictly
prohibited. If you receive this transmission in error, please notify the
sender by reply email and then destroy the message. Opinions, conclusions
and other information in this message that do not relate to official
business of NIIT shall be understood to be neither given nor endorsed by
NIIT. Any information contained in this email, when addressed to NIIT
Clients is subject to the terms and conditions in governing client contract.
Oracle LazyDBA home page