I've moved...

This blog now has a new home - please update your shortcuts and readers to: www.jeffkemponoracle.com. Sorry for any inconvenience!

Friday, May 02, 2008

WITH With an IN; or, A Reason to Refactor

A work colleague needed to make a change to a report and came up against a brick wall. He knew what he wanted to express in SQL, but Oracle wouldn't accept his syntax.

[Full Article]

1 comment:

  1. The WITH starts to look a bit pointless, but this syntax should work:

    WITH q AS
    (SELECT idpart1, idpart2
    FROM driving_table
    WHERE id = :id)
    SELECT t.*
    FROM some_table t
    WHERE (t.idpart1, t.idpart2) IN (SELECT idpart1,idpart2 FROM q);

    ReplyDelete

Note: only a member of this blog may post a comment.