Link table error: ORA-01485: compile bind different length to execute

Hi all -

I'm running on a question where I receive the following error message when you try to use the binding table. I'm dynamically enumeration of a set of data and fill tables Oracle of the same name with all the data from the DataTable. I tried debugging with just a single datatable of 10 records with the double data type, however still receive the exception. For reference, the connection is already open before calling this method.

public void BulkLoadWithArrayBinding (System.Data.DataTable dt)
{
StringBuilder sb = new StringBuilder();
The list settings < OracleParameter > As new List < OracleParameter >(dt.) Columns.Count);

OracleCommand cmd = new OracleCommand();
cmd connection group conn.;

SB. Append ("INSERT INTO" + dt. TableName + "(' ');
foreach (DataColumn DC in dt. Columns)
{
SB. Append (dc. ColumnName.ToUpper ());
If (dc. Ordinal < dt. Columns.Count - 1).
SB. AppendLine(",");
}
SB. Append(") VALUES(");

foreach (DataColumn DC in dt. Columns)
{
string parameterName = dc. ColumnName.ToUpper ();

SB. Append (":" + parameterName);
If (DC. Ordinal < dt. Columns.Count - 1).
SB. AppendLine(",");

String [] sArray = new String [dt. Rows.Count];
Xavier of DateTime [] = new DateTime [dt. Rows.Count];
Decimal [] dbArray = new Decimal [dt. Rows.Count];

OracleParameter p = null;
If (dc. DataType.Name is "String")
{
for (int i = 0; i < dt.) Rows.Count; i ++)
{
[i] sArray is dt. Lines [i] [dc. Ordinal]. ToString();
}

p = new OracleParameter (parameterName,
OracleDbType.Varchar2, dt. Rows.Count, ParameterDirection.Input);
p.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p.Size = sArray.Length;
p.Value = sArray;
}
ElseIf (dc. DataType.Name is "DateTime")
{
for (int i = 0; i < dt.) Rows.Count; i ++)
{
Xavier [i] = Convert.ToDateTime (dt. Lines [i] [dc. Ordinal]);
}

p = new OracleParameter (parameterName,
OracleDbType.Date, dt. Rows.Count, ParameterDirection.Input);
p.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p.Size = dArray.Length;
p.Value = ASA;
}
on the other
If (dc. DataType.Name is 'Double')
{
for (int i = 0; i < dt.) Rows.Count; i ++)
{
dbArray [i] = Convert.ToDecimal (dt. Lines [i] [dc. Ordinal]);
}

/ * p = new OracleParameter (parameterName, OracleDbType.Decimal, dbArray.Length, ParameterDirection.Input); * /.
p = new OracleParameter();
p.ParameterName = parameterName;
p.OracleDbType = OracleDbType.Decimal;
p.Direction = ParameterDirection.Input;
p.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p.Size = dbArray.Length;
p.Value = dbArray;
}

cmd. Parameters.Add (p);
parameters. Add (p);
}

SB. AppendLine ("") ");"

cmd.CommandText = sb. ToString();
cmd.CommandType = CommandType.Text;
cmd ArrayBindCount group dt. Rows.Count;
BindByName. cmd = true;

cmd ExecuteNonQuery());
}

Hello

I don't actually run your code, but you should not be put in p.CollectionType = OracleCollectionType.PLSQLAssociativeArray; Associative arrays are differnet liaison of the table.

An associative array is the equivalent of a scalar array type that you would spend in a stored procedure to a single run.

Binding of the table is used to 'run this statement X times, here is the data for all X executions above all. "

Here is a small example, I hope this can help,
Greg

//create table onedouble(col1 number);
using System;
using System.Data;
using Oracle.DataAccess.Client;
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] doubs = new double[10];
            for (int i=0;i<10;i++)
                doubs[i] = Double.Parse(i.ToString()+"."+i.ToString());
            using (OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger"))
            {
                con.Open();
                using (OracleCommand cmd = new OracleCommand("", con))
                {
                    cmd.CommandText = "insert into onedouble values(:1)";
                    cmd.ArrayBindCount = 10;
                    cmd.Parameters.Add(new OracleParameter("",OracleDbType.Double));
                    cmd.Parameters[0].Value = doubs;
                    // this causes ora-1485
                    //cmd.Parameters[0].CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                    cmd.ExecuteNonQuery();
                }
            }
        }
    }
}

results
=======

SQL > select * from onedouble;

COL1
----------
0
1.1
2.2
3.3
4.4
5.5
6.6
7.7
8.8
9.9

Tags: Database

Similar Questions

  • Table binding error ORA-01485 when I try to get in an associative array

    Hello

    I test to pass in an array associative odp.net

    So I created a simple testpackage:
    CREATE TABLE jwetesttab (CLIENTNR NUMBER (10) NOT NULL);

    CREATE OR REPLACE PACKAGE IN THE JWETEST_PK
    TYPE t_CLIENTNRS IS TABLE OF NUMBER INDEX OF PLS_INTEGER;
    PROCEDURE TestArrayIn (p_CLIENTNRS IN t_CLIENTNRS, p_NbOfRowsInserted OUT NUMBER);
    END JWETEST_PK;
    /

    CREATE OR REPLACE PACKAGE BODY JWETEST_PK AS
    PROCEDURE TestArrayIn (p_CLIENTNRS IN t_CLIENTNRS, p_NbOfRowsInserted ON the NUMBER)
    IS
    BEGIN
    FORALL i IN p_CLIENTNRS.first... p_CLIENTNRS. Last
    INSERT INTO jwetesttab (CLIENTNR) VALUES (p_CLIENTNRS (i));
    p_NbOfRowsInserted: = SQL % ROWCOUNT;
    COMMIT;
    END TestArrayIn;
    end JWETEST_PK;
    /

    Then I did as simple testapp as follows:
    Protected Int As Integer = 0
    Dim arrNums() As Integer = {1, 2, 3}
    Dim cmd As New OracleCommand
    Dim cnn as new OracleConnection (s_conn)
    Try
    With cmd
    . ArrayBindCount = 3
    . Connection = cnn
    . CommandText = "JWETEST_PK. TestArrayIn ".
    . CommandType = CommandType.StoredProcedure

    Var p_Clientnrs As OracleParameter = New OracleParameter
    With p_Clientnrs
    . ParameterName = "p_CLIENTNRS."
    . DbType = DbType.Int32
    . CollectionType = OracleCollectionType.PLSQLAssociativeArray
    . Value = arrNums
    . Size = 3
    Ends with
    . Parameters.Add (p_Clientnrs)
    . Parameters.Add (New OracleParameter ("p_NbOfRowsInserted", OracleDbType.Int32, ParameterDirection.Output))
    CNN. Open()
    cmd ExecuteNonQuery()).
    Int = CInt (.) Parameters ("p_NbOfRowsInserted"). Value)
    Ends with

    Catch ex As Exception
    MsgBox (ex.) Message)
    Finally
    If (cnn IsNot Nothing) = False Then
    CNN. Close()
    CNN. Dispose()
    End If
    End Try

    When I run my testapp, the lines are inseterd in the database, but it gives me an error: link table error: ORA-01485

    Liaison of the table and the associative arrays are two different functions and tend to confuse because they both have the word Array in them.

    The table binding is for "run this procedure and statement number X times, all the data here is at the front. ''
    Associative array is to "perform this procedure once, here is the table I want to that you pass in.

    Start by removing ArrayBindCount = 3and see if that helps

    If you still have problems, see the example of associative array on your hard disk to %OH%\ODP.NET\samples\2.x\AssocArray

    It will be useful,
    Greg

  • Execute Immediate with DOF and TABLE() - error ORA-22905

    Hello

    I have a problem trying to use a user defined the Type of the Table in a statement Execute Immediate containing a CREATE TABLE statement.

    Is there no work around for this problem?

    The actual code for the SELECT * OF TABLE(:T) is dynamic and slow. That's why I try to avoid to create/fill the table in two steps (as does with MY_TABLE1). Also, in this case, I can't use SELECT * but must specify all the columns (amount variable and over 100 columns).

    CREATE TYPE MY_TABLE_TYPE AS TABLE OF VARCHAR2(30);
    /
    DECLARE
        MT MY_TABLE_TYPE;
    BEGIN
        SELECT * BULK COLLECT INTO MT FROM DUAL;
        -- Two steps
        EXECUTE IMMEDIATE 'CREATE TABLE MY_TABLE1 (A VARCHAR2(30))';
        EXECUTE IMMEDIATE 'INSERT INTO  MY_TABLE1    SELECT * FROM TABLE(:T)' USING MT; -- OK
        -- One step
        EXECUTE IMMEDIATE 'CREATE TABLE MY_TABLE2 AS SELECT * FROM TABLE(:T)' USING MT; -- ERROR ORA-22905   
    END;
    /
    

    byee

    Andrea

    In my view, the error message is incorrect or the less misleading. Bind variables cannot be used in DDL:

    SQL > declare
    2 number of v_var: = 99;
    3. start
    4 run immediately "' create the my_table2 in select table: double T" using v_var; "
    5 end;
    6.
    declare
    *
    ERROR on line 1:
    ORA-01027: bind variable not allowed for data definition operations
    ORA-06512: at line 4 level

    SQL >

    What you could do is use the package variable:

    SQL > CREATE OR REPLACE
    2 PACKAGE PKG1
    3 EAST
    4 MT MY_TABLE_TYPE;
    5 FUNCTION GET_MT
    6 RETURN MY_TABLE_TYPE;
    7 END;
    8.

    Package created.

    SQL > CREATE OR REPLACE
    PACKAGE 2 BODY PKG1
    3 EAST
    4 GET_MT FUNCTION
    5 RETURN MY_TABLE_TYPE
    6 EAST
    7. START
    8 RETURN MT;
    9 END;
    10 END;
    11.

    Package body created.

    SQL > DROP TABLE MY_TABLE1 PURGE
    2.

    Deleted table.

    SQL > DROP TABLE MY_TABLE2 PURGE
    2.
    DROP TABLE MY_TABLE2 PURGE
    *
    ERROR on line 1:
    ORA-00942: table or view does not exist

    SQL > START
    2. SELECT * BULK COLLECT INTO PKG1.MT FROM DUAL;
    3 - two steps
    4 RUN IMMEDIATELY "CREATE TABLE MY_TABLE1 (A VARCHAR2 (30))';"
    5 IMMEDIATELY EXECUTE "INSERT INTO MY_TABLE1 SELECT * FROM TABLE (PKG1." GET_MT)';
    6 - one step
    7 IMMEDIATE EXECUTION "CREATE TABLE MY_TABLE2 AS SELECT * FROM TABLE (PKG1." GET_MT)';
    8 END;
    9.

    PL/SQL procedure successfully completed.

    SQL > select * from my_table1;

    A
    ------------------------------
    X

    SQL > select * from my_table2;

    COLUMN_VALUE
    ------------------------------
    X

    SQL >

    SY.

  • APex 4.1 error ORA-01461: can bind to a value of type LONG only to insert them into a LONG

    Hello

    Faced with a strange question.

    I have a regular cursor, and in this loop of cursor, I have a select statement in some variables based on cursor settings.

    I was getting the "ORA-01461: can bind to a LONG value only for insert into a LONG column" error so I started the individual verification of each of the columns. Now, it works fine for some columns, but the moment I add this numeric field. He began to throw this error. Now, the source of the database where the selection is triggered is of type number, the variable in which I select is number.

    Infact, I have not any column defined anywhere.

    The strange thing is that the block is running perfectly fine in SQl developer. So, looks like a specific problem of the Apex.

    I'm in 4.1 / 11g

    Any ideas?

    Thank you
    Sun

    I'm NOT aware of documentation showing HOW the APEX team have built APEX (database design wise), but this met enough to collect that they use with a near limit of the VARCHAR2 VARCHAR2 columns size limit...

    I'm NOT aware of a limit on the size of the service procedure in the database.

    The code that you add to a form or report is stored in tables oracle APEX uses its called metadata (data about data)... So it would make sense that there are limits to how much can be stored in the form elements when developing... Try this, on a form region, go to the comment section and try to add a ton of comments or lines of text and save... You will hit a point where long error will happen (I'm now hitting, trying to replace sql selects for reports in an application, old registration code in case of questions, can not post in the comments field..)

    I believe in a dynamic action, you can have the run of the pl/sql code, so if you have a procedure called RunMyCode you could do that

      begin
    
       RunMyCode(:P1_AL,:P1_B);
    
      end;
    

    Where you large PL/SQL block could be stored...

    Thank you

    Tony Miller
    Dallas, TX

  • Flash back, table: error - ORA-08189

    Hi friends,

    I have a problem while doing the flashback table.

    SQL > flashback table emp to the SNA 688268.
    Flashback table emp to SNA 688268
    *
    ERROR on line 1:
    ORA-08189: cannot flashback the table because the movement of the line is not enabled.


    What should I do...?

    First check if the table is in the system tablespace or not... If it is carrier movement line would not help...

    Then, if it isn't then go

    change the table emp enable row movement

    Flashback table emp to SNA 688268;

  • Error ORA-12899, even you the length of the data is correct.

    Dear all,

    I'm getting ORA-12899 problem: value too large for column 'TEST '. "'"' STUDENT'."" NAME"(size: 94, maximum: 79).
    Valer'evne you the length of the column 'Name' is less than 79.

    Infact I am getting the value of 'Name' of the other database, processing in Java and you try to insert the value in Oracle database with the help of hibernation, the length of the 'name' is located only 60 I checked in Java, before inserting this value.

    Even after having inserted the length is only 60 too, I see Oracle. So why Oracle throws this error at the time of the insertion of the value of the "name"?

    Any body have an idea on the question, please help.

    Thanking you all.

    AL32UTF8 is a multibyte character set: each character can take up to 4 bytes. So, you have to modify the table definition for this with something like (assuming that the maximum number of bytes would be 320):

    alter table student modify (name varchar2(320));
    
  • ORA-01461: can bind to a value of type LONG only to insert them into a column error

    Oracle 11g R1 RHEL 5 64-bit (Apex 3.1)

    Hi all

    I will have a hard time with this error:

    ORA-01461: can bind to a LONG value only for insert into a LONG column
    ORA-06512: at "FPRCHR. PKG_TRIGGER_EMAIL', line 39
    ORA-06512: at "ISWRNEW. PKG_NOTIFICATION', line 310
    ORA-06512: at "ISWRNEW. PKG_NOTIFICATION', line 1745
    ORA-06512: at line 1

    The FPRCHR. PKG_TRIGGER_EMAIL is as follows:

    ...
    INSERT INTO fprchr.trigger_email
    (trigger_email_rid,
    email_to,
    email_from,
    email_body,
    objet_message_electronique,
    email_cc,
    email_bcc,
    mime_type,
    email_priority
    )
    VALUES (l_job,
    p_recipients,
    p_sender,
    p_message,
    p_subject,
    p_cc,
    p_bcc,
    p_mime_type,
    p_priority
    );
    run immediately 'alter session set events 'name context 10046 trace off'. "
    Send END;
    ...


    It seems that the characters have exceeded the capable of handling VARCHAR2 limit? What other data type can change the table of fprchr.trigger_email to? Is that all that is needed?

    Thank you.

    It seems that the characters have exceeded the capable of handling VARCHAR2 limit? What other data type can change the table of fprchr.trigger_email to? Is that all that is needed?

    Have you tried with the clob data type?

    Kind regards.

    LOULOU

  • ORA-01461: can bind to a LONG value only for insert into a LONG column of dynamic Action

    I try to apply the condition to display items in a table with the following error code.its dynamic action when him save the day.

    event: click on

    Selection type: button

    name of the button: P23_ADD_MORE_ROW

    condition: no strings attached

    //P23_NAME_BY_CAT,P23_HOW_MANY as LOV  in apex form
    var l_no_rows;
    l_no_rows = apex.item("P23_HOW_MANY").getValue();
    for (var i=0; i<l_no_rows; i++){
      apex.widget.tabular.addRow();
    
    if  ($v("P23_NAME_BY_CAT")==1) {
    $("#WORK_QTY").show();
    $('td[headers=WORK_QTY]').show();
    $("#WORK_LOCTION").hide();
    $('td[headers=WORK_LOCTION]').hide();
    $("#MY_LOCTION").hide();
    $('td[headers=MY_LOCTION]').hide();
    //with morethan 25+ entry
    }
    else if ($v("P23_NAME_BY_CAT")==2) {
    $("#WORK_QTY").hide();
    $('td[headers=WORK_QTY]').hide();
    
    $("#WORK_LOCTION").show();
    $('td[headers=WORK_LOCTION]').show();
    
    $("#MY_LOCTION").hide();
    $('td[headers=MY_LOCTION]').hide();
    //with morethan 25+ entry
    }
    else if ($v("P23_NAME_BY_CAT")==2) {
    $("#WORK_QTY").hide();
    $('td[headers=WORK_QTY]').hide();
    $("#WORK_LOCTION").hide();
    $('td[headers=WORK_LOCTION]').hide();
    
    $("#MY_LOCTION").show();
    $('td[headers=MY_LOCTION]').show();
    //with morethan 25+ entry
    }
    else {
    alert("no  count");
    }
    };
    
    

    dynamic action above can ignite if you level column, it means when I choose LOV value so that specified columns will show only rest in a column will be hidden. up to 10 input works fine.

    Hi Ramani_apex,

    Is the action of javascript executed in the dynamic action of the code you posted above or more code?

    You seem to have exceeded a 4000 or 32 K bytes on a column of metadata for dynamic action when you set the dynamic action.

    function f_mybuttonAction () {
    //P23_NAME_BY_CAT,P23_HOW_MANY as LOV  in apex form
    var l_no_rows;
    l_no_rows = apex.item("P23_HOW_MANY").getValue();
    for (var i=0; i
    
    • Call the action javascript function run the dynamic action javascript code:
    //mybutton action
    f_mybuttonAction();
    

    Reference:

    I hope this helps!

    Kind regards

    Kiran

  • A weird exception in 12 c (ORA-01461: can bind to a LONG value only for insert into a LONG column)

    I have a Windows application that accesses a database of 12 c Oracle via ODBC (driver version is 12.01.00.01).

    I have a table with a column of key named REGION_ID (NVARCHAR2 (9)) and a dozen other columns, of which three are named region1 and region.2 elle3, all of type NVARCHAR2 (40).

    When I try to insert a string in the scope of the region1 is longer than 9 characters (length of REGION_ID), I get an error ORA-01461 (' can bind to a LONG value only for insert into a LONG column). If I set the length of REGION_ID be NVARCHAR2 (15), so I can add channels to the region1 in length up to 15 field until I get ORA-01461 exception again. Curiously, if I change the name of column region1 to REGIONONE, I don't get any errors, and everything works fine. It's almost as if the column name region1 is being confused with REGION_ID backstage.

    Any ideas? I am using SQLBindParameter to bind the columns, and all calls are successful. I get the exception when I run the insert statement. This same code worked for previous versions of Oracle (9i, 10g and 11g). And if I use a driver of client 11g against the 12 c server, I do not receive the exception.

    Thank you!

    It is a component of ODBC driver bug in 12 c and it is fixed. You can download and install the fix for bug 18232462 or the last window for 12 c patch cumulative/bundle.

    Thank you

    Spengler

  • Container for several tables of different length

    Hey,.

    I'm doing an algorithm for labelling component connected in LabVIEW.  I came across the problem that I need some sort of data structure that I can't create.  I hope that I've missed something and someone can report this to me.

    What I'm looking for is a container that can contain lists of lists of 2 values.  Basically, I have several labels.  Each label will have a list of coordinates in.  The closest I came to this creation is a 2D cluster table.  Then, the cluster contains the coordinates X and Y.  The problem is that each list is not the same size, and for a table of 2D in labVIEW, all rows/columns must have the same length.

    In summary, I'm looking for a way to store multiple lists of coordinates.  The lists will all be of different lengths, and I don't know how many lists there will be.

    Is it possible to do this?

    If not, does anyone know an easier way than that looking for a 2D for concentrations table all?  At the back of my mind, I want to say that there may be a Vision VI of OR who can do this, but I can't find a.

    Thanks for your help,

    Dominic Walker

    A way to manage several arrays of different lengths (but all the same type of data) is to put the berries in a queue.  Each element in the queue must be a table, but they can be of different lengths.  To get to all the tables, you use the preview queue feature.  It returns an array of clusters with each table queue in a separate group (if I remember correctly).   Perhaps an array of clusters of berries would work for you.  I just checked that this allows arrays of different lengths.  You can also place a control of the chain with the label of the cluster if it is appropriate.

    Lynn

  • ERROR "ora-01422" during insertion in the table?

    Hello

    I have created the dynamic action of PL/SQL to insert data but founded by page_item

    
    
     declare 
    x_found_pages number;
    x_auth_id number;
    x_user_id number;
     begin
     x_user_id := :P41_USR_ID; -- this is my page_item _____ successful run When change it to number value .. !
    
    
    
    
          select count(V_APP_PAGES.PAGE_ID) into x_found_pages
          from V_AUTH_DTL V_AUTH_DTL,V_APP_PAGES V_APP_PAGES 
          where V_AUTH_DTL.PAGE_ID!=V_APP_PAGES.PAGE_ID
          and  V_AUTH_DTL.USR_ID = x_user_id;
       
          select T_AUTH.ID into x_auth_id 
          from T_AUTH_DTL T_AUTH_DTL,T_AUTH T_AUTH 
          where T_AUTH_DTL.AUTH_ID=T_AUTH.ID
          and T_AUTH.USR_ID = x_user_id;
    
    
    -- Checking...? 
      if x_found_pages > 0 then
    
            for i in (select V_APP_PAGES.PAGE_ID
               from V_AUTH_DTL V_AUTH_DTL,V_APP_PAGES V_APP_PAGES 
               where V_AUTH_DTL.PAGE_ID!=V_APP_PAGES.PAGE_ID
               and  V_AUTH_DTL.USR_ID = x_user_id)
        
      loop
      insert into T_AUTH_DTL (AUTH_ID,PAGE_ID) values (x_auth_id,i.PAGE_ID);
      end loop;
    
        end if;
    
     end;
    
    
    
    

    Please help me to avoid the ERROR "ora-01422" when running code in the dynamic action...

    Thank you...

    AMR Abdeen wrote:

    I have created the dynamic action of PL/SQL to insert data but founded by page_item

    1. declare
    2. number of x_found_pages;
    3. number of x_auth_id;
    4. number of x_user_id;
    5. Start
    6. x_user_id: =: P41_USR_ID; -It is my page_item _ successfully performed when change to value the number...!
    7. SELECT count (V_APP_PAGES. Page_id) in x_found_pages
    8. of V_AUTH_DTL V_AUTH_DTL, V_APP_PAGES V_APP_PAGES
    9. where V_AUTH_DTL. PAGE_ID! = V_APP_PAGES. PAGE_ID
    10. and V_AUTH_DTL. USR_ID = x_user_id;
    11. Select T_AUTH.ID from x_auth_id
    12. of T_AUTH_DTL T_AUTH_DTL, T_AUTH T_AUTH
    13. where T_AUTH_DTL. AUTH_ID = T_AUTH.ID
    14. and T_AUTH. USR_ID = x_user_id;
    15. -Checking...?
    16. If x_found_pages > 0 then
    17. I'm in (select V_APP_PAGES. PAGE_ID
    18. of V_AUTH_DTL V_AUTH_DTL, V_APP_PAGES V_APP_PAGES
    19. where V_AUTH_DTL. PAGE_ID! = V_APP_PAGES. PAGE_ID
    20. and V_AUTH_DTL. USR_ID = x_user_id)
    21. loop
    22. insert into T_AUTH_DTL (AUTH_ID, PAGE_ID) values (x_auth_id, i.PAGE_ID);
    23. end loop;
    24. end if;
    25. end;

    Please help me to avoid the ERROR "ora-01422" when running code in the dynamic action...

    The error is explicit:

    ORA-01422: exact fetch returns more than number of lines

    Cause: The exact extraction specified number is less than the rows returned.

    Action: Rewrite the query or change the number of rows requested

    This would imply the query in line 16 as County dissociated in the previous one will always return only one row.

    Run

    select T_AUTH.ID into x_auth_id
    from T_AUTH_DTL T_AUTH_DTL,T_AUTH T_AUTH
    where T_AUTH_DTL.AUTH_ID=T_AUTH.ID
    and T_AUTH.USR_ID = :x_user_id
    

    in the workshop of SQL by using the P41_USR_ID value in the variable link to find out how many rows it returns.

    It is likely that the entire block can be replaced by a single INSERT statement. If you provide instructions CREATE TABLE, INSERT statements to create sample data and a clear definition of the requirements that we try to do.

    What is the point of the inclusion of tables aliases that are exactly the same as the names of the tables?

  • DBMS_SQL in another schema of table-error of request * ORA-00942

    Oracle experts,

    I think that I have problems with the help of DBMS_SQL in which the function was created in a schema and the query table was created in a different schema.

    We have 2 schemas: S1, S2
    We have 2 tables:
    T1 in the S1 schema
    T2 in the schema S2

    We have a function F1 created by DBA in the S1 schema that uses the dbms_sql as:

    CREATE or REPLACE FUNCTION S1. F1 (v1 in VARCHAR2) return NUMBER IS
    Cursor1 INTEGER;
    BEGIN
    Cursor1: = dbms_sql.open_cursor;
    DBMS_SQL. Parse (cursor1, v1, dbms_sql. NATIVE);
    DBMS_SQL.close_cursor (Cursor1);
    Return (0);
    EXCEPTION
    while others then
    DBMS_SQL.close_cursor (Cursor1);
    return (1);
    END;
    /

    I use jdeveloper 11G. We have a DB Oracle 11 g.
    We have a java program that uses jdbc to talk to our Oracle database.


    Basically, in my program java, I call F1 function to check if the query is valid.
    If this is the case, it returns 0. Otherwise, returns the value 1:

    oracle.jdbc.OracleCallableStatement cstmt = connection.prepareCall (oracle.jdbc.OracleCallableStatement) ("start?: = S1.") F1 (?); end; ») ;
    cstmt.registerOutParameter (1, java.sql.Types.INTEGER);
    cstmt.setString (2, "Select * from S2.") T2');
    cstmt. Execute ();

    Since the table that I run the query T2, created in different pattern of F1 has been created, I got the error:

    * ORA-00942: table or view does not exist

    So my questions are the following:
    -J' use DB Oracle 11g, if I run the query on a table that was created in a different pattern than the function (which uses dbms_sql) appeared, I would get the error ORA-00942?
    -If I run the query on the T1 table in the same schema as the function F1, if I have the same problem (the reason why I ask is that I can't create any table in the S1 schema because the DBA can do; I'm not a DBA)

    -This isn't a problem, but a feature of security due to SQL injection?
    -How to solve this problem, other than creating the table in the same schema as the function that uses DBMS_SQL?

    Kind regards
    Binh

    Copyright (default) stored objects managed by virtue field of safety of the owner of the and ignore privileges based on roles. So whatever that the user logged as function of S1. F1 always runs as a user S1 and ignores the S1 user roles. That's why exeuting instruction in S1. F1:

    Select * from S2. T2

    requires that the S1 user have the right to SELECT on S2. T2 granted to S1 directly, without going through the role.

    SY.

  • Using Merge in oracle 11g this error SQL Error: ORA-30926: failed to get a stable set of rows in the source tables

    whenever I run this code I get this error

    SQL Error: ORA-30926: failed to get a stable set of rows in the source tables

    30926 00000 - "impossible to get a stable set of rows in the source tables.

    * Cause: A stable set of rows could not be achieved due to the large dml

    activity or one not deterministic where clause.

    * Action: Remove any non deterministic of the clauses and reissue of the dml.

    Don't know wht goes wrong!


    SQL:

    MERGE IN VENDORS_ACTIVE_DATE s

    USING (nvl (d.VENDOR, s.VENDOR) selection of the SELLER,

    NVL (d.COMPANY_CODE, s.COMPANY_CODE) COMPANY_CODE.

    (case when ((d.VENDOR = s.VENDOR) and (d.COMPANY_CODE = s.COMPANY_CODE)))

    )

    then "MATCH".

    When d.COMPANY_CODE is null

    then 'DELETE '.

    When s.COMPANY_CODE is null

    then "INSERT."

    else 'UPDATE '.

    chck end)

    from (select * from VENDORS_ACTIVE_DATE where COMPANY_CODE = 2) s

    full outer join (select * provider where COMPANY_CODE = 2) d

    on (d.COMPANY_CODE = s.COMPANY_CODE AND s.COMPANY_CODE = 2)

    ) d

    WE (d.COMPANY_CODE = s.COMPANY_CODE AND d.chck in ('UPDATE', 'GAME', 'DELETE'))

    WHEN MATCHED THEN

    UPDATE SET s.VENDOR = d.VENDOR

    WHERE d.chck in ('UPDATE', 'DELETE')

    DELETE WHERE d.chck = 'DELETE '.

    WHEN NOT MATCHED THEN

    INSERT (SELLER, COMPANY_CODE)

    VALUES (d.VENDOR, d.COMPANY_CODE)

    Work request: (deleted the duplicate data in tables (source and target))

    MERGE IN VENDORS_ACTIVE_DATE s

    USING (nvl (d.VENDOR, s.VENDOR) selection of the SELLER,

    NVL (d.ACTIVEDATE, s.ACTIVEDATE) ACTIVEDATE.

    NVL (d.COMPANY_CODE, s.COMPANY_CODE) COMPANY_CODE.

    (case when ((d.VENDOR = s.VENDOR))

    - AND D.ACTIVEDATE = S.ACTIVEDATE

    and NVL (d.ACTIVEDATE, trunc (sysdate)) = NVL (s.ACTIVEDATE, trunc (sysdate))

    and (d.COMPANY_CODE = s.COMPANY_CODE)

    )

    then "MATCH".

    When d.COMPANY_CODE is null

    then 'DELETE '.

    When s.COMPANY_CODE is null

    then "INSERT."

    else 'UPDATE '.

    chck end)

    from (select * from suppliers where COMPANY_CODE = 2) d

    full outer join (select * from vendors_active_date where COMPANY_CODE = 2) s

    on (d.COMPANY_CODE = s.COMPANY_CODE and s.vendor = d.vendor)

    ) d

    WE (d.COMPANY_CODE = s.COMPANY_CODE AND d.VENDOR = s.VENDOR AND d.chck in ('UPDATE', 'GAME', 'DELETE'))

    WHEN MATCHED THEN

    S.ACTIVEDATE = UPDATE SET d.ACTIVEDATE

    WHERE d.chck in ('UPDATE', 'DELETE')

    DELETE WHERE d.chck = 'DELETE '.

    WHEN NOT MATCHED THEN

    INSERT (VENDOR, ACTIVEDATE, COMPANY_CODE)

    VALUES (d.VENDOR, d.ACTIVEDATE, d.COMPANY_CODE)

  • DB Link error: ORA-12154: TNS: could not resolve the connect identifier specified

    Hi all

    We need to make an entry in the tnsname.ora file in a local database to connect to the remote database using db link?

    Here is my code: -.

    create the database link * _DBLINK

    connect to the USER IDENTIFIED BY 'user '.

    using '(DESCRIPTION =)

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP) (HOST = *. *. *. *)(PORT = 1521))

    )

    (CONNECT_DATA = (SERVICE_NAME = REM)

    )';

    After the creation of the DB connection when I'm trying to run select 1 of dual@***_DBLINK

    He throws me an error ORA-12154: TNS: could not resolve the connect identifier specified

    Am I expected to do an entry in the file tnsname.ora for "REM". I don't remember making any changes in the file tnsname.ora for the creation and access of the remote database via dblink.

    Help, please.

    Thanks in advance.

    2925917 wrote:

    Hi all

    We need to make an entry in the tnsname.ora file in a local database to connect to the remote database using db link?

    Here is my code: -.

    create the database link * _DBLINK

    connect to the USER IDENTIFIED BY 'user '.

    using '(DESCRIPTION =)

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP) (HOST = *. *. *. *)(PORT = 1521))

    )

    (CONNECT_DATA = (SERVICE_NAME = REM)

    )';

    After the creation of the DB connection when I'm trying to run select 1 of dual@***_DBLINK

    He throws me an error ORA-12154: TNS: could not resolve the connect identifier specified

    Am I expected to do an entry in the file tnsname.ora for "REM". I don't remember making any changes in the file tnsname.ora for the creation and access of the remote database via dblink.

    Help, please.

    Thanks in advance.

    I've learned to trust in your obfuscation you covered something important, or you are showing some apples and oranges.  Error to declare you come from not being able to find referenced in tnsnames.ora entry, but the way you say you created your link db, you hardcoded the entire connection, so he never users tnsnames.ora.

    I would change the definition of db_link

    create the database link * _DBLINK

    connect to the USER IDENTIFIED BY 'user '.

    using "REM."

    Then create an entry in your tnsnames.ora

    REM =

    (DESCRIPTION =

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP) (HOST = *. *. *. *)(PORT = 1521))

    )

    (CONNECT_DATA = (SERVICE_NAME = REM)

    )

    )

    Also, use server name instead of the HOST = IP address

    The closer looks that you can miss brackets final closing on your original definition.

  • Changing table - SQL error: ORA-04091: table XYZ is changing, function of triggering/can not see

    Hi all

    I am a newbie to Oracle and I am faced with the above error. Please see the below code snippets. Can someone please tell what I am doing wrong? Thank you in advance.

    Thank you

    CREATE TABLE ABC

    (

    ID VARCHAR2 ENABLE NUMBER NOT NULL,

    FIELD1 ACTIVATE THE NUMBER NOT NULL,

    FIELD2 ACTIVATE THE VARCHAR2 (8 BYTE) NOT NULL,

    CONSTRAINT JOB_PK PRIMARY KEY (ID)

    )

    ;

    CREATE TABLE XYZ

    (

    ACTIVATE THE NUMBER 4 R_ID NOT NULL,.

    ID VARCHAR2 ENABLE NUMBER NOT NULL,

    Column1 NUMBER (2.0) default 0.00,.

    Column2 NUMBER (2.0) default 0.00,.

    COLUMN3 NUMBER (2.0).

    NUMBER (2.0) TOTAL 0.00 default.

    CONSTRAINT TRIP_PAYMENT_PK PRIMARY KEY (ID)

    )

    ;

    create or replace trigger trigger1

    After Insert on XYZ

    for each line

    Declare

    number of newTotal;

    Start

    newTOTAL: =: new. Column1 +: new. Column2 +: new. COLUMN3;

    setting a day of XYZ together Total = newTotal;

    end;

    Insert into ABC (1, 45, ' Demo');

    insertion in XYZ (1, 1, 12.50, 10.20 33,50, ");

    Error report:

    SQL error: ORA-04091: table XYZ is changing, function of triggering/can not see

    Try one before line

    create or replace trigger trigger1

    before inserting on XYZ

    for each line

    Start
    : new. TOTAL: =: new. Column1 +: new. Column2 +: new. COLUMN3;
    end;

Maybe you are looking for

  • Satellite A30 PSA30E - battery won't charge

    Hello I have a Toshiba Satellite A30 laptop ((n° de pièce = PSA30E-00E5-FR) and recently when plugged in, the battery is not, in fact he tell Chargers.) When the laptop is turned off, if you plug the battery icon orange lights and charges of battery,

  • Pavilion g7: admin access code or the power on the code

    On the computer to start goes to administrate or power on the code. Pushed enter 3 times got a key code 86345697 system off. Help!

  • banner of AAA authentication

    I have configured the banner authentication aaa and aaa fail message on a router running 12.1 (15) - authentication is done by ACS 3.0.2 which works very well. Problem - the banner of authentication does not appear (nothing is outside of "username:"-

  • Problems with Live Mail

    Hello I use windows 7 pro and live mail. I get my emails on my cell phone from my ISP. How to live mail faster work and how can I solve the problem of typing jumpy? Ujolujo

  • voglio essere cancellato da questa cosa

    Per favore mi account cancellate da questa cosa? vogli no averci nulla a che fare