stored - procedure parameter problem table

Hello

I have the Oracle database version: 11.1.0.7
I downloaded ojdbc5.jar for this version.
and...

I have stored procedure:
PROCEDURE procedure_name (
 
     param1         IN       table1.objectid%TYPE,
     param2         IN       table1.objecttype%TYPE,
     param3         IN       table2.tariffid%TYPE,
     param4         IN       DATE,
     param5         IN       DATE,
     param6         IN       table3.saleschannelid%TYPE,
     param7         IN       rulemasteridtable,           
     param8         OUT      ruleid_table,
     param9         OUT      INT
    ); 
 
 
type     SCHEMA.RULEMASTERIDTABLE as table of number(15 ,5)
 
TYPE ruleid_table IS TABLE OF table4.rulemasterid%TYPE
INDEX BY BINARY_INTEGER;
As you can see the most interesting parameters are param7 and param8.

I want to call this procedure using JDBC. I tried this way:
OracleCallableStatement stmt = (OracleCallableStatement)connection.prepareCall(
 
                        "CALL SCHEMA.PKG.procedure_name(?, ?, ?, ?, ?, ?, ?, ?, ?)"); 
 
 
            stmt.setLong("param1", new Long(27167));
            stmt.setString("param2", new String("SOME_STRING")); 
            stmt.setLong("param3", new Long(27167)); 
 
            java.util.Date date = new java.util.Date();
            stmt.setDate("param4", new Date(date.getTime())); 
 
            java.util.Date date2 = new java.util.Date();
            stmt.setDate("param5", new Date(date2.getTime()));
 
            stmt.setLong("param6", new Long(1)); 
 
            ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("SCHEMA.RULEMASTERIDTABLE", connection);
            stmt.setArray("param7", new ARRAY(descriptor, connection, new Long[]{})); 
 
            stmt.registerOutParameter("param8",OracleTypes.PLSQL_INDEX_TABLE); 
 
            stmt.registerOutParameter("param9", Types.INTEGER); 
 
            stmt.executeUpdate();
When I run this code I get an exception:
Exception in thread "main" java.sql.SQLException: Missing IN or OUT parameter at index:: 8
      at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
       ....
I don't know why I get this exception. Could you explain to me what's wrong with my code?
I think OracleTypes.PLSQL_INDEX_TABLE for my param8 is ok. If I use different type I get Exception: number or types of evil...

Please help me and thank you in advance.
Hubert

I've never seen an OracleTypes.PLSQL_INDEX_TABLE in action before. Documentation:

http://download.Oracle.com/docs/CD/E11882_01/Java.112/e10590/typesupp.htm

"Note: there is a PLSQL_INDEX_TABLE type, but it does not appear to be used outdoors."

You could look at using a registerIndexTableOutParameter.

For an example, see:

http://www.Oracle.com/technology/sample_code/tech/Java/sqlj_jdbc/files/Oracle10g/plsqltables/Readme.html

Tags: Java

Similar Questions

  • How to pass the content of the table as OUT of the stored procedure parameter

    Hi all

    I am writing a stored procedure where he must accept date as one of the parameters IN and it must interrogate the table of database on this criterion and should address data in a temporary table.

    in the end, he must send all the data from the temporary table as the OUT parameter.

    How to get there? should I create a new TYPE with all the columns in the Temp table and use this Type as a parameter? or SYS_REFCURSOR is the best option.

    Thanks in advance.

    Hello

    The best way to do what you want depends on what you want.  Start by describing what you need to do.  It is best to post some data examples (CREATE TABLE and INSERT statements), and what results you want from this sample data.  (See the FAQ forum: https://forums.oracle.com/message/9362002)

    If you have any ideas on how to do the work (for example, populating a temporary table) it may be useful to include those who, too, but a clear distinction between WHAT you do and HOW you do it.

    Bencol suggested, a SYS_REFCURSOR may be the best way to transmit the results.

    Since you only post your table, or even describe what you wanted to do with it, I will illustrate using scott.emp, which is probably on your system.

    Say you want a procedure that takes a DATE as an argument, then returned a certain designated columns (empno, ename, and hiredate in the example below) for all employees hired from the given DATE.  You can write a procedure like this:

    CREATE OR REPLACE PROCEDURE hired_since

    (IN start_date DATE

    out_data ON SYS_REFCURSOR

    )

    AS

    BEGIN

    OPEN FOR Out_data

    SELECT ename, empno, hiredate

    FROM scott.emp

    WHERE hiredate > = start_date;

    END hired_since;

    /

    DISPLAY ERRORS

    You can test it in SQL * more like this:

    VARIABLE c REFCURSOR

    EXEC hired_since (DATE ' 1982-01-01',: c);

    PRINTING: c

    The output I received this test was:

    ENAME, EMPNO, HIREDATE

    ---------- ---------- ---------

    7788 SCOTT APRIL 19, 87

    7876 ADAMS MAY 23, 87

    7934 MILLER JANUARY 23, 82

  • Question about handling apostrophe in the stored procedure parameter

    I was wondering how people have dealt with this problem.  In my process I use the operation to execute stored procedure (sp) to write data to a database, and it is by the way the field values to the sp as parameters.  Works fine when everything is normal but as soon as an apostrophe is added in one of the fields, ka-boom.  It breaks .  So I have been messing around with the means to fight against this problem and did not really come wih an appropriate option.  I know that I can go on the form and write a few RegEx and change the single apostrophe double that would work, but I have to write in several events since the form is sent to someone else and I can't have them seeing "clerk"s"instead of"clerk".  Right now I'm writing an xpath statement that would replace the single apostrophe with a double bed with no luck.  I was wondering if anyone else has had this problem and found an easy solution.  Thank you

    Mike

    Why not use the parameterized query option.

    In this way, your settings are replaced by some? and you don't get messed up with the '

    Your select statement would look like: select * from table where column1 =? and column2 =?

    Then you can map the? s in the process variables.

    Jasmine

  • Cannot specify precision of the year in the RANGE of stored procedure parameter

    Version Oracle 10.2.0.3.0

    I write a PL/SQL stored procedure that accepts a parameter of type INTERVAL YEAR TO MONTH. For example...
    CREATE OR REPLACE PROCEDURE INTERVAL_TEST ( pin_Interval IN INTERVAL YEAR TO MONTH )
    Problem with the above is that if I try to call with pin_Interval = 100-00', I get the following error...
    ORA-01873: the leading precision of the interval is too small
    ... but I'm not able to specify the precision of the component 'YEAR' in the following stored procedure definition...
    CREATE OR REPLACE PROCEDURE INTERVAL_TEST ( pin_Interval IN INTERVAL YEAR(4) TO MONTH )
    ... This translates by...
    PLS-00103: Encountered the symbol "(" when expecting one of the following:     to 
    Try as I might, I can't create a stored procedure that will take in an INTERVAL YEAR TO MONTH more precisely 2 on the year.

    I hope that I do just something stupid, and this is not a limitation of PL/SQL.

    Any help is appreciated.

    Hello

    Is the maximum number of decimal digits of the value of each field (YEAR and MONTH) 2, excerpt from [Datetime and Interval examples | http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm#BABBICGH]

    Kind regards

  • Call to the stored procedure parameter passing script

    Hello

    I have a database on linux server. On the same server, there is a shell script which takes 3 parameters.

    Now I want to do a procedure (stored procedure) that will have 3 parameters pass and run this script with these settings.

    I had created object directory pointing to the correct directory granted all privileges on it (I hope).

    Now, I wondered how the code of procedure?

    I also did a program within the database which takes 3 parameters, but I don't know how to operate it. I don't know if I can use work to run the program, because

    It is a multi user thing and I think that this will not work as expected if 2 or more users run it.

    In any case, I was hoping that I can solve this problem by creating the procedure that will run the script that is provided with 3 parameters, that I need.

    I hope I'm clear on what I want to do.

    Please if you have an idea how to Edifier post your ideas.

    Thank you!

    Hello

    first I want to thank you for the reply.

    option 1... I don't want not to use java or c because I have no skills in programming languages.

    option 2 you mentioned dbms_scheduler.

    If I understand the procedure should go like that.

    I create whitin database program. Then I create a job which runs this program. And whenever I want to run my shell script, I'll do the work.

    WHA happen if 2 different users will want to run the script at the same time?

    Thank you for your response.

  • Stored procedure, unlike the tables, not in recyclebin, why?

    Hi, I have found that when I drop a stored procedure, it won't go in recyclebin but be permanently deleted.
    Why is this? Why not put recyclebin as table, in case he wants to return?

    My version of db is 10 gr 2.

    Thank you

    Perhaps because a stored procedure does not have its own physical segment but is stored with other PL/SQL objects in the dictionary table
    and note that this trash is also not enabled for SYS objects.

  • The Null value as the default value for an input to a stored procedure parameter

    Hello

    How can we set the default values with the NULL value for the parameter in a stored procedure.
    create or replace procedure emp_proc ( p_test_input in varchar2
                                                        p_emp_id in number,
                                                        p_emp_name in varchar2,
                                                       p_manager_id in number )
    as
      begin
       if ( upper ( p_test_input ) = 'I' )
       then
          insert into emp
          values      ( p_emp_id  ,p_emp_name ,p_Manager_id,sysdate );
       elsif ( upper ( p_test_input ) = 'D' )
       then
          delete from emp
          where       emp_id  = p_emp_id;
       else
          dbms_output.put_line
             ( 'Please input ''A'' for ADD or ''D'' Delete  EMPLOYEE'
             );
       end if;
    end;
    As described above if I want to delete only the functioning

    I want to call this procedure without pass additional parameters.
     EXECUTE  emp_proc('D',1010);
    Published by: Rede on May 28, 2010 12:21

    Published by: Rede on May 28, 2010 12:22
    create or replace procedure emp_proc ( p_test_input in varchar2,
                                                        p_emp_id in number,
                                                        p_emp_name in varchar2 default null,
                                                       p_manager_id in number default null )
    
  • Create the stored procedure with the table from another throw diagram PLS-00201

    Oracle 10g. I'm new on procedures, so maybe I'm missing something obvious.

    The ABC schema owner has table T2001_WRITEOFF. The SYSDBAs given SIUD Some_Update_Role and granted this role to developer user IJK. IJK user then created a private synonym T2001_WRITEOFF for ABC. T2001_WRITEOFF. It worked with the usual SQL DML commands.

    When I try to create a simple procedure, it throws PLS-00201 identifier "T2001_WRITEOFF" must be declared and the points of the 2nd line.

    create or replace procedure woof1(
      fooname
    in T2001_WRITEOFF.territory%TYPE,  <=== error points here
      bardesc
    IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
    BEGIN
      
    INSERT into T2001_WRITEOFF
      
    VALUES ( fooname, bardesc);
    END woof1;
    /


    What I am doing wrong?


    Thank you

    JimR


    Grant the necessary rights directly to the user (not through a role):

    http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551289900368934430

  • Pass an array of bytes to the oracle stored procedure

    I have a problem with moving from byte array in Oracle stored procedure as an input parameter by using odp.net.

    Here is the signature of the stored procedure:

    SOMEPROCEDURE(session IN NUMBER, data IN RAW)

    Here is c# code, which calls the procedure:

    var cmd = new OracleCommand("SOME_PROCEDURE", _connection);

    cmd.CommandType = CommandType.StoredProcedure;

    var bt = new byte[]{1,68,0,83,128,1};

    OracleParameter sessionId = new OracleParameter("dbSessionId", OracleDbType.Decimal, new OracleDecimal(_dbSessionId), ParameterDirection.Input);

    OracleParameter data = new OracleParameter("statusData", OracleDbType.Raw, new OracleBinary(bt), ParameterDirection.Input);

    cmd.Parameters.Add(sessionId);

    cmd.Parameters.Add(data);

    cmd.ExecuteNonQuery();

    This code does not (stored procedure throws exception, which cannot receive), because in byte array hadou number 128!, if I display 128 on another number, minus 128, it works great!

    What should I do?

    After some tests I found the solution. Initially, you cannot switch to the array of bytes via the odp.net stored procedure, if the table contains 127 large values.

    Yes, solution: 1. create the wrapper procedure

    procedure SOME_PROCEDURE_WRAPPER (p_session_id in number, p_data  in varchar2)
     is v_data raw(1024);
     rawdata raw(1024); 
     rawlen number;
     hex varchar2(32760);
     i number;
     begin
      rawlen := length(p_data);
      i := 1;
      while i <= rawlen-1
      loop 
     hex := substrb(p_data,i,2); 
         rawdata := rawdata || HEXTORAW(hex); 
         i := i + 2; end loop; 
         SOME_PROCEDURE(p_session_id , rawdata); 
     end;
    

    2 then need to modify the code c# in this way:

     var cmd = new OracleCommand("SOME_PROCEDURE_WRAPPER", _connection);
     cmd.CommandType = CommandType.StoredProcedure;
     string @string = statusData.ToHexString();
     OracleParameter sessionId = new OracleParameter("dbSessionId", OracleDbType.Decimal, new OracleDecimal(_dbSessionId), ParameterDirection.Input);
     OracleParameter data = new OracleParameter("statusData", OracleDbType.Varchar2,@string.Length, new OracleString(@string), ParameterDirection.Input);
     cmd.Parameters.Add(sessionId);
     cmd.Parameters.Add(data);
     cmd.ExecuteNonQuery();
    

    where

    public static string ToHexString(this byte[] bytes)
     { 
         if(bytes == null || bytes.Length == null)
               return string.Empty;
          StringBuilder hexStringBuilder = new StringBuilder();
          foreach (byte @byte in bytes)
          { 
              hexStringBuilder.Append(@byte.ToString("X2")); 
          } 
          return hexStringBuilder.ToString();
     }
    
  • Nested cursor in stored procedure.

    Hello.

    I'm trying to extract data from Ref Cursor ON filling by the stored procedure parameter.
    Using the latest version of the ODP.NET (11.2.0.3.0) provider.

    My stored procedure:

    TYPE cursor_type IS REF CURSOR;


    PROCEDURE test_proc (p_recordset to cursor_type) AS

    BEGIN

    OPEN FOR P_recordset
    SELECT 1, 2, CURSOR (SELECT FROM dual 3.4)
    OF the double

    END;
    END test_proc;


    If I remove ' * SLIDER (SELECT 3.4 FROM dual) * "the procedure, everything works fine.
    But when the nested cursor exists in procedure, I'm getting the following exception:


    System.NullReferenceException is produced
    Message = object reference not set to an instance of an object.
    Source = Oracle.DataAccess
    StackTrace:
    at Oracle.DataAccess.Client.OracleDataReader.GetOraDbTypeEx (Int32 i)
    to Oracle.DataAccess.Client.OracleDataReader... ctor (OracleConnection connection, opsDacCtx IntPtr, IntPtr opsSqlCtx, IntPtr opsErrCtx, OpoSqlValCtx [] pOpoSqlValCtx, OpoDacValCtx * pOpoDacValCtx, metadata metadata, Int32 resultCount, CommandBehavior commandBehavior, safeMapping Hashtable, String commandText, Int32 freeOpsSqlCtx, Boolean bFetchSizePropertySet) *.
    at Oracle.DataAccess.Types.OracleRefCursor.GetDataReader (Boolean fillRequest)
    at Oracle.DataAccess.Types.OracleRefCursor.GetDataReader)
    to CursorTester.Program.NestedCursorAsOutParamStoredProc () in

    InnerException:


    My c# code:

    using (OracleConnection conn = new OracleConnection (connString))
    *{*
    OracleCommand command = new OracleCommand();
    command. Connection = conn;
    adCmdTable = System.Data.CommandType.StoredProcedure;
    command.CommandText = "test_proc;

    OracleParameter parameter1 = new OracleParameter();
    "Parameter1". Direction = ParameterDirection.Output;
    "Parameter1". OracleDbType = OracleDbType.RefCursor;

    command. Parameters.Add (parameter1);

    command. Connection.Open ();

    command. ExecuteNonQuery());

    OracleRefCursor r = command. Parameters [0]. Value as OracleRefCursor;

    var reader = r.GetDataReader (); Here the exception is thrown
    *}*

    If I'm changing procedure output parameter signature, to return the value code throws the same exception.


    I am tempted to google about this problem, but impossible to find at least a topic with the same problem (same exception).
    I've seen a few old threads (from 2004-2005), where people declaring that nested cursors are not supported in ODP.NET.
    On the other hand, I can't find any official publication of the latest version ODP.NET, that nested cursors are still not supported.

    I will very grateful, if someone can tell me of sense about this problem. Already stuck on this for a few days.
    Thank you!

    ODP.NET does not support nested cursors.

  • Select conditional in stored procedure

    Select conditional in stored procedure

    I table a table b, I would like to do otherwise rank in table and select table.

    Otherwise, select table one

    airfare so I have the follow-up in the code, how do I call


    create or replace PROCEDURE of test (app_numb VARCHAR2, examtype out VARCHAR2) is

    v_counter number: = 0;

    REC cursor is

    Select * where appno = app_numb;

    BEGIN

    v_counter: = 0;

    FOR r loop rec

    v_counter: = v_counter + 1;

    end loop;

    If v_counter = 0 Then

    Select exam_type in the examtype of b;

    DBMS_OUTPUT. Put_line (examtype);

    On the other

    DBMS_OUTPUT. PUT_LINE ('ABCD');

    End if;

    PS it would be generally more appropriate for a procedure of "getter" is in fact a function and the return value as a RETURN statement, rather than using THE parameters, which are generally not a good method to return data.

  • Multi-threading parallel processing of stored procedures

    Hi guys,.

    I have the following scenario, and I would like to realize parallel processing to increase the performance of data refresh:

    Stored procedure "SP1" - refresh table A
    Stored procedure 'SP2' - Update table B
    Stored procedure "SP3" - updates table C

    I would like to be able to update table A, B and C table at the same time, could someone help me identify ways in what could be achieved if something like this is possible?

    I use collections in stored procedures SP1, SP2 and SP3 to accelerate the time to refresh table, although would like to know how parallel update tables.

    I have briefly heard the dbms_pipe package, which would be useful in this scenario?

    Thank you
    Rohan

    rbha4 wrote:

    I use collections in stored procedures SP1, SP2 and SP3 to accelerate the time to refresh table, although would like to know how parallel update tables.

    As already mentioned - perform these distinct process procedures in planning jobs. DBMS_JOB and DBMS_SCHEDULER interfaces can be used. If the work queue manager supports (has been configured) with 3 or more processes working slots and these are empty and not used, then all the 3 procedures can be performed in parallel.

    This can be as simple as running the following anonymous block to schedule 3 jobs for immediate execution:

    declare
      jobID number;
    begin
      DBMS_JOB.Submit( jobID, 'procA;', sysdate );
      DBMS_JOB.Submit( jobID, 'procB;', sysdate );
      DBMS_JOB.Submit( jobID, 'procC;', sysdate );
      commit;
    end;
    

    I have briefly heard the dbms_pipe package, which would be useful in this scenario?

    Only when the IPC (Inter Process Communication) is required only if the database pipes best fits this requirement.

  • Call of postChanges() front of a stored procedure

    I use 11.1.1.2 JDeveloper and ADF with BC. I have the following situation:

    I am updating a record via a modifiable display object. When I click on validate, I also need to call an existing stored procedure on my database to do some updates. The stored procedure queries the table on which my principal object based and did the updates with other tables/records based on this information. Is there a mistake in the stored procedure, then I want to roll back the changes in my app module, so I can't commit changes in module app until I know that the stored procedure was a success. But the stored procedure cannot see my changes from the object until they are committed (or changes).

    I am considering the following:
    (1) make changes to display the object
    (2) call postChanges() on transaction of my app module
    (3) call the procedure stored via the PreparedStatement class
    (4) commit (if errors, rollback)

    This is the preferred method for this situation?

    Thank you
    Brad

    Brad,

    As long as the stored procedure does not commit, there is no autonomous transaction and you can be sure that the postChanges() and commit() will be called in the same request, I think you should be OK.

    Nick

  • relative to the parameter in a stored procedure returns

    I'm doing a sp sp / sql with select and update, the idea is to return the value assigned in the select, but when I test the procedure about adding the parameter to the method PPerformance does not, in fact I am new to oracle, I searched some tutorials but I have not managed to solve the problem


    my source its:
    create or replace
    PROCEDURE PA_CONSECUTIVO (TipoConsecutivo in  VARCHAR2, AUXI OUT int )
    
    AS
    aux2 int;
    BEGIN
    
     SELECT consecutivo + 1 into aux2 FROM  tbl_consecutivo
        WHERE UPPER(ltrim(rtrim(Tipo_Consecutivo))) = UPPER(ltrim(rtrim(TipoConsecutivo)));
        
        UPDATE tbl_Consecutivo SET consecutivo = aux2 
    WHERE upper(ltrim(rtrim(Tipo_Consecutivo))) = upper(ltrim(rtrim(TipoConsecutivo))) ;
    
     AUXI:=aux2;
        
    
    
    END PA_CONSECUTIVO;
    the table og the request her:
    TIPO_CONSECUTIVO     VARCHAR2(20 BYTE)
    CONSECUTIVO     NUMBER(38,0)
    FECHAULTIMO     DATE
    I appreciate the help.

    Published by: 1008490 on 29-may-2013 07:49

    Your stored procedure has 2 settings while you provide 1. Use something like:

    SET SERVEROUTPUT ON
    DECLARE
        V_AUXI NUMBER;
    BEGIN
        PA_CONSECUTIVO('ENTRADA',V_AUXI);
        DBMS_OUTPUT.PUT_LINE('AUXI = ' || V_AUXI);
    END;
    /
    

    SY.

  • Tables created in a stored procedure cannot be used with dynamic SQL? The impact?

    There is a thread on the forum which explains how to create tables within a stored procedure (How to create a table in a stored procedure , however, it does create a table as such, but not how to use it (insert, select, update, etc.) the table in the stored procedure.) Looking around and in the light of the tests, it seems that you need to use dynamic SQL statements to execute ddl in a stored procedure in Oracle DB. In addition, it also seems that you cannot use dynamic SQL statements for reuse (insert, select, update, etc.) the table that was created in the stored procedure? Is this really the case?

    If this is the case, I am afraid that if tables cannot be 'created and used"in a stored procedure using the dynamic SQL, as is the case with most of the servers of DB dynamic SQL is not a part of the implementation plan and, therefore, is quite expensive (slow). This is the case with Oracle, and if yes what is the performance impact? (Apparently, with Informix, yield loss is about 3 - 4 times, MS SQL - 4 - 5 times and so on).

    In summary, tables created within a stored procedure cannot be 'used' with dynamic SQL, and if so, what is the impact of performance as such?

    Thank you and best regards,
    Amedeo.

    Published by: AGF on March 17, 2009 10:51

    AGF says:
    Hi, Frank.

    Thank you for your response. I understand that the dynamic SQL is required in this context.

    Unfortunately, I am yet to discover "that seeks to" using temporary tables inside stored procedures. I'm helping a migration from MySQL to Oracle DB, and this was one of the dilemmas encountered. I'll post what is the attempt, when more.

    In Oracle, we use [global temporary Tables | http://www.psoug.org/reference/OLD/gtt.html?PHPSESSID=67b3adaeaf970906c5e037b23ed380c2] aka TWG these tables need only be created once everything like a normal table, but they act differently when they are used. The data inserted in TWG will be visible at the session that inserted data, allowing you to use the table for their own temporary needs while not collide with them of all sessions. The data of the TWG will be automatically deleted (if not deleted programmatically) when a) a commit is issued or b) the session ends according to the parameter that is used during the creation of the TWG. There is no real need in Oracle to create tables dynamically in code.

    I noticed that many people say that the "Creation of the tables within a stored procedure" is not a good idea, but nobody seems necessarily explain why? Think you could elaborate a little bit? Would be appreciated.

    The main reason is that when you come to compile PL/SQL code on the database, all explicit references to tables in the code must correspond to an existing table, otherwise a djab error will occur. This is necessary so that Oracle can validate the columns that are referenced, the data types of those columns etc.. These compilation controls are an important element to ensure that the compiled code is as error free as possible (there is no accounting for the logic of programmers though ;)).

    If you start to create tables dynamically in your PL/SQL code, so any time you want to reference this table you must ensure that you write your SQL queries dynamically too. Once you start doing this, then Oracle will not be able to validate your SQL syntax, check the types of data or SQL logic. This makes your code more difficult to write and harder to debug, because inevitably it contains errors. It also means that for example if you want to write a simple query to get that one out in a variable value (which would take a single line of SQL with static tables), you end up writing a dynamic slider all for her. Very heavy and very messy. You also get the situation in which, if you create tables dynamically in the code, you are also likely to drop tables dynamically in code. If it is a fixed table name, then in an environment multi-user, you get in a mess well when different user sessions are trying to determine if the table exists already or is the last one to use so they can drop etc. What headache! If you create tables with table names, then variable Dynamics not only make you a lot end up creating (and falling) of objects on the database, which can cause an overload on the update of the data dictionary, but how can ensure you that you clean the tables, if your code has an exception any. Indeed, you'll find yourself with redundant tables lying around on your database, may contain sensitive data that should be removed.

    With the TWG, you have none of these issues.

    Also, what is the impact on the performance of the dynamic SQL statements in Oracle? I read some contrasting opinions, some indicating that it is not a lot of difference between static SQL and SQL dynamic in more recent versions of Oracle DB (Re: why dynamic sql is slower than static sql is this true?)

    When the query runs on the database, there will be no difference in performance because it is just a request for enforcement in the SQL engine. Performance problems may occur if your dynamic query is not binding variable in the query correctly (because this would cause difficult analysis of the query rather than sweet), and also the extra time, to dynamically write the query running.

    Another risk of dynamic query is SQL injection which may result in a security risk on the database.

    Good programming will have little need for the tables of dynamically created dynamically or SQL.

Maybe you are looking for