Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

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

  




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 Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi333
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software