Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Do triggers cause a context switch between SQL & PL/SQL
Well yes. I was pointing out a second way to write the query that avoided
selecting from dual. But the time it takes to run the query is the same in
both examples.
-----Original Message-----
I am not sure ... so far as I know "select count(*) from some_table" without any further group by has always resulted in one row ...
-----Original Message-----
Your query with the exists would be the same as doing this, right?
select count(*)
into numrows
from ApplicationFormCriteria
where ApplicationFormCriteria.applicationFormId = :old.applicationFormId
and rownum = 1 ;
-----Original Message-----
A context switch is order because a trigger is a pl/sql object ...
if you can change the trigger ... instead of count(*) try using exists
assuming you have a usable index ...
select count(*)
into numrows
from dual
where exists ( select 1
from ApplicationFormCriteria where ApplicationFormCriteria.applicationFormId =:old.applicationFormId);
...
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jacques Kilchoer INET: Jacques.Kilchoer_at_quest.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting servicesReceived on Wed Apr 02 2003 - 10:58:39 CST
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
![]() |
![]() |