ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Native Dynamic SQL and Dynamic PL/SQL(2)

Native Dynamic SQL and Dynamic PL/SQL(2)

原创 Linux操作系统 作者:susie0409 时间:2010-03-02 22:19:22 0 删除 编辑
Native Dynamic SQL Statements

Add a Note HereThe native dynamic SQL statements pertaining to dynamic DDL, DML, and session control are as follows:

  1. Add a Note HereEXECUTE IMMEDIATE ;

  2. Add a Note HereEXECUTE IMMEDIATE USING ;

  3. Add a Note HereEXECUTE IMMEDIATE INTO USING ;

  4. Add a Note HereOPEN FOR ;

  5. Add a Note HereOPEN FOR USING ;

  6. Add a Note HereFETCH INTO ;

  7. Add a Note HereCLOSE ;

  8. Add a Note HereEXECUTE IMMEDIATE ‘BEGIN… . END;’ USING ;

Add a Note HereThe first two statements are used for dynamic DDL. The third statement is used for single-row dynamic SELECTS. The fourth through seventh statements are used for multirow dynamic SELECTS. The last statement is used for dynamic PL/SQL.

Add a Note HereThe whole string including BEGIN and END is constructed dynamically by concatenation. The EXECUTE IMMEDIATE statement prepares, executes, and deallocates a dynamic SQL statement. The OPEN statement extends the OPEN cursor statements for opening cursors based on a dynamic SQL query constructed as a string. The FETCH and CLOSE statements extend the FETCH and CLOSE cursor statements to support dynamic queries. The last statement enables dynamic PL/SQL (i.e., executing procedures and functions whose names are constructed at runtime or anonymous PL/SQL blocks involving runtime variables).

Add a Note HereNative dynamic SQL supports SQL-specific data types. However, it doesn't support PL/SQL-specific data types such as BOOLEAN, index-by tables, and user-defined records. The only exception to this rule is fetching into user-defined records while executing dynamic single-row and multirow queries.

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15225049/viewspace-628432/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-09-30

  • 博文量
    115
  • 访问量
    305728