| 4D v20EXECUTE IMMEDIATE | ||||||||||||||
|  | 
    4D v20
 EXECUTE IMMEDIATE 
         | |||||||||||||
| EXECUTE IMMEDIATE <<sql_name>> | <<$sql_name>> | :sql_name | :$sql_name | ||
The EXECUTE IMMEDIATE command is used to execute a dynamic SQL statement. The sql_name passed represents a variable containing a set of SQL statements that will be executed as a whole.
Notes:
This example recovers the number of movies in the database that were released in 1960 or more recently:
 C_LONGINT(NumMovies)
 C_TEXT(tQueryTxt)
 NumMovies:=0
 
 tQueryTxt:="SELECT COUNT(*) FROM MOVIES WHERE Year_of_Movie >= 1960 INTO :NumMovies;"
 Begin SQL
    EXECUTE IMMEDIATE :tQueryTxt;
 End SQL
 
 ALERT("The Video Library contains "+String(NumMovies)+" movies more recent or equal to 1960")
	Product:  4D
	Theme:  SQL Commands
	
        
        
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	4D SQL Reference ( 4D v20)
	
	
 Add a comment
Add a comment