By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 3,274 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

Clarify Me

ilikesuresh
P: 47
Hi
i write a program in Pro *C to increase the salary of employees based on some constraints.
Its works fine and if i execute the program in the first time the salaries would be increased depending on the constraints.But if i execute immediately the second time, the updated values have been treated as a old value and again the salaries are incremented.Is there any specific way to ensure this if the update happens continuously on the second time the program or oracle through errors,exceptions?

Please clarify me
Oct 4 '07 #1
Share this Question
Share on Google+
6 Replies


amitpatel66
Expert 100+
P: 2,367
Hi
i write a program in Pro *C to increase the salary of employees based on some constraints.
Its works fine and if i execute the program in the first time the salaries would be increased depending on the constraints.But if i execute immediately the second time, the updated values have been treated as a old value and again the salaries are incremented.Is there any specific way to ensure this if the update happens continuously on the second time the program or oracle through errors,exceptions?

Please clarify me
Could you please POST the table structure, Constraints that you are talking about for my reference and any other related details!!
Oct 4 '07 #2

debasisdas
Expert 5K+
P: 8,127
If you are executing the command command 2 times it is bound to fire 2 times. If u want only once why are you executin that 2 times . The update command will fire every time you execute that and will reflect in the database table.
Oct 4 '07 #3

ilikesuresh
P: 47
Could you please POST the table structure, Constraints that you are talking about for my reference and any other related details!!
LASTNAME Varchar2(20)
DEPTID Number(2)
SALARY Number
EMPID Number(3)
MGRID Number(3)
HIREDATE date

That is the table structure
and the constraints in the sense if the salary > 10000 and < 20000
salary = salary +1000
if >=20000 and <30000
salary = salry +2000

Thats all !!!
Oct 4 '07 #4

amitpatel66
Expert 100+
P: 2,367
LASTNAME Varchar2(20)
DEPTID Number(2)
SALARY Number
EMPID Number(3)
MGRID Number(3)
HIREDATE date

That is the table structure
and the constraints in the sense if the salary > 10000 and < 20000
salary = salary +1000
if >=20000 and <30000
salary = salry +2000

Thats all !!!
Every time you run the update, the salary will get incremented until it goes above 30,000. Once it reaches 30,000 the salary will not increment as per your constraints. Now if you want the update tp happen only once on each row, then you can have one more column as a flag which you can default to 'N'.

When updating salary, check for flag value. If 'N' then update the flag to 'Y' and the salary. If flag is 'Y' then dont update anything.
Oct 5 '07 #5

ilikesuresh
P: 47
Every time you run the update, the salary will get incremented until it goes above 30,000. Once it reaches 30,000 the salary will not increment as per your constraints. Now if you want the update tp happen only once on each row, then you can have one more column as a flag which you can default to 'N'.

When updating salary, check for flag value. If 'N' then update the flag to 'Y' and the salary. If flag is 'Y' then dont update anything.
Thanks for Your valuable advice.But Is there any possiblities to hide the flag column from user view other than creating 'views'?
Oct 5 '07 #6

debasisdas
Expert 5K+
P: 8,127
Thanks for Your valuable advice.But Is there any possiblities to hide the flag column from user view other than creating 'views'?
No, you need to create views for that.
Oct 5 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.