HPlogo ALLBASE/SQL Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 10 SQL Statements

EXECUTE IMMEDIATE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The EXECUTE IMMEDIATE statement dynamically prepares and executes an SQL statement.

Scope

ISQL or Application Programs

SQL Syntax

EXECUTE IMMEDIATE {[ 'String' :HostVariable ]}

Parameters

String

is the ALLBASE/SQL statement to be executed.

HostVariable

identifies a character-string host variable containing the ALLBASE/SQL statement to be executed.

Description

  • When used interactively, a host variable cannot be specified.

  • The SQL statement cannot contain host variables nor dynamic parameters.

  • You cannot use the EXECUTE IMMEDIATE statement for any of the following statements:

       BEGIN DECLARE SECTION       EXECUTE                  SELECT
    
       CLOSE                       EXECUTE IMMEDIATE        SQLEXPLAIN 
    
       DECLARE CURSOR              FETCH                    UPDATE WHERE CURRENT 
    
       DELETE WHERE CURRENT        INCLUDE                  WHENEVER 
    
       DESCRIBE                    OPEN                     
    
       END DECLARE SECTION         PREPARE                  
    

Authorization

You can use EXECUTE IMMEDIATE if your authorization permits you to issue the statement to be executed.

Example

If you know that the statement to be dynamically preprocessed is neither a SELECT statement nor an EXECUTE PROCEDURE statement with results, and has neither input nor output dynamic parameters, you can prepare it and execute it in one step.

   EXECUTE IMMEDIATE :Dynam1

In other instances, it is more appropriate to prepare and execute the statement in separate operations.

Feedback to webmaster