Create Pl/SQL block dynamically and then execute it by calling 'DBMS_SQL.EXECUTE' : DBMS_SQL « System Packages « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » System Packages » DBMS_SQL 
31. 26. 4. Create Pl/SQL block dynamically and then execute it by calling 'DBMS_SQL.EXECUTE'
SQL>
SQL> CREATE OR REPLACE PROCEDURE assign (
  2     val_in IN VARCHAR2,
  3     varname_in IN VARCHAR2,
  4     trc IN BOOLEAN := TRUE)
  5  IS
  6     cur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
  7     returnValue PLS_INTEGER;
  8     assign_string VARCHAR2(2000:= 'BEGIN ' || varname_in || ' :''' || val_in || '''END;';
  9  BEGIN
 10     IF trc THEN DBMS_OUTPUT.PUT_LINE (assign_string)END IF;
 11     DBMS_SQL.PARSE (cur, assign_string, DBMS_SQL.NATIVE);
 12     returnValue := DBMS_SQL.EXECUTE (cur);
 13     DBMS_SQL.CLOSE_CURSOR (cur);
 14  END;
 15  /

Procedure created.

SQL>
SQL>
31. 26. DBMS_SQL
31. 26. 1. dbms_sql.number_table
31. 26. 2. Close a cursor
31. 26. 3. Assign date with DBMS_SQL package
31. 26. 4. Create Pl/SQL block dynamically and then execute it by calling 'DBMS_SQL.EXECUTE'
31. 26. 5. DBMS_SQL.PARSE
31. 26. 6. An example of using DBMS_SQL.OPEN_CURSOR
31. 26. 7. Package for running dynamic sql based on DBMS_SQL package
31. 26. 8. Wrap dbms_sql package
31. 26. 9. Dump Column long with DBMS_SQL.DEFINE_COLUMN_LONG
31. 26. 10. DBMS_SQL.BIND_VARIABLE and DBMS_SQL.EXECUTE
31. 26. 11. DBMS_SQL.EXECUTE an update statement
31. 26. 12. Use DBMS_SQL to update a table and get the number of rows updated
31. 26. 13. DBMS_SQL.VARCHAR2_TABLE and DBMS_SQL.NUMBER_TABLE
31. 26. 14. Use dynamic SQL to check the business logic
31. 26. 15. Use DBMS_SQL package to parse math expression
31. 26. 16. Use a character string of arithmetic logic, selecting against the DUAL table to return a number value.
31. 26. 17. DBMS_SQL.LAST_ERROR_POSITION
31. 26. 18. Dump query with dbms_sql
31. 26. 19. Use dbms_sql.describe_columns
31. 26. 20. Print table with dynamic query
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.