2. Embedded SQL for C : Embedded SQL Statement Syntax for C : String Literals
 
Share this page                  
String Literals
Use single quotes to delimit embedded SQL string literals. To embed a single quote in a string literal, you must double it.
Example: Quote usage in string literals
exec sql insert
into comments (anecdotes)
 values ('single'' quote followed by double " quote');
This insert example writes the following string into the anecdotes column of the comments table:
single' quote followed by double " quote
In embedded SQL statements, the double quote and backslash need not be escaped because they have no special meaning.
To continue a string literal to additional lines, use the backslash (\) character. Any leading spaces on the next line are considered part of the string. This follows the C convention. The following message statement example shows valid use of the backslash character.
Example: Backslash usage in string literals
exec frs message 'Please correct errors found in\
      updating the database tables.'
Use C conventions in the declaration section. You must use double quotes to delimit most C strings. For example:
char *dbname = "personnel";