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

Re: [sqr-users] Dynamic Hints ?




If you use a hint as a dynamic column, SQR will think it is a column, and
add a comma to it when it is parsed, giving you a syntax error.

The following, while ugly, might work for you.  It parses to "select /*+
all_rows */ name,emplid from ps_employees..."

BEGIN-PROCEDURE Read-DB
  let $hint = '/*+ all_rows */ name'
BEGIN-SELECT
[$hint] &hint=char
emplid

  show &hint

FROM PS_EMPLOYEES
WHERE NAME LIKE 'Smith%'
END-SELECT
END-PROCEDURE

Before I did this, I would make sure that your DBA has analyzed the table
and indexes completely, perhaps using histograms.  Or you might try a 3rd
index that works in both cases.



                                                                                
                                                
                      Rick_Creel@aoncon                                         
                                                
                      s.com                    To:       sqr-users@sqrug.org    
                                                
                      Sent by:                 cc:                              
                                                
                      sqr-users-admin@s        Subject:  [sqr-users] Dynamic 
Hints ?                                            
                      qrug.org                                                  
                                                
                                                                                
                                                
                                                                                
                                                
                      04/17/03 09:53 AM                                         
                                                
                      Please respond to                                         
                                                
                      sqr-users                                                 
                                                
                                                                                
                                                
                                                                                
                                                





Is it possible to have dynamic HINT statements in an SQR?
Here is a sample of my code... that does NOT work.
Any suggestions would be greatly appreciated!
=======================================
begin-program
   let $sw = '1'
   if $sw = '1'
      let $hint = '/*+ INDEX(HDR PS1BI_HDR) */'
   ELSE
      let $hint = '/*+ INDEX(HDR PSEBI_HDR) */'
   end-if
begin-select
[$hint]
count(*) &count
      SHOW 'COUNT = ' &COUNT
from PS_BI_HDR HDR
end-select
end-program
=======================================
This is the error message I get:


Error on line 17:
   (SQR 3743) Dynamic columns must have a &pseudonym.
[$hint]


_______________________________________________
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