Monday, October 3, 2011

Unintuitive syntax - ABAP 4

One of a series of posts from andraszek.net posted originally between 2006 and 2010. 


Here is an example of a twisted "colon and comma" logic from SAP ABAP 4 programming language:

UPDATE contacts SET: CITY  = 'WARSZAWA', 
                    PHONE = '+48 22 1234567' 
              WHERE ID = '000899888'. 

This statement will update CITY for all rows and PHONE for the row with ID = '000899888'. The reasoning behind this is that by putting a colon we actually start defining statement chains: statements separated by commas. The whole thing ends with a full stop, which marks the end of every statement in ABAP 4.

This concept will be very weird to all SQL programmers.

No comments:

Post a Comment