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

RE: [sqr-users] SQL question - establishing variables in Select



The section of code between the BEGIN-SELECT and END-SELECT is performed "once 
for EACH ROW returned". In your example, the assignment of $name & $id will be 
performed for each row where the date satisfies your query.

If there are no actions performed, except for variable assignments (as shown in 
your example), then the LAST row returned is the final value put into the 
variables, so that's the value the variable will have after the select 
completes.

Since there is no "ORDER BY" in your select, I'm not sure what order Oracle 
will return the rows in, but I don't think it's predictable.

-----Original Message-----
From: MBAUTIGER@aol.com [mailto:MBAUTIGER@aol.com]
Sent: Sunday, November 03, 2002 1:35 PM
To: sqr-users@sqrug.org
Subject: [sqr-users] SQL question - establishing variables in Select


Hi,

When establishing variables from select statements how do you know what results 
will be put into the variables.  Meaning if the select statement returns 
multiple rows how does the SQR determine which values to store in the 
variables.  

i.e.

BEGIN-SELECT
a.name
a.id

   let $name        = &a.name
   let $id        = &a.id
          
from ps_table1 a
where a.date = $date !$date established in previous routine
END-SELECT

I realize you should make this select return only one row, but say it returned 
multiple rows what values would go into the variables.  We are on Oracle.

Thanks.

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

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