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
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: 65144
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.

Re: Re-write the Query [message #253628 is a reply to message #253436] Tue, 24 July 2007 07:41 Go to previous message
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
or use NVL
Previous Topic: How to select and insert and use the value to select again
Next Topic: Shell scripting through PL/SQL
Goto Forum:

Current Time: Sat Aug 19 21:23:27 CDT 2017

Total time taken to generate the page: 1.68901 seconds