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

Re: [sqr-users] Dynamic SQL?



Ivan,

The stuff inside the square brackets tells SQR to assume that
the values retreived from the query in the select list (i.e., 
before the from clause) should be interpreted as if being
from PS_CUSTOMER, PS_ENTRY_TYPE_TBL, and PS_ITEM_ACTIVITY 
(with the m, B, and A aliases), but that at runtime the value
of $from_tables should be used for the actual list of tables
(and aliases).

The issue is that when SQR builds the query, it needs to know
whether each expression in the list is a string, number, date,
etc.  By providing a "default" from clause, you're allowing 
SQR to use existing tables to obtain the datatypes for the
columns in the select list, but wait until runtime to actually
specify the tables to be used for the query.

Makes sense?

Ray

On Wed, May 28, 2003 at 01:51:09PM -0400, Turner, Ivan wrote:
> I am not finding any documentation in the sqr server user guide for this
> construct.  Can anyone clarify?
> 
> Begin-Procedure journal-id
>     move 'PS_ITEM_ACTIVITY A, PS_CUSTOMER m, PS_ENTRY_TYPE_TBL B,
> PS_JRNL_HEADER_FS Z1' to $from_tables
>    If $PMBreakup = 'A'
>       Let $from_tables = 'PS_ITEM_ACTIVITY A, PS_CUSTOMER m,
> PS_ENTRY_TYPE_TBL B, PS_JRNL_HEADER_FS Z1,PS_CUST_PRD_INFO_L cp'
>    end-if
>     do build-journal-id-where-clause             
> End-Procedure journal-id
> 
> This is the from clause used on the driving query.
> FROM [PS_CUSTOMER m,PS_ENTRY_TYPE_TBL B,PS_ITEM_ACTIVITY A : $from_tables] 
> 
>  
> Ivan C. Turner
> Qwest Communications International, Inc.
> 703.363.4630
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
----------------------------------------------------------------------
Ray Ontko   rayo@ontko.com   Phone 1.765.935.4283   Fax 1.765.962.9788
Ray Ontko & Co.   Software Consulting Services   http://www.ontko.com/

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