Skip to main content
Close announcements banner

The <%...%> syntax

This syntax can span lines. The following list points out what you can do with this syntax and what you should pay attention to.

  • You can define new variables, use Java logical code like if, for and while, and also get parameter values.

    For example, if you want to get the FILE_Name parameter, use the code as follows:

<%
String filename = __FILE_NAME__;
%>
  • This syntax cannot be used within an SQL statement. In other words, it should be used between two separated SQL statements.

    For example, the syntax in the following code is valid.

#sql sentence
DROP TABLE temp_0;
<%
#loop
for(int i=1; i<10; i++){
%>
#sql sentence
DROP TABLE temp_<%=i %>;
<%
}
%>
#sql sentence
DROP TABLE temp_10;

In this example, the syntax is used between two separated SQL templates: DROP TABLE temp_0; and DROP TABLE temp_<%=i%>;.

The SQL statements are intended to remove several tables beginning from temp_0. The code between <% and %> generate a sequence of number in loop to identify tables to be removed and close the loop after the number generation.

  • Within this syntax, the <%=...%> or </.../> syntax should not be used.

<%=...%> and </.../> are also syntax intended for the SQL templates. The below sections describe related information.

Information noteNote:

Parameters that the SQL templates can access with this syntax are simple. They are often used for connection purpose and can be easily defined in components, such as TABLE_NAME, DB_VERSION, SCHEMA_TYPE, etc.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!