ORA-01461 error

Hi, all
I am loading data in csv format into the Oracle 9i table. I can proceed with one a few lines, but end up with "ORA-01461 can bind a LONG value only for insert into a LONG column" error message. When I uncomment the setSQL call in earch loop, I got my job done with no complain. I wonder is there something wrong with my source code, or repeatedly bind and execute on a prepared statement are just disallowed.
The csv data is something like:
4409020,xxxxxx,6578B,,
9901400,xxxxx,11CBM,,
4447130,xxxx,6578H,,
And the C++ source:
PFile file("data.csv");
int colCount = 5;
int colTypes[] = {
     occi::OCCI_SQLT_CHR,
     occi::OCCI_SQLT_CHR,
     occi::OCCI_SQLT_CHR,
     occi::OCCI_SQLT_CHR,
     occi::OCCI_SQLT_NUM
int count = 0;
PString line;
PStringArray fields;
// prepare
stmt->setSQL("INSERT INTO m_pckk_hatyu VALUES (:1,:2,:3,:4,:5)");
while (file.ReadLine(line)) {
     //stmt->setSQL((const char *)sql);
     fields = line.Tokenise(",", TRUE);
     csvColCount = fields.GetSize();
     if (colCount != csvColCount) {
          cout << "Skip line " << (count+1) << ": " << line << endl;
          continue;
     // bind
     for (int j=0; j<colCount; j++) {
          if (colTypes[j] == occi::OCCI_SQLT_NUM) {                         // number
               stmt->setNumber(j+1, occi::Number(fields[j].AsReal()));
          } else if (colTypes[j] == occi::OCCI_SQLT_CHR) {               // varchar2
               stmt->setString(j+1, (const char *)fields[j]);
     // execute
     count += stmt->executeUpdate();

When you are dealing with long varchars, try using the stmt->setMaxParamSize(index, maxSize) API. i beleive oracle has some predefined optimized sizes for the bind variables. Here the index is the index of the bind variable and the maxSize is the size of the varchar.

Similar Messages

  • ORA-01461 error occurs

    Hi All.
    I'm using WLS6.1 on Soralis8.
    I try to use jdbc to store persistance
    sessions,but An ORA-01461 error occurs
    while the server is trying to write the
    session data in the JDBC managed
    persistence when using the Oracle thin
    Driver.
    How should I fix the problem?

    You should open a support case and request patch CR083912_610sp1.jar if you are
    seeing the exception below
    ORA-01461 error occurs while the server try to write the session data in the JDBC
    managed persistence (using Oracle thin Dricer).
    Configuration:
    WLS 6.1 SP1
    Oracle Server: 8.1.7.3
    Oracle thin driver and JDK come with WLS
    Error : This error comes to the server command line window when I first hit
    the jsp page.
    Error Details :
    java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into
    a LONG column
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)

  • ORA-01461 Error when mapping table with multiple varchar2(4000) fields

    (Note: I think this was an earlier problem, supposed fixed in 11.0, but we are experiencing in 11.7)
    If I map an Oracle 9i table with multiple varchar2(4000) columns, targeting another Oracle 9i database, I get the ORA-01461 error (Can't bind a LONG value only for insert into a LONG).
    I have tried changing the target columns to varchar2(1000), as suggested as a workaround in earlier versions, all to no avail.
    I can have just one varchar2(4000) map correctly and execute flawlessly - the problem occurs when I add a second one.
    I have tried making the target column a LONG, but that does not solve the problem.
    Then, I made the target database SQL Server, and it had no problem at all, so the issue seems to be Oracle-related.

    Hi Jon,
    Thanks for the feedback. I'm unable to reproduce the problem you describe at the moment - if I try to migrate a TEXT(5), OMWB creates a VARCHAR(5) and the data migrates correctly!! However, I note from you description that even though the problematic source column datatype is TEXT(5), you mention that there are actually 20 lines of text in this field (and not 5 variable length characters as the definition might suggest).
    Having read through some of the MySQL reference guide I note that, in certain circumstances, MySQL actually changes the column datatype specified either at table creation time or when interfacing with other databases ( ref 14.2.5.1 Silent Column Specification Changes and 12.7 Using Column Types from Other Database Engines in the MySQL reference guide). Since your TEXT(5) actually contains 20 lines of text, MySQL (database or JDBC driver .... or both) may be trying to automatically map the specified datatype of the column to a datatype more appropriate to storing 20 lines of text.... that is, to a LONG value in this case. Then, when Oracle is presented with this LONG value to store in a VARCHAR(5) field, it throws the ORA-01461 error. I need to investigate this further, but this may be the case - its the first time I've see this problem encountered.
    To workaround this, you could change the datatype of the column to a LONG from within the Oracle Model before migrating. Any application code that accesses this column and expects a TEXT(5) value may need to be adjusted to cope with a LONG value. Is this a viable workaround for you?
    I will investigate further and notiofy you of any details I uncover. We will need to track this issue for possible inclusion in future development plans.
    I hope this helps,
    Regards,
    Tom.

  • ORA-01461 error inserting over DB Link

    We receive an ORA-01461 error (can bind a LONG value only for insert into a LONG column) when using HTMLDB to insert into a remote table over a database link. The remote table has two VARCHAR2 and one NUMBER columns - it does not contain a LONG column. Inserting via SQL*Plus is OK.
    Any ideas anyone?
    Barry

    Anyone found a solution to this. I'm getting the same error. HTMLDB 1.6
    I have TableA and TableB in remote db1. TableA=Master, TableB=Detail. Both tables have single column PK generated by a trigger.
    In db2 I created a schema with viewA on TableA@db1 and viewB etc.
    HTMLDB app accesses views.
    I've tried to create a tabular form page to insert update delete into viewB but can only delete. Insert & update produces error:
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-01461: can bind a LONG value only for insert into a LONG column ORA-02063: preceding line from ORIXREPORTS.ORIXNZ.CO.NZ, update "IT_HTMLDB"."SCHEDULED_REPORT_PARAMETERS" set "SCHEDULED_REPORT_PARAMETER_ID" = :b1, "SCHEDULED_REPORT_ID" = :b2, "NAME" = :b3, "VALUE" = :b4, "VALUE_TYPE" = :b5 where "SCHEDULED_REPORT_PARAMETER_ID" = :p_pk_col
    Have also tried a Master Detail page with similar problems.
    I have only managed to get this to work by using the "Form on a Table with Report, 2 Pages" page creation option and then specifiying that Detail is editied in separate page. However this means deletes & updates are slow for the user as cannot do multi updates and deletes etc.
    Any help appreciated.
    Cheers
    Ian

  • ORA-01461 error when migrating MySQL -- Oracle table data

    All,
    I'm migrating MySQL 4.x to Oracle10g. Everything went smoothly except for one table was unable to migrate data, giving me the following error:
    Unable to migrate data from source table mysql.mytable to destination table root.MYTABLE :
    ORA-01461: can bind a LONG value only for insert into a LONG columnThe offending source column in MySQL is defined as TEXT. In OMWB it is TEXT (5). The Oracle model originally defined it as VARCHAR2(1), but I resized it to VARCHAR2(4000) since it contains about 20 lines of text.
    Neither the mysql or the oracle data models have a LONG column anywhere. Any idea's what might be causing this error?
    Thanks.

    Hi Jon,
    Thanks for the feedback. I'm unable to reproduce the problem you describe at the moment - if I try to migrate a TEXT(5), OMWB creates a VARCHAR(5) and the data migrates correctly!! However, I note from you description that even though the problematic source column datatype is TEXT(5), you mention that there are actually 20 lines of text in this field (and not 5 variable length characters as the definition might suggest).
    Having read through some of the MySQL reference guide I note that, in certain circumstances, MySQL actually changes the column datatype specified either at table creation time or when interfacing with other databases ( ref 14.2.5.1 Silent Column Specification Changes and 12.7 Using Column Types from Other Database Engines in the MySQL reference guide). Since your TEXT(5) actually contains 20 lines of text, MySQL (database or JDBC driver .... or both) may be trying to automatically map the specified datatype of the column to a datatype more appropriate to storing 20 lines of text.... that is, to a LONG value in this case. Then, when Oracle is presented with this LONG value to store in a VARCHAR(5) field, it throws the ORA-01461 error. I need to investigate this further, but this may be the case - its the first time I've see this problem encountered.
    To workaround this, you could change the datatype of the column to a LONG from within the Oracle Model before migrating. Any application code that accesses this column and expects a TEXT(5) value may need to be adjusted to cope with a LONG value. Is this a viable workaround for you?
    I will investigate further and notiofy you of any details I uncover. We will need to track this issue for possible inclusion in future development plans.
    I hope this helps,
    Regards,
    Tom.

  • ORA-01461 error using jdbc 10.2.0.1.0

    I am using the oracle jdbc 10.2.0.1.0 ( the latest version) and oracle 10g (10.1.0.4.0) database. Sometimes, the error "ORA-01461: can bind a LONG value only for insert into a LONG column' if I use a java program to insert record to a table containing a 'long raw' field. Previously, the same java program work well with oracle 9i.
    Interestingly, the 'ORA-01461' only SOMETIMES happen. If the problem appears, I need to rename the table and create a new one and then the data can be inserted.

    After 3 days of deep analysis on my project, now I have a clear idea of the problem.
    As you can find on web, newer versions of Oracle drivers for Java have the possibility to set property :
    oracle.jdbc.RetainV9LongBindBehavior=true
    it's considered the fix for this bug, and effectively it seems to work.
    But also with this setting, drivers have one more bug!+
    The problem appears in these conditions:
    - Application tries to save a string into a LONG column database
    - String length is more than 4000 bytes
    - String has less than 4000 characters (it's possible in case of international characters, which takes more than 1 byte)
    With these conditions, we have again error ORA-01461: can bind a LONG value only for insert into a LONG column.
    It seems that drivers evaluate string length before saving it, and consider it as LONG only for 4000+ characters. The bug is just on this check, that must consider length in bytes, according to database character encoding, and not simply for character length.
    As workaround, on my application we added a logic that appends spaces (" ") until total characters are at least 4001. In this way, string is considered correctly as LONG and storage works correctly.
    The check is something similar to this:
    if(value.getBytes("UTF-8").length > 4000 && value.length() < 4000)
    for(int x = value.length(); x<=4000; x++)
    value += " "; // always use StringBuffer for appending
    This workaround works, but it's clear that it can be not acceptable in many cases, for application funcionalities. In my specific bug, it has been very useful.
    My customer opened a ticket to Oracle, asking for solution of this bug. I will wait for Oracle answer.
    Finally, we have to say that Oracle warned to not use anymore LONG datatype: it's deprecated since v8.0.
    Bye guys ;-)
    Edited by: user12274810 on 25-nov-2009 12.04

  • Gettin ORA-01461 error in informatica level

    Hi All
    Iam getting following error at informatica level.
    WRT_8229 : Database errors occurred:
    ORA-01461: can bind a LONG value only for insert into a LONG column
    But we dont have any column with LONG datatype. only we have varchar2 datatype and date. its direct loading from source to target.
    could you please provide me the solution
    thanks
    LNR

    Looks like a bug..check metalink note 728074.1
    Pls mark correct/helpful...

  • Found the problem (Re: ORA-01461 error in DB with char encoding = UTF8)

     

    Hi,
    Yes even i had this problem and setting this weblogic.oci.min_bind_size =660 solved.
    But the proble i face is this works if i get the connection through java code. Instead if i use Connection pool and edit the config.xml or do through admin console .This doesn't work even after setting this property. Any Help will be appreciated and it is pretty urgent.
    Thanx
    -Sugandha

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

    I have a Windows app that accesses an Oracle 12c database via ODBC (the driver version is 12.01.00.01).
    I have a table that has a key column named REGION_ID (NVARCHAR2(9)), and about a dozen other columns, three of which are named REGION1, REGION2, and REGION3, all of type NVARCHAR2(40).
    When I try to insert a string into the REGION1 field that's greater than 9 characters (the length of REGION_ID), I get an ORA-01461 error ('Can bind a LONG value only for insert into a LONG column). If I define the length of REGION_ID to be NVARCHAR2(15), then I can add strings to the REGION1 field with a length up to 15 before I get the ORA-01461 exception again. Oddly, if I change the REGION1 column name to REGIONONE, I do not get any errors, and everything works fine. It's almost as if the column name REGION1 is being confused with REGION_ID behind the scenes.
    Any ideas? I’m using SQLBindParameter to bind the columns, and all of the calls succeed. I get the exception when I execute the insert statement. This same code worked for previous versions of Oracle (11g, 10g, and 9i). And if I use an 11g client driver against the 12c server, I do not get the exception.
    Thanks!

    Sorry, I was just now able to install the patch for bug 18232462, and it did indeed solve the issue I described above. Thanks!

  • ORA-01461 - Inserting pound sign

    Wonder if anyone can help with this issue?
    I'm running Oracle Forms [32 Bit] Version 10.1.2.0.2 (Production) with OC4J 10.1.2.0.2 against Oracle database version 11.1.0.7.0. where the NLS_CHARACTERSET on the database is AL32UTF8.
    NLS_LANG on my machine is:
         SQL> @.[%NLS_LANG%].
         SP2-0310: unable to open file ".[AMERICAN_AMERICA.WE8MSWIN1252]..sql"
         SQL>
    I have a form with a non database block containing a push button and text item field, Data Type - CHAR, Maximum Length - 1000, Data Length Semantics - Null
    create table amc_pound_test
    ( apt_id number
    , text1 varchar(2000)
    Using the button with a When-Button-Pressed trigger I try to insert the text, "£1", into the above table using the following code:
         DECLARE
              aSeq Number;
         BEGIN
              Select NVL(MAX(Apt_Id),0) + 1
              Into aSeq
              From AMC_POUND_TEST;
              Insert Into AMC_POUND_TEST
              ( apt_id
              , text1
              Values
              ( aSeq
              , 'Direct: '||:block3.text1
              commit;
              insert_rec(:block3.text1);
         END;
    Where insert_rec is a program unit defined as:
         PROCEDURE insert_rec ( pi_Text1 amc_pound_test.Text1%TYPE ) IS
              aSeq Number;
         BEGIN
              Select NVL(MAX(Apt_Id),0) + 1
              Into aSeq
              From AMC_POUND_TEST;
         INSERT INTO AMC_POUND_TEST
         ( Apt_Id
         , Text1
         VALUES
         ( aSeq
         , 'Via Proc: '||pi_Text1
         commit;
         END;
    When the Maximum Length of field on the form (:block3.text1) is set to 1000 or less both inserts work fine.
    Once the Maximum Length is increased to more than 1000, e.g. 1001, 1333, 2000 the insert via the Insert_Rec procedure fails with an ORA-01461 error.
    However, if I remove the pound sign, both inserts work fine!
    Any ideas?
    Many Thanks
    Anton

    Seems to be related to Oracle Bug 5143833.
    I'll update if the workaround to set the NLS_LANG to UTF8 works on customer site.

  • Receiving ora-01461 when trying to insert

    Hello,
           I have a form with multiple rows of data, i wrote a loop statement that inserts data into another table.  When i test the statement from SQL prompt, everything works with no problems.  however, when i added to the save button, i am receiving the Ora-01461 error.  why is that?  the description from what i find doesn't seem to fit with what i'm doing.  any thoughts?  I'm using Oracle Forms 10g and writing to an 11g database.
    thank you,
    steven

    commit_form;  --commit the form first so that any changes will be applied to the database, prior to being copied over to destination table.
    declare
         cursor c_bullet is
              select SL_3_BULLET_NBR, SL_3_PREFACE_BULLET, SL_3_PREFACE_DATE_INPUT, SL_3_SUB_CAT_NBR
              from PARKER.SL_3_PREFACE_DEFAULTS;
    v_bullet_nbr      PARKER.TEMP_PREFACE_BULLET.SL_3_BULLET_NBR%TYPE;
    v_bullet              PARKER.TEMP_PREFACE_BULLET.SL_3_BULLET%TYPE;
    v_date_input     PARKER.TEMP_PREFACE_BULLET.SL_3_DATE_INPUT%TYPE;
    v_sub_cat          PARKER.TEMP_PREFACE_BULLET.SL_3_SUB_CAT_NBR%TYPE;
    v_sl3_idn           PARKER.TEMP_PREFACE_BULLET.SL_3_IDN%TYPE;
    error_msg varchar2(300);
    begin
         v_sl3_idn := 'SL-3-11653A'  -- for testing purposes, will be filled from a global variable that the user inputs.
    open c_bullet;
    loop
    fetch c_bullet into v_bullet_nbr, v_bullet, v_date_input, v_sub_cat;
    exit when c_bullet%notfound;
    if (v_bullet_nbr <= 30) then
         insert into PARKER.TEMP_PREFACE_BULLET (sl_3_preface_bullet, sl_3_preface_date_input, sl_3_bullet_nbr, sl_3_sub_cat_nbr)
         values (v_bullet, v_date_input, v_bullet_nbr, v_sub_cat);
    end if;
    commit;
    end loop;
    close c_bullet;
    end;

  • Error ORA-01460 warning ORA-01461 during running a mapping with parameters

    Oracle 10g release2(10.2.0.1.0), OWB 10.2.0.1.31, Workflow server 2.6.4
    I have a simple process flow ( start -> mapping -> end).
    The mapping consists of 4 input groups(3 ordinary tables<INGRP1, INGRP2, INGRP3> and 1 mapping input parameter operator <INGRP4>), a joiner, a filter, an expression operator and 1 output group.
    I want to use two variables in join condition, so I bound two mapping input parameters(<INGRP4.SRC_SYS_CDE> and <INGRP4.ADMIN_ORG_NUM>) with two parameters of the process flow's start activity.
    Those two mapping input parameters are of type char, one is 4-char long and the other is 2-char long. So I set both of the two parameters of the start activity as String, one as 08, another as 7504.
    My join condition is:
    INGRP1.ORGIDT = INGRP2.SOURCEORGANIZATIONNO AND
    INGRP2.SOURCESYSTEMCODE = INGRP4.SRC_SYS_CDE AND
    INGRP2.ADMINORGANIZATIONNO = INGRP4.ADMIN_ORG_NUM AND
    INGRP1.CURCDE = INGRP3.NUM(+)
    There are no errors and warnings in validation, generation and deployment process, but when I run the process flow, it always finishes blankly(zero insert) with no error and warning messages. It should insert more than 20,000 rows.
    When I run the mapping and set the parameters 08 and 7504 at the parameter prompt, then start, the following error and warning occurs.
    Error ORA-01460: unimplemented or unreasonable conversion requested
    Warning ORA-01461: can bind a LONG value only for insert into a LONG column
    So what's the problem? How can I fix it?

    The problem was mapping input parameter type.
    VARCHAR2-type mapping input parameter works with String-type PF parameter. But CHAR-type won't.

  • Agent Upload error:  ERROR-400|ORA-01461: can bind a LONG value ...

    Periodically receiving the following error on our Grid Control machine:
    [oracle@lugc01 agent10g]$ ./bin/emctl upload agent
    Oracle Enterprise Manager 10g Release 4 Grid Control 10.2.0.4.0.
    Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
    EMD upload error: Failed to upload file B0000021.xml: HTTP error.
    Response received: ERROR-400|ORA-01461: can bind a LONG value only for insert into a LONG column
    This is the agent that is on the host that runs Grid Control. GC Seems to be running fine, but the agent has this problem quite regularly. This also seems to happen on other linux 10.2.0.4 agents as well.
    To remedy it, I go in and remove the upload data in $AGENT_HOME/sysman/emd/upload and then restart the agent. I don't like doing this.
    Any ideas?

    Hi
    The error display is very strong. The mean is that the agent try upload a file to the OMS and when the OMS Server go to insert the data in a SYSMAN Table , the value is of a LONG COLUMN and the table not have this type of column.
    Please provide me:
    - When the error appear , take the xml file and send me
    - Run this comand in the agent:
    emctl config agent listtargets
    If i have the xml file, i can try to solve the problem
    Regards
    Roberto Hernandez
    [email protected]

  • Why this Error comes "ORA-01461: can bind a LONG value only for insert into

    I'm using Oracle 9.2 with Weblogic 8 server. After Googling i got to resolve this issue "ORA-01461: can bind a LONG value only for insert into a LONG column" by adding : oracle.jdbc.RetainV9LongBindBehavior=true in server properties for the datasource.
    But why did this error come and after keeping the above property why did this error go away ?
    Can anyone help me on this.....

    You have an error in the code:
    1. you don't provide a value for 'what' - you have to tell Oracle what it should execute when it submits the job.
    And remember - with ISUBMIT the next_date parameter has datatype VARCHAR2 - SUBMIT uses datatype DATE. So make sure you provide a VARCHAR2 value and do not rely on implicit conversion.
    >
    PROCEDURE DBMS_JOB.ISUBMIT
    (job IN BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN VARCHAR2
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);
    PROCEDURE DBMS_JOB.SUBMIT
    (job OUT BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN DATE DEFAULT SYSDATE
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);

  • ORA-01461: can bind a LONG value only for insert into a LONG column error

    Oracle 11g R1 RHEL 5 64bit (Apex 3.1)
    Hi all,
    I am having a tough time with this error:
    ORA-01461: can bind 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 looks like follows:
    INSERT INTO fprchr.trigger_email
    (trigger_email_rid,
    email_to,
    email_from,
    email_body,
    email_subject,
    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
    execute immediate 'alter session set events ''10046 trace name context off''';
    END submit;
    It seems like the characters have exceeded the limit that VARCHAR2 can handle? What other data type could I change the fprchr.trigger_email table to? Is that all that is needed?
    Thanks.

    It seems like the characters have exceeded the limit that VARCHAR2 can handle? What other data type could I change the fprchr.trigger_email table to? Is that all that is needed?
    Did you try with clob data type?
    Regards.
    Satyaki De

Maybe you are looking for

  • Loops in method are never executed??

    Hello, I have a short program that I wrote to practice manipulating arrays and to practice modular design. The source compiles and the program executes, however the 2 loops in the process() method are never entered, I have tried do-while loops and th

  • Lightroom  V1.41 upgrade.. Now won't run

    Installed Lightroom V1 on my recently reformatted Computer. Installed Lightroom V1.41 and now when I try and run it, I get A visual C++ Runtime Library error "This application has requested the runtime to terminate in an unusual way. Please contact t

  • Copy Custom toolbar from one instance to another in Project server 2007

    Hi, I am currently using project server 2007. We have a number of instances in our Project server enivoronment. Is it possible to copy customized toolbar from one instance to another? If yes, how? Thanks in advance 

  • BI : Vendor Master

    Hi Experts, would like to know a few things. Kindly advise. We are doing the extraction from R3 for 0vendor_attr & 0vendor_txt. I have created the respective transformations & DTP in our *BI production system*. but when i executed the infopackagesi f

  • Is anyone else having problems transferring their digital copy of "Haywire"? Session Timed Out?

    I recently purchased the Bluray for "Haywire" that included a digital copy.  I have followed the directions for download into iTunes included w/ the Bluray that directs me to www.lionsgatedigitalcopy.com/redeem.  I have entered the code on multiple o