Discover oracle execute immediate, include the articles, news, trends, analysis and practical advice about oracle execute immediate on alibabacloud.com
Label:SQL statement stitching can be performed using execute immediate when the database handles complex business logic in a developed application scenarioInsert into Tb_temp_public (v1, v2, V3, V4, v5,v6,v7,v8,v9) Select ",", ",", ",", ",", "from dual;The field inside the Tb_temp_public is dynamically generated after the corresponding value is also dynamically generated when this time execution statement c
features are not covered in detail in the Oracle manual.The following example shows all possible ways to use Execute immediate.
5. For Forms developers, this function is not available for Forms 6i in PL/SQL 8.0.6.3.
Execute immediate -- usage example
1. Run DDL statements i
Reprint the first look, then finishing it ~ ~ ~
ORACLE EXECUTE IMMEDIATE UsageEXECUTE IMMEDIATE replaces the previous Oracle8i Dbms_sql package package.It resolves and immediately executes a dynamic SQL statement or a pl/sql block created by the runtime. Dynamic creation and execution of SQL statements ahead of time, t
Execute immediate replaces the DBMS_ SQL package in Oracle. The following describes how to use EXECUTE IMMEDIATE in Oracle for your reference.
It parses and immediately executes dynamic SQL statements or PL/SQL blocks created when
. These features are not covered in detail in the Oracle manual.The following example shows all possible ways to use execute immediate.
5. For forms developers, this function is not available for forms 6i in PL/SQL 8.0.6.3.
Execute immediate -- usage example
1. Run DDL
A few days ago, I wrote an oracle procedure to extract useful data from many irrelevant Excel files and insert them into a table in the form of a single record, I used two nested cursors in procedure to traverse and judge the results. After procedure is executed, there is no problem and the results can be imported successfully, that is, the execution time of procedure is unstable, it can be as fast as 12 S, and as slow as 40 s. It took a long time to
Tags: data c Oracle Table R object RAC Storage NoneIt's you. A stored procedure creates a table table_a and then inserts the other data into the table_a with insert into, but because Table_a does not exist when you create the process, the process shows a compile error because table_ A does not necessarily cause the process to fail, so it cannot be compiled successfully, and when the INSERT INTO statement is added to
Tags: blog io ar os using the on log HTMLCREATE OR REPLACE PROCEDURE p_replace isv_sql VARCHAR2 (2000); CURSOR cur is a SELECT * from User_tab_cols;tableinfo User_tab_cols%rowtype; Beginopen cur; Loopfetch cur into tableinfo; EXIT when cur%notfound;v_sql:= ' UPDATE ' | | tableinfo.table_name| | ' SET ' | | tableinfo.column_name| | ' ='||' Replace (' | | | tableinfo.column_name| | ', ' | | ' -'||''''||','||''''||''''||')'; Dbms_output.put_line (V_sql); EXECUT
According to the customer's needs, we have added a statistical table to collect statistics and generate statistical data. We need to dynamically Execute SQL statements based on a basic table. the execute immediate command is used to dynamically generate and execute SQL statements during the storage process. I want to w
Source: http://www.dbasupport.com/oracle/ora9i/execute_immediate.shtml
Reposted from: lovexueer's blog
Execute immediate replaces dbms_ SQL package in Oracle8i. it parses and immediately executes dynamic SQL statements or PL/SQL blocks created when they are not running. the performance of dynamic creation and execution of SQL statements is advanced. The goal of
tail.
4. In the Oracle manual, these features are not covered in detail.
The following example shows all the possible aspects of using execute immediate. Hope to bring you convenience.
5. For forms developers, the forms 6i cannot use this feature when in Pl/sql 8.0.6.3. Version.
EXECUTE
semicolons, when the Pl/sql block is executed, with a semicolon at its tail.
4. In the Oracle manual, these features are not covered in detail. The following example shows all the possible aspects of using execute immediate. Hope to bring you convenience.
5. For forms developers, the forms 6i cannot use this feature when in Pl/sql 8.0.6.3. Version.
at the end.
4. These features are not covered in detail in the Oracle manual. The following example shows all possible ways to use execute immediate.
5. For forms developers, this function is not available for forms 6i in PL/SQL 8.0.6.3.
Execute immediate usag
...
This clause specifies a list of input and/or output bind arguments. If you do not specify a parameter mode, it defaultsIN.Examples
The following PL/SQL block contains several examples of dynamic SQL:
DECLARE sql_stmt VARCHAR2(200); plsql_block VARCHAR2(500); emp_id NUMBER(4) := 7566; salary NUMBER(7,2); dept_id NUMBER(2) := 50; dept_name VARCHAR2(14) := 'PERSONNEL'; location VARCHAR2(13) := 'DALLAS'; emp_rec emp%ROWTYPE;BEGIN
and the Sql_plan_baseline column to confirm whether it is fixed.The test found that some SQL with bound variables, sql_id and plan_hash_value with constant SQL cannot be fixed, you can try to use execute immediate to generate SQL that contains bound variables.For example:DECLAREV_sql VARCHAR2 (2881064151);BEGINV_sql: = ' SELECT/*+full (TB_SPM) */* from SCOTT. TB_SPM WHERE object_id=:1 ';
The difference between writing SQL statements directly in PL/SQL and using the execute immediate method is that when executing SQL statements in PL/SQL, you can directly write SQL statements or splice an SQL statement into a string, as shown below: select * from dual; v_ SQL: = 'select * from dual'; execute immediate v
When creating a table dynamically using Plsql, the user needs to have the Create any table permissionFor example:Create or replace procedure Create_table_test istmpstr varchar2 ( -); V_cursor number;j Number;begin forIinch Ten.. -Loop begin TMPSTR:='CREATE TABLE Dpc_test'|| I | |'As select * from Dpc_test WHERE 1=2'; Dbms_output.put_line (TMPSTR); --v_cursor: =Dbms_sql.open_cursor; --Dbms_sql.parse (v_cursor,tmpstr,dbms_sql.native); --j:=Dbms_sql.execute (v_cursor);
When a database server executes shutdown immediate, it encounters the following Ora error, as follows: $ sqlplus/as SYSDBA
Sql*plus:release 10.2.0.4.0-production on Fri 5 10:56:24 2016
Copyright (c) 1982, Oracle. All rights Reserved.
Connected to:
Oracle Database 10g Release 10.2.0.4.0-64bit Production
sql> shutdown
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.