Home » SQL & PL/SQL » SQL & PL/SQL » Re-write the Query
Re-write the Query [message #253436] Mon, 23 July 2007 22:37 Go to next message
bagulia_pilla
Messages: 25
Registered: July 2006
Junior Member

SELECT pi.*, pf.feed_id
  FROM cms_portfolio_item pi, cms_price_feed pf
 WHERE (pi.stock_code = pf.stock_code AND pi.stock_code <> '')
    OR (pi.isin_code = pf.isin_code AND pi.isin_code <> '')
    OR (pi.ric = pf.ric AND pi.ric <> '');




Is it ok this query or can we re-write this query?
Re: Re-write the Query [message #253454 is a reply to message #253436] Tue, 24 July 2007 00:58 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This query will never return anything.

'' is NULL, NULL is never equal or not equal to anything.
To compare with NULL you have to use IS NULL or IS NOT NULL operators.

Regards
Michel
Re: Re-write the Query [message #253628 is a reply to message #253436] Tue, 24 July 2007 07:41 Go to previous message
MarcL
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
or use NVL
Previous Topic: get first n last day
Next Topic: Trigger error
Goto Forum:
  


Current Time: Fri Dec 02 20:31:40 CST 2016

Total time taken to generate the page: 0.10905 seconds