Enter CQL using the following format:
- CQL uses a free format. Operands are specified in the order described in each CQL format. For the CQL formats, see 4. CQL Reference.
- CQL statements are separated using a semicolon (;).
A statement may span multiple lines, but multiple statements cannot be entered on a single line.
Correct and incorrect coding examples follow:
- Correct coding example
REGISTER STREAM
s1(id INT,name VARCHAR(10));
REGISTER QUERY q1
SELECT s1.name FROM s1[ROWS 10]; |
- Incorrect coding example
REGISTER STREAM s1(id INT); REGISTER QUERY q1 SELECT * FROM s1[ROWS 10]; |
- An error occurs because two REGISTER statements are entered on a single line.
- To enter comments, use two forward slashes (//). After the two forward slashes are entered, the rest of the text on the line is treated as a comment. You cannot insert comments in the middle of a statement.
Correct and incorrect coding examples follow:
- Correct coding example
// comments
REGISTER STREAM
s1(id INT,name VARCHAR(10)); // comment |
- Incorrect coding example
REGISTER QUERY q1 // comment
SELECT s1.name FROM s1[ROWS 10]; |
- An error occurs because a comment is inserted in the middle of the REGISTER QUERY statement.
If you need to enter two forward slashes (//) in the middle of a character string for a purpose other than entering comments, make sure the forward slashes do not occur at the beginning of a line. Correct and incorrect coding examples follow:
- Correct coding example
REGISTER QUERY q1 SELECT * FROM s1[NOW] WHERE s1.c1='ab//cd'; |
- Incorrect coding example
REGISTER QUERY q1 SELECT * FROM s1[NOW] WHERE s1.c1='ab
//cd'; |
- An error occurs because a line begins with two forward slashes (the line is treated as a comment line).