Run immediately produced confusing errors

I have a procedure that removes the selected rows of a table based on a dynamic WHERE condition. The column values are of type VARCHAR2. Using SQL Developer debug mode, I put the finger on the line of boredom to the Execute Immediate statement that produces a ' ORA-00907: lack the right parenthesis "error with or the other of these channels:

v_sql: = ' DELETE FROM schema.table WHERE (column1 = "Value1" GOLD column1 = "Value2" GOLD column1 = "Value3" ") AND (column2 ="value4")';
v_sql: = ' REMOVE FROM schema.table WHERE column1 ("Value1", "Value2", "value3") AND column2 IN ("value4")';
Immediately run v_sql;

Still in PL/SQL, the same lines running without error:

DELETE FROM schema.table WHERE (column1 = 'value1' OR column1 = 'value2' GOLD column1 = 'value3') AND (column2 = 'value4');
REMOVE FROM schema.table WHERE column1 IN ('value1', 'value2', "value3") AND column2 IN ("value4");

I can even run the same instructions in an anonymous block without error:

Set serveroutput on
DECLARE
v_cnt NUMBER;
v_sql varchar2 (2000);
BEGIN
v_sql: = ' REMOVE FROM schema.table WHERE column1 ("Value1", "Value2", "value3") AND column2 IN ("value4")';
Immediately run v_sql;
Run immediately "select count (*) table" in v_cnt;
dbms_output.put_line (v_cnt);
Rollback;
Run immediately "select count (*) table" in v_cnt;
dbms_output.put_line (v_cnt);
END;
/
I must be blind because neither dynaminc SQL statement needs an another right parenthesis. I even added one to test (same error ORA-00907!). I even tried this

v_sql: = "DELETE FROM schema.table WHERE ((column1 = '' valeur1 '') OR (column1 = 'value2'))';"

(same error ORA-00907!)

I even tried to run the same without parentheses (ORA-00900: invalid SQL statement error). I guess the problem is the single quotes.

Just for fun I tried that as well

EXECUTE IMMEDIATE chr (39) | v_sql | Chr (39);

and, as I suspected, I got the error "invalid SQL statement.

I even tried this

EXECUTE IMMEDIATE chr (39) | v_sql;

and of course I got an ' ORA-01756: not correctly completed string "error.

When I tried this

EXECUTE IMMEDIATE v_sql | Chr (39);

the same error "missing right parenthesis" surfaced.

I've never had this problem with the Execute Immediate statements before. Unless someone can offer a penny to buy a clue, looks like I have no choice but to make the Immediate Execute in a loop FORALL to each WHERE condition using a variable binding for the value of the column.

Your procedure changed a bit:
Removed options CHR (39) and 'DELETE FROM' has been added at the beginning of your v_sql variable.

CREATE OR REPLACE PROCEDURE delete_rows_proc (
   p_table        IN   VARCHAR2,
   p_schema       IN   VARCHAR2,
   p_columns      IN   VARCHAR2,
   p_col_values   IN   VARCHAR2,
   p_col_delim    IN   VARCHAR2,
   p_val_delim    IN   VARCHAR2
)
AS
/*
generic procedure to delete selected rows from a table

INPUT PARAMETERS:
1) P_TABLE (required): table name
2) P_SCHEMA (required): schema name
3) P_COLUMNS (required): a delimited string of character type column names
4) P_COL_VALUES (required): a delimited string of column values
(must match P_COLUMNS in delimited sequence and number);
5) P_COL_DELIM (required): column delimiter for P_COLUMNS and P_COL_VALUES;
must be a keyboard character delimiter that DOES NOT appear elsewhere in the column values;
6) P_VAL_DELIM (required): column value delimiter for P_COL_VALUES;
must be a keyboard character delimiter that DOES NOT appear elsewhere in the column values;
must be different from P_COL_DELIM

NOTE: if P_COLUMNS is not null then P_COL_VALUES cannot be null

example of P_COLUMNS and P_COL_VALUES:
P_COLUMNS = 'column1#column2'
P_COL_VALUES = 'value1,value2#value4'
P_COL_DELIM = '#'
P_VAL_DELIM = ','
deletes rows WHERE ((column1 = 'value1') OR (column1 = 'value2') AND (column2= 'value4')
*/
   v_sql              VARCHAR2 (4000);
   v_where_clause     VARCHAR2 (3900);
   v_from_clause      VARCHAR2 (200);
   v_col              VARCHAR2 (50);
   v_txt              VARCHAR2 (1000);
   i_col_delim_cnt1   INTEGER         := 0;
   i_col_delim_cnt2   INTEGER         := 0;
   x_loop_cnt         INTEGER         := 0;
   y_loop_cnt         INTEGER         := 0;
   delim_txt          VARCHAR2 (1000);
   i_delim_cnt        INTEGER         := 0;
   i_cnt              INTEGER;
   e_delim_not_eq     EXCEPTION;

   FUNCTION assemble_or_str (v_col IN VARCHAR2, v_txt IN VARCHAR2)
      RETURN VARCHAR2
   IS
      v_return   VARCHAR2 (1000) := '';
   BEGIN
      IF LENGTH (v_col) > 0
      THEN
-- add opening parenthesis
         v_return := v_return || '(';
      END IF;

      FOR i IN 1 .. i_delim_cnt + 1
      LOOP
         v_return :=
               v_return
            || '('
            || v_col
            || ' = '
            || CHR (39)
            || get_delimited_text (v_txt, p_val_delim, i)
            || CHR (39)
            || ')';

         IF i < i_delim_cnt + 1
         THEN
            v_return := v_return || ' OR ';
         END IF;
      END LOOP;

      IF LENGTH (v_return) > 0
      THEN
-- add closing parenthesis
         v_return := v_return || ')';
      END IF;

--dbms_output.put_line('v_return=' || v_return);
      RETURN v_return;
-- e.g., v_return = '((column1 = 'value1') OR (column1 = 'value2'))''
   END;
BEGIN
   IF p_columns IS NOT NULL AND p_col_values IS NOT NULL
   THEN
-- count the column delimiter in both parameters
      i_col_delim_cnt1 :=
            LENGTH (p_columns)
            - LENGTH (REPLACE (p_columns, p_col_delim, ''));
      i_col_delim_cnt2 :=
           LENGTH (p_col_values)
         - LENGTH (REPLACE (p_col_values, p_col_delim, ''));

      IF i_col_delim_cnt1 = i_col_delim_cnt2
      THEN
-- if both strings have the same # of column delimiters
-- assemble the where clause
         IF i_col_delim_cnt1 = 0
         THEN
-- for single column
-- find how many delimited values are in P_COL_VALUES
            i_delim_cnt :=
                 LENGTH (p_col_values)
               - LENGTH (REPLACE (p_col_values, p_val_delim, ''));

            IF i_delim_cnt > 0
            THEN
--dbms_output.put_line('i_delim_cnt = ' || i_delim_cnt);
-- for single column with multiple column values
               v_where_clause := assemble_or_str (p_columns, p_col_values);
            ELSE
-- for single column with single column value
               v_where_clause :=
                    p_columns || ' = ' || CHR (39) || p_col_values
                    || CHR (39);
            END IF;
         ELSE
-- for multiple columns
            x_loop_cnt := i_col_delim_cnt1 + 1;

            FOR x IN 1 .. x_loop_cnt
            LOOP
-- for each column
               v_col := get_delimited_text (p_columns, p_col_delim, x);
               v_txt := get_delimited_text (p_col_values, p_col_delim, x);
--dbms_output.put_line('loop '||x||': vcol='||v_col);
--dbms_output.put_line('loop '||x||': v_txt='||v_txt);
               i_delim_cnt :=
                    LENGTH (v_txt)
                    - LENGTH (REPLACE (v_txt, p_val_delim, ''));

               IF i_delim_cnt > 0
               THEN
                  v_where_clause :=
                             v_where_clause || assemble_or_str (v_col, v_txt);
               ELSE
                  v_where_clause :=
                        v_where_clause
                     || '('
                     || v_col
                     || ' = '
                     || CHR (39)
                     || v_txt
                     || CHR (39)
                     || ')';
               END IF;

               IF x < x_loop_cnt
               THEN
                  v_where_clause := v_where_clause || ' AND ';
               END IF;
            END LOOP;
         END IF;
      ELSE
-- if i_col_delim_cnt1 i_col_delim_cnt2
-- raise exception
         RAISE e_delim_not_eq;
      END IF;
   END IF;

-- assemble the dynamic SQL statement
   v_from_clause :=
                  (CASE p_schema
                      WHEN NULL
                         THEN ''
                      ELSE p_schema || '.'
                   END) || p_table;
   v_where_clause :=
       (CASE
           WHEN v_where_clause IS NULL
              THEN ''
           ELSE ' WHERE ' || v_where_clause
        END
       );
   v_sql := 'DELETE FROM ' || v_from_clause || v_where_clause; -- Added 'DELETE FROM '
   DBMS_OUTPUT.put_line (v_sql);

-- test clauses separately
-- EXECUTE IMMEDIATE 'DELETE FROM '|| v_from_clause;
-- EXECUTE IMMEDIATE 'DELETE FROM '|| v_from_clause || v_where_clause;
   EXECUTE IMMEDIATE v_sql;

   EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || p_table
                INTO i_cnt;

   DBMS_OUTPUT.put_line ('i_cnt = ' || i_cnt);
   ROLLBACK;

   EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || p_table
                INTO i_cnt;

   DBMS_OUTPUT.put_line ('i_cnt = ' || i_cnt);
--commit;
EXCEPTION
   WHEN e_delim_not_eq
   THEN
      DBMS_OUTPUT.put_line
         ('ERROR: delimiter number mismatch! A column delimiter was found in the P_COLUMNS string and/or the P_COL_VALUES string; however, the number of column delimiters between the two string does not match. Process cannot be completed.'
         );
-- WHEN OTHERS THEN
-- DBMS_OUTPUT.PUT_LINE('Error in DELETE_ROWS_PROC procedure!');
-- DBMS_OUTPUT.PUT_LINE(SQLERRM);
END delete_rows_proc;
/
SQL> SELECT * FROM TABLE1
  2  /

COLUMN1                                            COLUMN2
-------------------------------------------------- -------------------------------------------------
value1                                             value3
value2                                             value3
value3                                             value3
value4                                             value3
value1                                             value4
value2                                             value4
value3                                             value4
value4                                             value4

8 rows selected.

SQL> exec DELETE_ROWS_PROC('TABLE1', 'SCOTT', 'COLUMN1#COLUMN2', 'value1,value2#value4', '#', ',')
DELETE FROM SCOTT.TABLE1 WHERE ((COLUMN1 = 'value1') OR (COLUMN1 = 'value2')) AND (COLUMN2 = 'value4
i_cnt = 6
i_cnt = 8

PL/SQL procedure successfully completed.

SQL> 

I hope this helps.

Kind regards
JO

Edit: Deleted a wrong comment

Tags: Database

Similar Questions

  • run immediately fails with the error

    The following code generates the error and I can not understand what the problem is:

    SET SERVEROUTPUT ON;

    declare

    Val number (21);

    s_sql varchar2 (2000);

    Start

    s_sql: = q '{select last_number in the Vale of all_sequences where sequence_owner = 'SST' and sequence_name = "ADDRESS_SEQ"}';

    Dbms_output.put_line ('sql 1 ' | s_sql);

    run immediately s_sql;

    end;


    Error report:

    ORA-00905: lack of keyword

    ORA-06512: at line 7

    00905 00000 - 'lack the key word'

    * Cause:

    * Action:

    select last_number SQL 1 in val all_sequences where sequence_owner = 'SST' and sequence_name = "ADDRESS_SEQ."

    The error is strange since

    Select last_number in the all_sequences where sequence_owner = 'SST' and sequence_name = "ADDRESS_SEQ."

    is a valid instruction

    Although I see no need for SQL dynamic in this case, in general, you must provide the vatiable to receive the value of the select statement outside the immediate execution.  More like:

    s_sql: = q '{select last_number in the all_sequences where sequence_owner = 'SST' and sequence_name = "ADDRESS_SEQ"}';

    execute immediate s_sql in val

    John

  • ONE ERROR: run immediately (p_sql) return to p_id;

    Has written a simple procedure:

    procedure p_test)
    P_ID number,
    p_sql in varchar2
    *)*
    is
    Start
    run immediately (p_sql) return to p_id;
    end;

    Now, test it:

    declare
    P_ID number;
    p_sql varchar2 (2000): = ' insert into test1 (pk, str) values (1, "aaa")';
    Start
    pkg_utility.sp_save_without_blob (p_id, p_sql);
    dbms_output.put_line ('p_id' | p_id);
    end;


    The problem:
    Without the 'back in p_id' statement, the sql code can be run successfully. But with the "p_id return', an error occurred:

    ORA-20999: unexpected error when insert into test1 (pk, str) values (1, 'aaa')
    ORA-01006: there is no bind variable


    What I've done wrong? and how do I solve the problem?


    Thank you for helping.

    You're not saying 'what' you try to return.

    See the examples in the doc of PL/SQL
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#BABHDGIG
    >
    Example 5-52, using the RETURN IN the Clause with a Record

    DECLARE
    RECORD IS of TYPE EmpRec (last_name, employees.last_name%TYPE,
    salary employees.salary%TYPE);
    method EmpRec;
    emp_id NUMBER: = 100;
    BEGIN
    UPDATE employees SET salary = salary * 1.1
    WHERE employee_id = emp_id
    RETURN last_name, salary INTO method;
    DBMS_OUTPUT. PUT_LINE
    ("Just give a stimulus to ' | emp_info.last_name |)
    ', which now makes | emp_info.salary);
    ROLLBACK;
    END;
    /

  • procedure call to run immediately

    Hi Please help me call the procedure to run immediately.

    I am trying to execute the procedure for several tables.

    the same procedure on the SQL prompt works very well as shown below.

    EXECUTE PROC1 ('BC_COALMINE');

    Start

    for rec in (select table_name

    from all_tables

    where table_name like '% BC_.

    )

    loop

    run immediately 'execute proc1 (rec.table_name);

    end loop;

    end;

    I get an error invalid SQL ORA-900.

    concerning

    EXECUTE is a SQL Plus command. In PL/SQL, you can simply call the procedure. And you need not EXECUTE IMMEDIATE. You can make a static call to the procedure. Like this.

    Start

    for rec in (select table_name

    from all_tables

    where table_name like '% BC_.

    )

    loop

    PROC1 (Rec.table_name);

    end loop;

    end;

  • Oracle 11G copy a table to help to run immediately

    I want to copy the contents of a table in another aid to run immediately.

    It keeps fails with the following error

    ORA-00903: invalid table name
    ORA-06512: at "TABLE_COPY", line 6
    ORA-06512: at line 8 level



    create or replace
    procedure TABLE_COPY)
    Table1 varchar2,
    Varchar2 TABLE2)
    is
    Start
    run immediately 'insert'. TABLE2. "(select * from ' |) TABLE1 |') ' ;
    end;

    Published by: user9213000 on January 24, 2013 07:38

    user9213000 wrote:
    I want to copy the contents of a table in another aid to run immediately.

    It keeps fails with the following error

    ORA-00903: invalid table name
    ORA-06512: at "TABLE_COPY", line 6
    ORA-06512: at line 8 level

    create or replace
    procedure TABLE_COPY)
    Table1 varchar2,
    Varchar2 TABLE2)
    is
    Start
    run immediately 'insert'. TABLE2. "(select * from ' |) TABLE1 |') ' ;
    end;

    Published by: user9213000 on January 24, 2013 07:38

    Standard when boards (ab) use of EXECUTE IMMEDIATE is to compose the SQL statement in a single VARCHAR2 variable
    Then print the variable before passing to EXECUTE IMMEDIATE.
    COPY the statement & PASTE in sqlplus to validate its correctness.

  • How to pass a sequence of 'help' to run immediately

    How can I place a sequence.nxlval as a parameter using, here is my code looks like

    sql_string is-> insert into some_tab (col1, col2,...) (select col1: passed_seq,...) where the... (I want to insert values in sequence for col2)


    and I call it like


    passed_seq: = "seq_". some_dynamic_num |'. nextval' (in my PB will be sequences with the string formed as seq_10.nextval)

    EXECUTE IMMEDIATE sql_string using passes_seq;

    If I do like this I get

    Error: - 1722:ORA - 01722: invalid number seq_10.nextval

    Published by: DIVI on 8 January 2013 07:40

    >
    So is there another way to solve my problem, where queries are already formed and stored in a table in the form of data in the column, and I need to run those from different sequences in different scenarios.
    >
    Yes - you change applications to use a placeholder for the sequence you need (e.g. [SEQ_GOES_HERE]) when you need to run it you create a PL/SQL block into a VARCHAR2 variable, then use run immediately on the variable.

    If your stored query would look like this

    sql_string is -> insert into some_tab (col1,col2, ....) (select col1,[SEQ_GOES_HERE],......) where .... 
    

    Load the good seq.nextval in a variable, and then replace "[SEQ_GOES_HERE]" in the query with this value.

  • Run immediately - please help

    Hello

    I have a requirement where I have to choose the number of records in each table (which meets specific criteria) in a variable and print it.
    I wrote the following piece of code which results in an error.

    Code:
    declare
    row_cnt number;
    v_query varchar2 (200);
    Start
    for x in (select table_name
    from all_tables
    where owner = ' EDI$ ".
    table_name order)
    loop
    v_query: = ' select count (*) in: Y of ' | x.table_name;
    dbms_output.put_line (x.table_name);
    dbms_output.put_line (v_query);
    execute immediate v_query using row_cnt;
    end loop;
    end;
    /


    Output:
    EDI_UFE
    Select count (*) in: Y de EDI_UFE
    ERROR on line 13:
    ORA-06550: line 13, column 14:
    PLS-00103: encountered the symbol "SELECT" at the expected in the following way:
    (- + new case mod not null < an ID >)


    Let me know if the code has a any error.

    Thanks in advance.

    declare
    row_cnt number;
    v_query varchar2 (200);
    Start
    for x in (select table_name
    from all_tables
    where owner = ' EDI$ ".
    table_name order)
    loop
    v_query: = ' select count (*) from ' | x.table_name;
    dbms_output.put_line (x.table_name);
    dbms_output.put_line (v_query);
    run immediately v_query in row_cnt;
    end loop;
    end;
    /

    Edited by: lifexisxnotxsoxbeautiful Vithalani March 4, 2011 04:36

  • ORA-01031: insufficient privileges on run immediately 'create a table... '. »

    Hello. I created a stored procedure that starts an immediate execution "create table..." Responses to Oracle with the message ' ORA-01031: insufficient privileges.

    I solved the problem adding 'authid current_user is' in the procedure declaration.

    Unfortunately, if I try to plan his by DBMS_JOB, responses to oracle with the same error again.

    Why? And how can I avoid it?

    Thank you very much in advance

    Published by: user4501018 on 6-mag-2010 4.00

    user4501018 wrote:

    Unfortunately, if I try to plan his by DBMS_JOB, responses to oracle with the same error again.

    Add:

    run immediately "role play all THE ';"

    before immediate 'create table..."

    SY.

  • run immediately and the set of query results

    Hi gurus,

    I want to create a series of paintings on the fly using run immediately.
    the table_names are stored in another table work_table.


    run immediately (select 'create table' | table_name |) '(id int)' of
    * (select table_name in work_tables)); *


    This will raise error.

    ORA-06550: line 1, column 18:
    PLS-00103: encountered the symbol "SELECT" at the expected in the following way:

    (en) - + new case mod not null < an ID >
    < between double quote delimited identifiers of > < a variable binding >


    instead of using a cursor to run one by one is the lines an alternative solution?

    Thank you very much
    Charles

    May not know why you want to do it in a single statement, anyway:

    SQL> select * from work_tables;
    
    TABLE_NAME
    ------------------------------
    x1
    x2
    
    SQL> declare
      2  str varchar2(32000);
      3  begin
      4    for r in (select table_name from work_tables) loop
      5      str := str || 'execute immediate ''create table ' || r.table_name || '( id int )''; ' ;
      6    end loop;
      7
      8    execute immediate 'begin '||str||' end;';
      9
     10  end;
     11  /
    
    PL/SQL procedure successfully completed.
    
    SQL> desc x1
     Name                                                        Null?    Type
     ----------------------------------------------------------- -------- ------------------------------
     ID                                                                   NUMBER(38)
    
    SQL> desc x2
     Name                                                        Null?    Type
     ----------------------------------------------------------- -------- ------------------------------
     ID                                                                   NUMBER(38)
    

    Max
    http://oracleitalia.WordPress.com

    Published by: Massimo Ruocchio, February 18, 2010 15:03

  • run immediately - stop running on "no data found".

    run immediately v_sql
    in v_georaster
    using p_prin_id;

    On an exception "no data found", execution seems to stop. No error is thrown. If I wrap an exception/begin/end block around I can catch the error.

    11 GR 1 material patch7

    What is this problem fixed in 11 GR 2?

    itsme1234 wrote:
    Select wma_test.insert_coin (double);

    If you call your function in a SQL statement. In this case, it throws an error like "0 rows returned" is a valid state for a SQL statement.

    If you want no_data_found to throw an error when it is called from a SQL statement, you must trigger a different error - user-defined would be best.

  • run a string using to run immediately

    Hi experts,

    How can I run a string using to run immediately

    f.g. I want to execute the statement given below, but it gives "ORA-00900: invalid SQL statement" error:

    run immediately "select id from enterpriseuser";

    Thank you very much

    You must run as below:

    SQL> declare
      2  v_test pls_integer;
      3  begin
      4  execute immediate 'select 2 from dual' into v_test;
      5  dbms_output.put_line('v_test ' || v_test);
      6  end;
      7  /
    v_test 2    
    
  • How can I create VI with inputs that run immediately when the update?

    I'm using LabView for controlling stepper motors. I would create a VI with a front panel that has 4 arrows, 2 per engine. My goal is to be able to run the VI and then press a button to move the engine.

    I created separate VI for each funcition of engines - one vi to set current operations, to determine the current travel, another to move up by a certain amount and so on. Work of these vi and I can move and adjust engines, but only by running separate VI.

    How can I combine them into a single VI and make them run to the pressure of a button or the change of a property? An example would be to establish a new current holding company and place the operation current vi run immediately and send the order to the engine. Then continue to press the arrow keys without having to hit 'run' on an another vi.

    Thank you very much


  • Error: Autochk cannot run because of an error caused by a recently installed software. An error occurred__766f6c756d652e63 3f1 unknown

    Original title: Windows 7 system files is the name of volume NTFS is the operating system. It cannot open volume for direct access. Autochk cannot run because of an error caused by a recently installed software. An error occurred__766f6c756d652e63 3f1 unknown

    I have recently updated from Vista home premium to Windows 7 Home premium and it worked fine, until recently, I'm getting the above message whenever I start my laptop. I can't do a system restore, and this error tells me to do a system restore. I downloaded the upgrade of the internet, so I don't have a copy or a disk to reinstall. Can someone help me solve this problem or do I have to uninstall all the recent software programs?

    Thank you

    Hi Lowey58

    I had exactly the same problem. It worked for me:

    1 uninstall antivirus (mine was AVG free v9)

    2. plan chkdsk on reboot

    3. restart

    4. now, CHKDSK runs and corrects problems of disc he

    5 re-install AVG

    Try it and if it works post a response so that others know that ot worked for you also.

  • I/o Error: Cannot run program "C:\Program": error CreateProcess = 87 using ant

    Hi guys,.

    I'm trying to build my console application using Ant. It is a part of my build.xml

       
    
            
            
                
                
            
        
    
        
            
                
            
            
            
        
    

    When I try to "build Ant" I get this error returned:

    I/o Error: Cannot run program "C:\Program": error CreateProcess = 87, the parameter is incorrect

    referring to this line:

    
    

    I tested the names of directory and environment variables all (the variable

    ${46.jde.home}
    

    too) is set correctly, but the error is still there... How could I solve this problem?

    Thank you very much

    Sometimes, the length of the path give birth this error but I have not seen in a while. I ended up installing most of my OCD: \RIM apps to avoid path issues all together.

  • What is the purpose of USE in "run immediately".

    Hi all

    I just want to understand what is the purpose of USING in "EXECUTE IMMEDIATE".

    Say for example, the procedure below, what is the difference? Both will end up in the same result.

    DECLARE

    FIXED_STAT VARCHAR2 (4000);

    VAL_STAT VARCHAR2 (4): = "ijkl";

    BEGIN

    EXECUTE IMMEDIATE ' INSERT INTO abcd (efgh) VALUES (: text_string)' USING "ijkl";

    FIXED_STAT: = "INSERT INTO abcd (efgh) VALUES ('|)" VAL_STAT |') ' ;

    IMMEDIATELY RUN FIXED_STAT;

    END;

    /

    Two major assets to HELP to run immediately, i.e. using parameters

    (1) SQL statement should not hard analysed by the database every time [performance gain].

    (2) more important, to avoid the "SQL injection" and ensure that the variable data will be properly includes as part of the statement

Maybe you are looking for