[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Select Construct



Whether SQR fetches each value of fld1 from DB and then there processes
procedure 1? YES.  It will grab one value, then process procedure1 based off
that one value.  It's not the fastest way to program.

However, there are a lot better ways to program than using procedures with
nested selects...most of the time.  If the select in your 'do 1' procedure
is static every time, then you shouldn't make it nested.  You could do your
inner select first, store what you need in a variable, then use those
variables in your outter select.

If you pass the inner select some variables from the outter select to be
used in the 'where clause' of the innner select then you should be able to
join table1 and table2 into the original select (select * from table1,
table2 where table2.field2 = table1.fld1) 

Nested selects rarely make sense.  Now if it was a nested procedure that did
some processing (math, printing, etc) or did an update statement (update
table2 set abcd = $fld1), that makes sense.  There's no good way around
that, because that processing/updating needs to be done anyway.


****Use nested procedures for processing or updates/deletes.
Begin-select
fld1    
  let $fld1 = &fld1
  do proc1
from table1
End-Select

begin-procedure proc1
  let $fld1 = $fld1 || ' is field one'
  print $fld1
begin-sql
update table2 set flag = 'Y' where field2 = $fld1
end-sql

end-procedure


-----Original Message-----
From: sqr-users-bounces+bstone=fastenal.com@sqrug.org
[mailto:sqr-users-bounces+bstone=fastenal.com@sqrug.org]On Behalf Of
Murty Mirthipati Venkata Suryanarayan
Sent: Friday, November 19, 2004 3:20 PM
To: This list is for discussion about the SQR database reportinglanguage
from Hyperion Solutions.
Subject: [sqr-users] Select Construct


Guys,
   In which way selects and nested selects be executed?
   ie, If there are nested selects, whether the outer select be fetching row
by row from DB and passes to the inner procedures or will the outer select
be executed completely and all the results are stored in memory and then
inner procedures are executed row by row. 
 Find below psuedo SQR:
 Begin-select
 fld1
    do 1
 from table1
 End-Select

Whether SQR fetches each value of fld1 from DB and then there processes
procedure 1? 
 Or whether all values of fld1 are fetched from DB and placed in the memory,
then for each value of fld1, procedure 1 is executed?

Cheers,
Murty ;)

 

 

 


DISCLAIMER:
Information contained and transmitted by this E-MAIL is proprietary to
Hexaware Technologies and is intended for use only by the individual or
entity to which it is addressed and may contain information that is
privileged, confidential or exempt from disclosure under applicable law.
If this is a forwarded message, the content of this E-MAIL may not have
been sent with the authority of the Company. If you are not the intended
recipient, an agent of the intended recipient or a person responsible
for delivering the information to the named recipient, you are notified
that any use, distribution, transmission, printing, copying or
dissemination of this information in any way or in any manner is
strictly prohibited. If you have received this communication in error,
please delete this mail & notify us immediately at
adminchn@hexaware.com.

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users