Board index » delphi » Queries for Oracle: nested SELECT and requestlive?

Queries for Oracle: nested SELECT and requestlive?

Hello, ppl

I just wonder why I can't pass "nested SELECTs" to Oracle database,
like:

SELECT * FROM PRICES
  WHERE CAT_REF = ( SELECT CAT_REF FROM CATS WHERE CATNAME = :C)

Is that really Delphi limitation, or I can fool it some way?

For this query I can change to:

SELECT P.* FROM PRICES P, CATS C
  WHERE P.CAT_REF = C.CAT_REF AND C.CATNAME = :C

Right? OK, now I receive that the query is read-only. It's joined, sure,

but I'm not going to update CATS table through this query.
It should return live result set against Oracle, shouldn't it?

Regards.

Alex.

 

Re:Queries for Oracle: nested SELECT and requestlive?


Please don't blame when you donesn't known. If server side accepts the query
may be you are telling to the BDE (the middle tier between Delphi
application and the Oracle server) to parse the sentence. Change SQLQRYMODE
to SERVER.

Re:Queries for Oracle: nested SELECT and requestlive?


Thanks for your response. I didn't blame anything, just tried to solve the
problem.

Sorry, but SQLQUERY mode was SERVER yet before, I just checked it. Maybe, I
have to change some other setting?

Alex.

Quote
Sergio Samayoa wrote:
> Please don't blame when you donesn't known. If server side accepts the query
> may be you are telling to the BDE (the middle tier between Delphi
> application and the Oracle server) to parse the sentence. Change SQLQRYMODE
> to SERVER.

Re:Queries for Oracle: nested SELECT and requestlive?


Quote
Alexander Kornacki wrote:

> Hello, ppl

> I just wonder why I can't pass "nested SELECTs" to Oracle database,
> like:

> SELECT * FROM PRICES
>   WHERE CAT_REF = ( SELECT CAT_REF FROM CATS WHERE CATNAME = :C)

Try

SELECT * FROM PRICES
   WHERE CAT_REF in ( SELECT CAT_REF FROM CATS WHERE CATNAME = :C)

using = works fine for me as long as the select statement does not return more
than one row, multiple rows will result in an error message.  IN will always
work no matter what the result set.

Quote
> Is that really Delphi limitation, or I can fool it some way?

> For this query I can change to:

> SELECT P.* FROM PRICES P, CATS C
>   WHERE P.CAT_REF = C.CAT_REF AND C.CATNAME = :C

> Right? OK, now I receive that the query is read-only. It's joined, sure,

> but I'm not going to update CATS table through this query.
> It should return live result set against Oracle, shouldn't it?

No, Oracle will not return live cursors on any joins SQL.  Just add a TUpdateSQL
component, tie it to the query and bring up the UpdateSQL component editor to
tell it how to update your SQL.

Quote
> Regards.

> Alex.

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
This sad little lizard told me that he was a brontosaurus on his mother's
side.  I did not laugh; people who boast of ancestry often have little else
to sustain them.  Humoring them costs nothing and ads to happiness in
a world in which happiness is in short supply.   (RAH)

Other Threads