6. Embedded SQL for BASIC : Embedded SQL Statement Syntax for BASIC : The Create Procedure Statement
 
Share this page                  
The Create Procedure Statement
As mentioned in the SQL Reference Guide, the create procedure statement has language-specific syntax rules for line continuation, string literal continuation, comments, and the final terminator. These syntax rules follow the rules discussed in this section--for example, the ampersand is used to continue lines. Regardless of the number of statements inside the procedure body, the preprocessor treats the create procedure statement as a single statement and, as an Embedded SQL/BASIC statement, it has no final terminator. However, you must terminate all statements in the body of the procedure with a semicolon.
The following example shows a create procedure statement that follows the Embedded SQL/BASIC syntax rules:
exec sql                            &
    create procedure proc (parm integer) as     &
    declare  &
        var integer;
    begin &
        ! Use BASIC comment field (no need to continue here)
        if parm 10 then &
            message 'BASIC strings cannot continue over lines';&
            insert into tab VALUES (:parm); &
        endif; &
end ! No terminator in BASIC