Whis is the best way?

Posts   
 
    
tecnocrata avatar
tecnocrata
User
Posts: 9
Joined: 24-May-2007
# Posted on: 06-Mar-2008 15:15:44   

I am trying to evaluate as of both following ways is efficient or it is recommended. I need to make a query of the following type:

Select ........ MINUS Select 

This also could be written thus:

Select ...... Where NOT IN (Select ........) 

First problem, I Can’t do it directly with LLBLGen Pro, I am using Oracle 10g

OPTION 1 I have tried to put it in a Stored Procedure and to invoke using it LLBLGen Pro

OPTION 2 If I make it of the following form is as efficient as a stored procedure?

EntityCollection< TE1> ce1 = adapter. Fetch ...... 
EntityCollection< TE2> ce2 = adapter. Fetc……
For  (int i=0; i< ce1.Count; i++) 
for (j=0; j< ce2.Count; j++) 
if (ce1 [i]. You go! = ce2.Id) PutAnotherCollection(ce2[j]);  

In other words not to use SQL directly but in the businesses layer

Sorry my english isn't good

Thanks confused

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 06-Mar-2008 15:51:29   

Select ...... Where NOT IN (Select ........)

The above query can be easily formulated with LLBLGen Pro using a FieldCompareSetPredicate

tecnocrata avatar
tecnocrata
User
Posts: 9
Joined: 24-May-2007
# Posted on: 06-Mar-2008 16:34:23   

Yes I Know But my main question is which is the best way Stored Procedures or Custom Bussines Logic? There are a big performance differences? Is correct do it?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 07-Mar-2008 10:20:11   

What's more efficient depends on a lot of things. Often set-operations inside the db (done by a query from LLBLGen pro or a procedure) is faster, however if you write PL/SQL code with cursors and loops, it might not be faster, as SQL is interpreted and pulling the data out of the db into managed code MIGHT be faster. So 'it depends'. Stored procedures aren't 'faster' than dyn. sql, if that's what you meant.

Frans Bouma | Lead developer LLBLGen Pro