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

Dynamic Column Substitution



 Hello,
 
 I am trying to dynamically substitute a column name in an SQR 'Select' 
 statement and get the following error message:
 
               *****************
    SQLBase SQLCOM error 915 in cursor 2:
    Invalid constant
 
 SQL: select 
 Error at: 
 
 Error on line 96:
    (SQR 3716) Error in SQL statement.
 
 
 Errors were found in the program file.
              *******************
 
 Never having done this before, I am at a loss as to what the problem is.  I am 
 following an example from the SQR manual.  Any suggestions?
 
 Excerpts from the SQR code are as follows:
 
 begin-setup 
   ask where_clause 'Where Clause '  
   ask from_clause 'From where '
   ask file_type 'Enter File Type' 
   ask order_by 'Order By ' 
   page-size 56 174   
 end-setup
 
 begin-report
 
    if '{file_type}' = 'CALLINFO'  
      let $call_id =  'callinfo.call_id'
    else
      if '{file_type}' = 'CALLINFO_HIST'
        let $call_id = 'callinfo_hist.call_id'
      end-if
    end-if 
 
    do main_info
 
 end-report
 
 
 begin-procedure main_info
 
 begin-select 
 
 [$call_id] &call_id=char                          ***** This seems to be the
                                                        line with the problem
 
  print &call_id (+1,1)
 
 {from_clause} {where_clause} {order_by}
 
 end-select                                        ***** This is line 96!!!
 
 end-procedure
 
 
 Thank You!
 
 Marcie Hague
 MicroSim Corporation