Execute dynamic SQL statements in form

Source: Internet
Author: User

The dynamic SQL times error is performed today in FORM Builder with execute immediate ' SQL Staments '.

It is found that the dynamic SQL is executed with the FORMS_DDL function in the form, and this function implies commit;

Detailed descriptions are as follows:

First, Forms_ddl function

FUNCTION FORMS_DDL (statement VARCHAR2);

For dynamic execution of SQL statements vs. PL statements

Precautions:

1, the maximum capacity of the parameter statement can not exceed 32K.

2. A DDL-type SQL statement that implies a commit command.

Second, Exec_sql bag

An SQL statement used to dynamically execute DDL types and DML types.

General use of Exec_sql packages:

First step: Connect to the database:

Exec_sql. Open_connection/exec_sql. Default_connection

Step two: Create a pointer variable (cursor):

Exec_sql. Open_cursor

Step three: Load an SQL statement (DDL, DML) for the pointer variable: exec_sql. Open_cursor

Fourth step: Execute the loaded SQL statement:

Exec_sql. Execute

Fifth step: Bulk PIN variable (cursor) and close database connection:

Exec_sql. Is_open, Exec_sql. Close_cursor, Exec_sql. Close_cursor, Exec_sql. Close_cursor

Iii. Summary

1. The FORMS_DDL function is primarily used for dynamically executing DDL-type SQL statements (which can be understood as SQL statements that do not use DDL types directly in a form.) )。 The FORMS_DDL function can only be used for the database to which the current form is connected.

2. Exec_sql package has two important uses:

First: Used to dynamically execute a SELECT statement and return a result set.

Second: Used for data access between different databases.

Execute dynamic SQL statements in form

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.