× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Everyone,

  It has been awhile since I have asked for
assistance from the group but but rest assured that I have been diligently lurking. I am having a tuff time with the below SQL statement and I do not know why, could be due the time of day.  I am working on developing an
embedded SQL statement within a RPG program to extract G/l data from my
company's ERP application.  I would like to use the Case statement to
ensure the sub account code is formatted correctly when I convert the
numeric values to character.  ex when the sub account = 0, then '000'; when the sub account = 10, then '010'; when the sub account = 100, then
'100'. 

Here is what I have so far:


  Select orgno concat '-' concat major concat '-'      

  Case                                               
     When sub < 10 THEN                              
       concat right('00' || Rtrim(SUBSTR(sub,1,3)), 3)
     When sub >= 10 and sub < 100 THEN               
       concat right('0' || Rtrim(SUBSTR(sub,1,3)), 3)
    
Else                                            
       concat sub                                    
     End as FullGL,                                  
      
net2,ytd2                                     
from glsum12                                         
where orgno = 30 and major between 97319 and 97456
order by major  


 The interactive SQL session is yelling at me, saying that the Case keyword is not expected at line 2. 


 Any help would be greatly appreciated!!
Jim Minisce

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.