There are dynamic statements in Oracle; dynamic statements refer to SQL statements that are uncertain at compile time. The compiler does not process the dynamic statement part, but only dynamically creates statements and syntaxes the statements when the program is running. Analyze and execute the statement, the syntax is "EXECUTE IMMEDIATE dynamic SQL statement string INTO clause USING clause".
The operating environment of this tutorial: Windows 10 system, Oracle version 12c, Dell G3 computer.
Is there a dynamic statement in oracle?
The so-called dynamic SQL refers to the SQL statement when the PL/SQL block is compiled. Undefined, such as performing different operations based on different user input parameters. The compiler does not process the dynamic statement part, but only creates the statement dynamically when the program is running, performs syntax analysis on the statement and executes the statement. Dynamic SQL in ORACLE can be executed through local dynamic SQL commands or through the DBMS_SQL package.
Usually in development, simple local dynamic SQL can solve the problem. I will use other methods to achieve it below. The syntax for executing local dynamic SQL is given:
EXECUTE IMMEDIATE dynamic_sql_string [INTO define_variable_list] [USING bind_argument_list];
where: dynamic_sql_string is the dynamic SQL statement string INTO clause is used to accept the record value selected by the SELECT statement. The USING clause is used to accept bound input parameter variables.
SQL dynamic statements are SQL statements generated by programs or stored procedures. The characteristic of such statements is that they cannot be simply run. Because it is not standard and contains changing components, ORACLE provides a mode for executing dynamic SQL statements:
EXECUTE IMMEDIATE
The meaning of this sentence is to execute immediately without first To perform syntax checking, logical errors may occur during execution, which will be handled through error interrupts.
The example is as follows:
Oracle Video Tutorial"
The above is the detailed content of Are there dynamic statements in oracle?. For more information, please follow other related articles on the PHP Chinese website!