开发者

PreparedStatement with subquery returning empty result set

I've got a query that works fine when I run it in SQL Developer, but returns an empty result set when run as a prepared statement. I'm not sure if my query is formatted incorrectly, or if it's something else (which I'll leave for another question entirely).

So here is my query. I've stripped stuff out in order to capture the format of it, and not the business logic. The table has th开发者_C百科ree columns: type, key, and value.

SELECT a.key id, a.value name
    FROM
        (SELECT * FROM sometable WHERE type='A') a,
        (SELECT * FROM sometable WHERE type='B') b,
        (SELECT * FROM sometable WHERE type='C') c,
        (SELECT * FROM sometable WHERE type='D') d
WHERE a.value = b.key
    AND a.value = c.key
    AND a.value = d.key

Essentially, should this execute correctly in a prepared statement?


Are you seeing any errors?

The query as is can be run as a Statement since it is a static SQL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜