Topic: SQL*Plus and PL/SQL >> Help!.. Analysing the query...
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| Title: Help!.. Analysing the query... |
| Naga |
Posted: Jan 09, 2007 03:53:08 AM |
Total Post: 7
Joined: Jan, 2007
|
SELECT account_id, NVL(previous_balance, 0) * .009 "finance_charge",
NVL(new_purchases, 0) + (NVL(previous_balance, 0) * 1.009) - NVL(payments, 0) "current balance"
FROM account
WHERE (new_purchases + (previous_balance * 1.009)) - payments >credit_limit
AND account_id BETWEEN 1500 AND 2000
I need to display all the records between account id 1500 and 2000 and having their current balance > than the credit balance.
Is the current balance calculated correctly...
In select clause to calculate i gave nvl function but to check in the condition no nvl so would it make any difference to get the records.. |
|
|
dinesh |
| Posted: Jan 11, 2007 02:17:20 AM | |
|
Total Post: 19
Joined: Jan, 2007
|
Hi Naga
The current balance is calculating correctly only.
if ur using NVL in the where condition also it won't
affect the desire results.
Thanks
Dinesh
|
|
|
|
|
Naga |
| Posted: Jan 19, 2007 08:02:50 AM | |
|
Total Post: 7
Joined: Jan, 2007
|
Hi Dinesh,
i have not used nvl function so if any column value is null it should affect the selection of rows.. I guess... i want rows with (current balance > than the credit balance).
Say if any one column is null ofcourse there would be no miscalculation in select clause due to nvl function but in where condition if any column value is null ,any arthimetic operation with null results null and null is always > than the number(credit balance)..So this is not the specified criteria.. I suppose..
I could nt try with test data due to lack of environment here as of now.. :--(
Hi wat i presume is it right or any
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Murtuja Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Gopu Gopi | 333 |
| Gitesh Trivedi | 322 |
| Vinoth Kumar | 264 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|