Using 'Like'

velvettiger

New Member
Hi guys,

I am new to Progress and I want to use the 'like' keyword. I tried using it like I would when I write sql statements because I know that it is somewhat similar. Does anyone have any suggestions

Code:
OUTPUT TO C:\cal\Antigua_CFL_OR_SHELL.TXT.
 SESSION:DATE-FORMAT = "ymd".
FOR EACH customer FIELDS( card-no 
                           card-class
                           first-name 
                           initials-name 
                           last-name
                           
        ) 

 where cardnumber like '25252545%'
       
     
     NO-LOCK:
    

EXPORT 
    DELIMITER ","
card-no    card-class
                           account-status   
                           first-name 
                           initials-name 
                           last-name.

END.
OUTPUT CLOSE.
 
Try this and see if this works. Another keyword you can use is "begins"
Code:
OUTPUT TO C:\cal\Antigua_CFL_OR_SHELL.TXT.
 SESSION:DATE-FORMAT = "ymd".
FOR EACH customer FIELDS( card-no 
                           card-class
                           first-name 
                           initials-name 
                           last-name
                           
        ) 

 where cardnumber [COLOR=Red]matches '25252545*'[/COLOR]
       
     
     NO-LOCK:
    

EXPORT 
    DELIMITER ","
card-no    card-class
                           account-status   
                           first-name 
                           initials-name 
                           last-name.

END.
OUTPUT CLOSE.
 
Be wary of MATCHES and other functions in WHERE clauses. They destroy performance by removing the field in question from consideration for index selection. If the rest of the WHERE clause doesn't narrow down selection enough you could end up testing MATCHES against a lot of records.

Progress 4GL uses a static (compile-time) query optimizer. Most SQL engines use a cost-based (run-time) query analyzer. Both have their pros & cons. Stuff that performs reasonably in a SQL world can be a performance disaster in Progress. And vice-versa.
 
Back
Top