Execute Immediate Issue

Hi All,
I am trying to create a table using CTAS method. I am using a single sql query as well as a procedure.
The single SQL Query is taking 5-7 mins but the Procedure is getting hanged.Yesterday it ran for 3 hours and i had to kill the job.
Is there any specific reason for such a behaviour.
Regards

> The single SQL Query is taking 5-7 mins but the Procedure is getting hanged.Yesterday it ran for
3 hours and i had to kill the job.
A SELECT reads data. A CTAS (Create Table As Select) not only reads data, but also writes data. You cannot thus expect that the CTAS performance will be equivalent to that of the SELECT part only.
However, a 3+ hour CTAS run time do sound unusual for a 5 minute SELECT.
Have you looked at the execution plan of the CTAS?
Have you looked at the wait states and events for the CTAS process while running? Was there a long operation listed for the process?
Saying that the CTAS is slow is merely describing a symptom. That does not suffice in anyway to diagnose the actual problem.
Also supply full Oracle and o/s versions too.
In order for the forum to help you, you must first help the forum to understand your environment (Oracle versions) and your problem (not just a mere symptom). You have provided nothing of this kind.

Similar Messages

  • Execute immediate issue while calling a procedure from plsql block

    Hi all,
    I have the following simple code ,my execute immediate is not working(I am pasting the error below as well)
    CREATE OR REPLACE PROCEDURE CALL_RAHUL_PROCEDURES
    AS
    strng varchar2(1000);
    BEGIN
    for i in (select proc_name,flag,id from rahul_procedures order by id)
    loop
    if (i.flag = 'Y')
    then
    strng := 'exec '||i.proc_name||'(''rahul'')';
    dbms_output.put_line(strng);
    execute immediate strng;
    end if;
    end loop;
    END CALL_RAHUL_PROCEDURES;
    Error:
    Connecting to the database INQDWD.
    ORA-00900: invalid SQL statement
    ORA-06512: at "ETLADMIN.CALL_RAHUL_PROCEDURES", line 17
    ORA-06512: at line 2
    exec RAHUL_HELLO_WORLD2('rahul');
    Process exited.
    Disconnecting from the database INQDWD.
    data in rahul_procedures table :
    Proc_name flag Id
    RAHUL_HELLO_WORLD     N     1
    RAHUL_HELLO_WORLD2     Y     2
    RAHUL_HELLO_WORLD     N     3
    RAHUL_HELLO_WORLD3     N     4
    please help.
    Regards
    Rahul

    Mac_Freak_Rahul wrote:
    Well I have to call 26 procedures one by one and the names of the procedures would be in a table'rahul_procedures' Which is 100% wrong.
    Data is stored in tables, program code is stored in procedures or view defintions.
    http://en.wikipedia.org/wiki/Data_%28computing%29
    >
    Data vs programs
    Typically, different files are used to store programs vs data. Executable files contain programs; all other files are data files.
    >
    So you have just violated the primary distinction between data and program code.
    I dont find anything strange in my question,Only because you do not appear to know what you are doing or the difference between data and program code.
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1943344500346351703
    >
    ugh, what an ugly "design". I can see your life will be full of performance issues, strange 'bugs', and other unpleasant side effects. I mean, it all looks "so cool", but it'll be a nightmare to maintain and enhance.
    but then you have the issue of binds, which will be intractable. You'd have to know the binds at compile time, but you have hidden all of your sql in a magic generic table - so you cannot possibly know your binds at compile time.
    I would suggest you discard all of this code (I am DEAD SERIOUS) and start over. This is a bad idea from the get go. Or at least do me a favor and do not use plsql (you make it look like a good database implementation, but it isn't)
    The objective here is to store SQL Statements in a Table(a sql repository) and just call the required SQL from the application using the sqlid using the sql_execute procedure. ...
    CHANGE YOUR OBJECTIVE.
    How about this for a good objective:
    the objective here is to store sql statement in a plsql routine (a sql repository, you call a procedure and we run sql) and just call the required sql form the applicatoin using the STORED PROCEDURE
    sorry, can I think of hacks to get you going? yes, application contexts come to mind - a fixed number of binds comes to mind. Am I going to work them out? No - it is the wrong way to approach a database application.

  • Can I issue this command in PL/SQL: EXECUTE IMMEDIATE '@filename.sql';

    can I issue this command in PL/SQL: EXECUTE IMMEDIATE '@filename.sql';

    Hi,
    Rather the opening a new process (sqlplus), a new connection (need password) etc... I would rather read and execute the file in pl/sql.
    I do not know if someone wrote it already, but here is a quick and dirty code for doing that with UTL_FILE.GET_LINE
    Here, I am only processing some DML statements and no SELECT statements. Correct it as you like !
    CREATE OR REPLACE PROCEDURE run_script ( dir_name IN VARCHAR2,file_name IN VARCHAR2)
    IS
    vSFile UTL_FILE.FILE_TYPE;
    vCmd VARCHAR2(200);
    vNewLine VARCHAR2(200);
    BEGIN
        vSFile := UTL_FILE.FOPEN(dir_name, file_name,'r');
        vCmd := NULL;
        IF UTL_FILE.IS_OPEN(vSFile) THEN
        LOOP
            BEGIN
                UTL_FILE.GET_LINE(vSFile, vNewLine);
                if (vCmd is null) THEN
                    if (upper(vNewLine) like 'INSERT%' or upper(vNewLine) like 'UPDATE%' or upper(vNewLine) like 'DELETE%') THEN
                        if (vNewLine like '%;') THEN
                            /* we have a single line command, execute it now */
                            dbms_output.put_line(substr(vNewLine,1, length(vNewLine)-1));
                            execute immediate substr(vNewLine,1, length(vNewLine)-1);
                        else
                            /* we have a command over multiple line, set vCmd */
                            vCmd := vNewLine;
                        end if;
                    else
                        /* ignore the rest like spool, prompt, accept, errors, host, @, ... */
                        null;
                    end if;
                else
                    if (vNewLine like '%;') THEN
                        /* we have a the last line of the command, execute it now */
                        vCmd := vCmd || ' ' || substr(vNewLine,1, length(vNewLine)-1);
                        dbms_output.put_line(vCmd);
                        execute immediate vCmd;
                        vCmd := null;
                    else
                        /* keep concatenating to vCmd */
                        vCmd := vCmd ||' '|| vNewLine;
                    end if;
                end if;
            EXCEPTION
                WHEN NO_DATA_FOUND THEN
                    EXIT;
                END;
        END LOOP;
        COMMIT;
        END IF;
        UTL_FILE.FCLOSE(vSFile);
    EXCEPTION
        WHEN utl_file.invalid_path THEN
            RAISE_APPLICATION_ERROR (-20052, 'Invalid File Location');
        WHEN utl_file.read_error THEN
            RAISE_APPLICATION_ERROR (-20055, 'Read Error');
        WHEN others THEN
            RAISE_APPLICATION_ERROR (-20099, 'Unknown Error');
    END run_script;
    set serverout on
    create directory scriptdir as '/home/oracle';
    grant read,write on directory to scott;
    exec run_script('SCRIPTDIR', 'test.sql')

  • Execute Immediate with SQL in Stored Procedure

    Dear Experts, Please help / guide on below statement which i want to execute in stored procedure,
    EXECUTE IMMEDIATE 'INSERT INTO TABLE
    SELECT COUNT(AGENTID) FROM TABLE_1 A,
    TABLE_2 B, TABLE_3 C
    WHERE A.COL = B.COL AND B.COL = C.COL AND
    DT BETWEEN TRUNC(SYSDATE-1) + 1/24 + 0/12/60/60 AND TRUNC(SYSDATE-1) + 25/24 - 0/12/60/60';
    Edited by: DBA on Dec 3, 2011 3:57 PM

    So what's the problem? The only thing I can see is:
    INSERT INTO TABLETABLE is reserved word, so name your table differently.
    Also, I am assuming the above statement is actually generated from some variables based on some conditions, otherwise why would you need dynamic SQL, just issue:
    INSERT INTO TABLE
    SELECT COUNT(AGENTID) FROM TABLE_1 A,
    TABLE_2 B, TABLE_3 C
    WHERE A.COL = B.COL AND B.COL = C.COL AND
    DT BETWEEN TRUNC(SYSDATE-1) + 1/24 + 0/12/60/60 AND TRUNC(SYSDATE-1) + 25/24 - 0/12/60/60;

  • Copy the result of Execute immediate result into a variable.

    Hi All,
    Is there any way to copy the result of execute immediate result into a variable.
    am doing following steps but am getting an error.
    varSQLstmt1:='select count(*) into'||vararch_ct||' from '||vararch_count;
    dbms_output.put_line(varSQLstmt1);
    execute immediate varSQLstmt1;
    But am getting sql statement as select count(*) into from SALES
    the variable(vararch_ct) is missing in select statement .
    please help me to solve this issue. Or is there any way to insert the count of records into any variable.
    Thanks
    Sree

    declare
    varSQLstmt1    varchar2(4000);
    v_count          number;
    begin
    varSQLstmt1:='select count(*) from '||vararch_count;
    dbms_output.put_line(varSQLstmt1);   
    execute immediate varSQLstmt1 into v_count;
    dbms_output.put_line('Coutn :: ' || v_count);
    end;

  • Execute immediate on DDL command

    Below sample SQL is 1 of the many code that is running OK in our database. And this code has causes a lot of latch contention to our database and it's being called so many times that cause hard parse.
    /* test code */
    CREATE OR REPLACE PROCEDURE dsal (p_client_id NUMBER) IS
    BEGIN
    EXECUTE IMMEDIATE
    'create table tmp_dsal_'||p_client_id
    ' (client_id number, '||
    ' trade_id number, '||
    ' ps_id number, '||
    ' ps_liquid varchar2(2), '||
    ' status_code varchar2(3) default ''NA'' not null, '||
    ' start_value_dte date, '||
    ' end_value_dte date)';
    EXECUTE IMMEDIATE 'drop table tmp_dsal_'||p_client_id;
    END;
    I want to improve it by using bind variable. The below program compile with no error.
    CREATE OR REPLACE PROCEDURE dsal (p_client_id NUMBER) IS
    BEGIN
    EXECUTE IMMEDIATE
    'create table tmp_dsal_:client_id'||
    ' (client_id number, '||
    ' trade_id number, '||
    ' ps_id number, '||
    ' ps_liquid varchar2(2), '||
    ' status_code varchar2(3) default ''NA'' not null, '||
    ' start_value_dte date, '||
    ' end_value_dte date)' using p_client_id;
    EXECUTE IMMEDIATE 'drop table tmp_dsal_:client_id' using p_client_id;
    END;
    When I execute it, I'm getting the below error. I understand DML statement using bind variable in execute immediate command but not sure on DDL. Is there a workaround on issue or this is limitation?
    SQL> exec dsal(223);
    BEGIN dsal(223); END;
    ERROR at line 1:
    ORA-00922: missing or invalid option
    ORA-06512: at "SYS.DSAL", line 3
    ORA-06512: at line 1
    Appreciate any comment/help. Thanks

    Assuming that all of the client load processes run in seperate session, then do this once in the database and use this global temporary table for the loads. A GTT is a permanent object in the database, but the data it contains is only visible to the session that inserts it. Multiple sessions can access the same GTT at the same time, and will never see each other's data.
    CREATE TEMPORARY TABLE tmp_dsal (
       client_id       NUMBER,
       trade_id        NUMBER,
       ps_id           NUMBER,
       ps_liquid       VARCHAR2(2),
       status_code     VARCHAR2(3) DEFAULT 'NA' NOT NULL,
       start_value_dte DATE,
       end_value_dte   DATE)
    ON COMMIT [PRESERVE|DELETE] ROWSThe on commit clause determines what happens to the data in the GTT when the session that created the data issues a commit. DELETE will automaticall delete all of that session's data while PRESERVE will keep the data until the session either explicitly deletes it or the session ends.
    John

  • Insufficient privileges using execute immediate in after logon trigger

    I have an after logon trigger that executes a package/procedure in the schema it was created in.
    One of the procedures runs the following:
    EXECUTE IMMEDIATE 'AUDIT INSERT TABLE, UPDATE TABLE, DELETE TABLE, EXECUTE PROCEDURE BY ' || USER;
    The procedure is throwing an insufficient privileges error when executing this.
    However - the schema owner has audit any and audit system privileges and - the statement works fine independently.
    When I login as another user this issue arises. The package/procedure are created with definers rights... So - i'm not sure why this is happenening.
    Any help is appreciated.

    privileges acquired via ROLE do NOT apply within named PL/SQL procedures.
    SQL> SET ROLE NONE
    SQL> --issue AUDIT again now                                                                                                                                                                                                                                                               

  • Using EXECUTE IMMEDIATE with an NVARCHAR2 parameter

    Hi everyone,
    In the system I'm working on, my stored procedure receives an NVARCHAR2 parameter which contains a complete SQL statement. e.g.
    'UPDATE SomeTable SET SomeTable.Value = 0'
    I want to be able to execute this dynamically, using EXECUTE IMMEDIATE, but I've encountered a problem where this is apparently not supported (because the string is Unicode).
    It is crucial that the string stays as Unicode, because of the data that may possible be baked into the SQL statement, and so casting it off to a VARCHAR2, or changing the parameter type, is not acceptable.
    Is there a work-around for this issue? Even if it has a performance hit, it will be better than nothing :)
    I've tried something like this;
    declare
    myVal VARCHAR2(256);
    begin
    myVal := 'UPDATE SomeTable SET SomeTable.Value = 2';
    execute immediate 'BEGIN :x; END;' using myVal;
    end;
    But I get an error;
    "bind variable 'X' not allowed in this context"
    Has anyone any ideas?
    Thanks for your help,
    Chris

    uhmm, I'm not sure if this is a valid testcase. the string could still be converted into ascii or we8iso8859p1 or whatever 1byte-character set you want.
    What I think you should test is a two-byte character as part of SQL, PL/SQL resp. as in SQL all words are defined you can not enlarge it with a 2byte word. But in PL/SQL you could define your own variable. If this variable name itself contains a 2byte character, I guess it will fail.
    (I have used l_vär and l_vér as variable names in my example)
    Message was edited by:
    Leo Mannhart
    According to the PL/SQL Reference Guide PL/SQL consists of:
    PL/SQL programs are written as lines of text using a specific set of characters:
    Upper- and lower-case letters A .. Z and a .. z
    Numerals 0 .. 9
    Symbols ( ) + - * / < > = ! ~ ^ ; : . ' @ % , " # $ & _ | { } ? [ ]
    Tabs, spaces, and carriage returns
    This seems no longer up-to-date as I could define a variable l_vär for instance as long as I use a 1byte char set (like iso8859p1). The same variable name as a n-byte char set like UTF-8 will give an error as my example shows.

  • Using EXECUTE IMMEDIATE with XML

    Database version : 10.2.0.3.0 - 64bi
    Hi All,
    I have a xml which is stored in a table, xmltype column.
    i have target insert tables whose column names and xml nodes are same.
    using all_tab_columns table i will generate columns to be passed to xmltable.
    all these data i will store in variables and finally pass to xmltable as below
    just want to know using execute immediate is good to use in XML?
    SQL_STMT := 'insert into '||table_name|| ' ( '||V_COLUMN_NAME||')';
    SQL_STMT := SQL_STMT ||' SELECT ' ||V_XTAB_COLUMN_NAME ||
    ' FROM TO_XML,
    XMLTABLE(' ||v_xpath||
    'PASSING XML_VALUE
    columns ' || V_COLUMNS_DATA_TYPE
    ||') XTAB
    WHERE Seq_NO = ' || P_SEQUENCE_NO ;
    EXECUTE IMMEDIATE SQL_STMT ;
    Thanks and Regards,
    Rubu

    1) is it OK? As I stated above, it can be made to work. It would not be my first choice, but then none of us here know the full details as well as you do so maybe there is a compelling reason to use dynamic SQL.
    Here is the documentation for [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/executeimmediate_statement.htm#LNPLS01317]EXECUTE IMMEDIATE.
    Actually now I finally realize your XML resides in table TO_XML so that means you won't be putting the actual XML into the shared pool via an incorrectly written dynamic SQL statement at least. That is what Odie and I were first concerned about with dynamic SQL usage, that the XML would be hard-coded into your SQL_STMT variable. You are simply changing the columns (in 3 locations). With that setup, you have no need for (nor can use) bind variables. The overall issue of dynamic SQL being slightly slower than static SQL still exists as the SQL statement will first have to be parsed and validated.
    A larger issue in terms of performance is how 10.2 handles XMLTypes. If the underlying XML is large, XMLTable performance degrades quickly. Options around this are to parse the XML in PL/SQL or to upgrade to some version of 11 and use SECUREFILE BINARY XML as the underlying storage structure for the TO_XML.XML_VALUE column.

  • Execute immediate for stored procedure with out parameter

    Hi,
    I have problem with dynamically executing the statement hope anyone can help me.
    I have a table which stores the procedure names. and procedure parameter values are stored on another column with parameter values coming from java side.
    I have to create a procedure that dynamically executes the procedure on table1 with the values from table 2.
    Now I'm getting real trouble to execute immediate this proc with parameters. I tried the DBMS_SQL package as well.
    Problem is you need to mention the OUT mode specifically for the out parameter. Can anybody plz help me with this issue??
    TABLE1_
    PROCESS_ID     PROC_NAME
    1      proc1(p1 IN number, p2 IN varchar2, p3 OUT varchar2)
    2     proc2(p1 IN number, p2 out varchar2, p3 OUT varchar2)
    TABLE2_
    PROCESS_ID     PROC_PARMS
    1     100, 'test', :return
    2     200, :return1, :return2
    Thank You

    826957 wrote:
    Hi,
    I have problem with dynamically executing the statement hope anyone can help me.
    I have a table which stores the procedure names. and procedure parameter values are stored on another column with parameter values coming from java side.
    I have to create a procedure that dynamically executes the procedure on table1 with the values from table 2.
    Now I'm getting real trouble to execute immediate this proc with parameters. I tried the DBMS_SQL package as well.
    Problem is you need to mention the OUT mode specifically for the out parameter. Can anybody plz help me with this issue??
    TABLE1_
    PROCESS_ID     PROC_NAME
    1      proc1(p1 IN number, p2 IN varchar2, p3 OUT varchar2)
    2     proc2(p1 IN number, p2 out varchar2, p3 OUT varchar2)
    TABLE2_
    PROCESS_ID     PROC_PARMS
    1     100, 'test', :return
    2     200, :return1, :return2
    Thank YouSounds like an appalling design and a nightmare waiting to happen.
    Why not have your Java just call the correct procedures directly?
    Such design smells badly of an entity attribute value modelling style of coding. Notoriously slow, notoriously buggy, notoriously hard to maintain, notoriously hard to read. It really shouldn't be done like that.

  • Create temp table using EXECUTE IMMEDIATE

    Is there any performance issue in creating globally temp table
    using EXECUTE IMMEDIATE or creating globally temp table from
    SQL PLUS.
    Any response will be greatly appreciated.
    null

    Anish,
    Creating tables is likely to be an expensive operation.
    Performance issues can only be considered in comparison to
    alternatives.
    Alternatives include: PLSQL tables, cursors and/or recoding so
    that tmp tables are not required. (One of our consultants reckons
    that sqlserver temp tables are usually used to get around
    limitations in sqlserver, ie slightly more complicated sql
    statements could be used instead of simpler sql and temporary
    tables).
    I would think creating the temp table once during sqlplus would
    be cheaper than creating and deleting it repeatedly at run time.
    Note that EXECUTE IMMEDIATE may do an implicit commit (dbms_sql
    certainly does). This may be got over my using the PRAGMA
    AUTONOMOUS_TRANSACTION; direction which places a
    procedure/function in a seperate transaction.
    Turloch
    P.S. We have some difficulty in getting information back from the
    field/customer sites. If you have questions and answers that are
    likely to be useful to other Oracle Migration Workbench
    users, and migrators in general, please send them in for possible
    inclusion in our Frequently Asked Question list.
    Oracle Migration Workbench Team
    Anish (guest) wrote:
    : Is there any performance issue in creating globally temp table
    : using EXECUTE IMMEDIATE or creating globally temp table from
    : SQL PLUS.
    : Any response will be greatly appreciated.
    Oracle Technology Network
    http://technet.oracle.com
    null

  • Create Partition tables in PL/SQL using Execute Immediate

    Hi
    I have to create a partiton table in PL/SQL using Execute Immediate. I concat the necessary Create Table syntax into a variable and use Execute Immediate variable name. This gives a error ORA-00900: invalid SQL statement. However if i cut and paste the SQL statement from DBMS_OUTPUT, the table creation goes through without any problem.
    What could be the issue. Has anyone face this before please.
    I am using 10G DB

    Thanks for your reply. It is a big code. I am pasting the part required.
    v_sqlstmtout :='CREATE TABLE a_10(MYDATE DATE NOT NULL,ID NUMBER(14) NOT NULL)';
    v_sqlstmtout := v_sqlstmtout || ' PARTITION BY RANGE (MYDATE) ';
    v_sqlstmtout := v_sqlstmtout || 'SUBPARTITION BY HASH(id) ';
    v_sqlstmtout := v_sqlstmtout || 'SUBPARTITION TEMPLATE(';
    v_sqlstmtout := v_sqlstmtout || 'SUBPARTITION SP1,SUBPARTITION SP2) ';
    v_sqlstmtout := v_sqlstmtout || '(PARTITION mth_dummy VALUES LESS THAN ';
    v_sqlstmtout := v_sqlstmtout || '('||V_SQLSTMT3||')' || v_sqlstmt||')';
    EXECUTE IMMEDIATE ''''||v_sqlstmtout||'''';
    variables are substituted through data from different tables.
    The output looks like the following
    CREATE TABLE a_10(MYDATE DATE NOT NULL,ID NUMBER(14) NOT NULL)
    PARTITION BY RANGE (mydate) SUBPARTITION BY HASH(id) SUBPARTITION
    TEMPLATE(SUBPARTITION SP1,SUBPARTITION SP2) (PARTITION mth_dummy VALUES
    LESS THAN ('01-MAY-2006'), PARTITION mth_JAN2007 VALUES LESS THAN
    ('01-FEB-2007'))
    The above is the output from DBMS_OUTPUT. If i run this statement the table is created. Please help..

  • Varray in execute immediate

    Hello all,
    I am having a query using Execute Immediate where I want to read values in an array, here is my query:
    declare
    type emp_name is varray(25) of varchar2(30);
    emp_n emp_name;
    begin
    Execute immediate 'Select emp_name bulk collect from emp ' into emp_n;
    end;
    but it is giving me an error: "experession "emp_n" in the INTO list is of wrong type."
    please tell me what is the issue.
    Thanks

    Try this:
    create synonym emp for scott.emp;
    declare
    type emp_name is varray(25) of varchar2(30);
    emp_n emp_name;
    begin
    Execute immediate 'Select ename from emp ' bulk collect into emp_n;
    FOR i IN 1 .. emp_n.LAST loop
      dbms_output.put_line( emp_n(i) );
    end loop;
    END;
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    KING
    TURNER
    JAMES
    FORD
    MILLER
    SCOTT
    ADAMS

  • Insertion Using Execute Immediate

    How to use Execute Immedaite in Inserting while with dynamic table name. Is that possible or we can use only the dynamic values.
    Execute Immediate "Insert Into " || DYNAMIC TABLE NAME || "Values"
    Using (Value_1, Value 2, Value3).

    Why would tables be added later? Are they storing the same structure of data? If so you should be using a single table possibly with partitioning.
    If they are of different structures then you should have one procedure for each structure, otherwise you're going down the Bad Design ^tm^ route. A single procedure should perform a single task. Trying to make generic code is generally considered a lazy design and often leads to performance issues and difficult to track bugs.

  • Disadvantage with 'Execute Immediate'

    What is the disadvantage with 'EXECUTE IMMEDIATE'.

    I think you guys are missing the point here.
    None of the issues listed are 'EXECUTE IMMEDIATE' disadvantages.
    'EXECUTE IMMEDIATE' is a tool. Like DMS_SQL. Like ref cursors. Like explicit cursor. Like implicit cursors.
    A tool, any tool, needs to be used correctly. If you use a hammer and hit a nail so hard that it bents, causing the hammer to slip doing some serious damage to your thumb... whose fault it is?
    Is it The Hammer that is at fault here? Or is the user of that tool?
    There are no disadvantages to using 'EXECUTE IMMEDIATE'. It is a tool. But like all tools it needs to be used correctly and safely. Things like excessive hard parsing because of a severe lack of bind variables, or opening a hole for SQL injection, etc.. all these are symptoms of - and let's be blunt here - an ignorant developer. It has nothing to do with the tool 'EXECUTE IMMEDIATE'.
    And those same type of errors will be made by Mr Ignorant Developer using other tools in Oracle.
    Shoddy workmanship is not because of poor tools. Shoddy code is not because of using a specific feature (like execute immediate).
    The proper question to ask is thus not "what are the disadvantages of execute immediate", but rather "where should I typically use execute immediate and how?".
    Not every developer will know how to use every single tool in the toolbox (I sure don't know all the tools in the Oracle toolbox). So there is nothing wrong with asking.
    But asking what is "wrong" with a tool (aka "what are the disadvantages") is in my view seriously missing the point that a tool is there to solve very specific types of problems...
    That is what a developer should be after - How to use the tool correctly.

Maybe you are looking for