Query for inserting into dynamic partitioned table

i want to insert into a table which is partitioned (partition name will be obtained dynamically) based on some select statement using execute immediate statement can some one help with query

First u create table with partition.when u will insert record it will automatically enter in right partition in dynamically.
and when u will select that record give SELECT query with partition
Ex:
SELECT * FROM table_name PARTITION(partition name);

Similar Messages

  • QUERY FOR INSERT INTO  SQL TABLE

    Hi all,
    i want to insert some records into SQL table but not SAP database table. This table is only present in SQL database &
    not present in SAP database.
      i want to write a program in SAP to update the SQL table(not present in SAP database). is it possible?
       if yes, plz give me the query for inserting records into SQL table.
    Regards

    Hello,
    working on the same issue:
    Try this:
    DATA : Begin Of XY Occurs 1000,
            id(15)    TYPE C,
            Name(50)  TYPE C,
            ArtNr(50) TYPE C,
            lieferant TYPE I,
         End Of XY.
    Fill this internal Table with the SAP-Table
    START Connection to your Database
      EXEC SQL.
          Connect TO 'TEST_FH'
      ENDEXEC.
      IF SY-SUBRC EQ 0.
        EXEC SQL.
        Set Connection 'TEST_FH'     " <-- this is defines with TCode dbco
        ENDEXEC.
        IF SY-SUBRC EQ 0.
        Else.
          " OUT_Msg = '... won't connect'.
          Exit.
        EndIf.  " Else IF SY-SUBRC EQ 0
      Else.
        " OUT_Msg =  'Error at Set Connection Test_FH'.
        Exit.
      EndIf.  " IF SY-SUBRC EQ 0
    ENDE  Connection to your Database
    START Insert your table XY to an external database
        Loop AT XY.
          Try.
           EXEC SQL.
               INSERT INTO stoff
               (id, name , artnr, lieferant)
               VALUES
               ( :XY-ID,  :XY-Name, :XY-ArtNr, :XY-Lieferant )
           ENDEXEC.
           COMMIT WORK AND WAIT.     " <=== Maybe VERY important
          CATCH cx_sy_native_sql_error INTO exc_ref.
              error_text = exc_ref->get_text( ).
              Concatenate 'Table-INSERT: ' error_text Into error_text.
              MESSAGE error_text TYPE 'I'.
          ENDTRY.
        ENDLoop.     " Loop AT XY     
    END   Insert your table XY to an external database
    START: Clear Connection
        EXEC SQL.
          DISCONNECT 'TEST_FH'
        ENDEXEC.
    END : Clear Connection
    Hope it works
    Best wishes
    Frank

  • Query is taking too much time for inserting into a temp table and for spooling

    Hi,
    I am working on a query optimization project where I have found a query which takes hell lot of time to execute.
    Temp table is defined as follows:
    DECLARE @CastSummary TABLE (CastID INT, SalesOrderID INT, ProductionOrderID INT, Actual FLOAT,
    ProductionOrderNo NVARCHAR(50), SalesOrderNo NVARCHAR(50), Customer NVARCHAR(MAX), Targets FLOAT)
    SELECT
    C.CastID,
    SO.SalesOrderID,
    PO.ProductionOrderID,
    F.CalculatedWeight,
    PO.ProductionOrderNo,
    SO.SalesOrderNo,
    SC.Name,
    SO.OrderQty
    FROM
    CastCast C
    JOIN Sales.Production PO ON PO.ProductionOrderID = C.ProductionOrderID
    join Sales.ProductionDetail d on d.ProductionOrderID = PO.ProductionOrderID
    LEFT JOIN Sales.SalesOrder SO ON d.SalesOrderID = SO.SalesOrderID
    LEFT JOIN FinishedGoods.Equipment F ON F.CastID = C.CastID
    JOIN Sales.Customer SC ON SC.CustomerID = SO.CustomerID
    WHERE
    (C.CreatedDate >= @StartDate AND C.CreatedDate < @EndDate)
    It takes almost 33% for Table Insert when I insert the data in a temp table and then 67% for Spooling. I had removed 2 LEFT joins and made it as JOIN from the above query and then tried. Query execution became bit fast. But still needs improvement.
    How I can improve further. Will it be good enough if I create Indexes on the columns for the temp table and try.or what If I use derived tables?? Please suggest.
    -Pep

    How I can improve further. Will it be good enough if I create Indexes on the columns for the temp table and try.or what If I use derived tables??
    I suggest you start with index tuning.  Specifically, make sure columns specified in the WHERE and JOIN columns are properly indexed (ideally clustered or covering, and unique when possible).  Changing outer joins to inner joins is appropriate
    if you don't need outer joins in the first place.
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

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

    Hi,
    I'm using Oracle 9.2 with Weblogic 8 server. There are two columns OBJ_EVIDENCE_COMP - varchar2(4000 bytes), Descriptiion - varchar2(4000 bytes) in a table.I'm getting the Data from that table and again I'm updating into the same table with same data after updating the Data object in java.
    I am getting the following error
    "Java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column"
    Can some one let me know why this error occurs ? Please do let me know if you want any other information. Below is my SQL Query:
    * @jc:sql statement::
    * UPDATE CORRECTIVE_ACTION SET
    * CA_ID = {dt.caId},
    * CA_NBR = {dt.caNbr},
    * CAPA_PLAN_ID = {dt.capaPlanId},
    * OBJ_EVIDENCE_COMP = {dt.objEvidenceComp},
    * APPLICABLE_ELSE_WHERE = {dt.applicableElseWhere},
    * JUSTIFICATION = {dt.justification},
    * MOE = {dt.moe},
    * COMPLETION_DATE = {dt.completionDate},
    * EXTENSION_DUE_DATE = {dt.extensionDueDate},
    * STATUS_CD = {dt.statusCd},
    * SYSTEM_STATUS_CD = {dt.systemStatusCd},
    * ROOT_CAUSE_CD = {dt.rootCauseCd},
    * DESCRIPTION = {dt.description},
    * CA_TYPE = {dt.caType},
    * CREATED_BY = {dt.createdBy},
    * CREATED_DATE = {dt.createdDate},
    * MODIFIED_BY = {dt.modifiedBy},
    * MODIFIED_DATE = {dt.modifiedDate},
    * COMPLETION_DUE_DATE = {dt.completionDueDate}
    * WHERE CA_ID = {dt.caId}
    In the above update statement if i remove one among the 2 columns mentioned then it is getting updated properly......
    Regards,
    Bharat
    Edited by: 908508 on Jan 17, 2012 2:18 AM

    I am occasionally getting this error in an Oracle 11g database
    I use Rogue Wave to insert:
    connection.beginTransaction ("bulkInsertEvents");
    RWDBTBuffer <RWCString> symbols (symbol, rowCount);
    RWDBTBuffer <RWDateTime> timeStamps (timeStamp, rowCount);
    RWDBTBuffer <int> eventCounts (eventCount, rowCount);
    RWDBTBuffer <RWCString> events (event, rowCount);
    RWDBBulkInserter ins = table.bulkInserter (connection);
    ins << symbols << timeStamps << eventCounts << events;
    ins.execute ();
    connection.commitTransaction ("bulkInsertEvents");
    catch (RWxmsg & exception)
    cout << Logging::getProgramName () << " " << exception.why () << endl;
    throw "Failed to do bulk insert events to DBTools.";
    Some of the inserts give me
    "[SERVERERROR] ORA-01461: can bind a LONG value only for insert into a LONG column"
    the table structure is
    SYMBOL     VARCHAR2(33 BYTE)
    DATEANDTIME     TIMESTAMP(6)     
    NUMOFEVENTS     NUMBER     
    EVENTS     VARCHAR2(4000 BYTE)

  • Inserts into Global Temporary Table

    I'm working on using a global temporary table in one of my apps. I have a small test run here to isolate the problem. It simply creates the global temporary table, inserts a row, commits and then does a select to see if the insert worked. No data shows in the table when running this. I don't know much about global temp tables, so any help would be appreciated.
    CREATE GLOBAL TEMPORARY TABLE AGENT_SILO.AS_TEMP_VALIDATE (
    SBI_EMPLOYEE_ID NUMBER,
    CURRENT_FLAG char(1),
    EFFECTIVE_START date,
    EFFECTIVE_END date
    ) ON COMMIT DELETE ROWS;
    INSERT INTO AGENT_SILO.AS_TEMP_VALIDATE(SBI_EMPLOYEE_ID, CURRENT_FLAG, EFFECTIVE_START, EFFECTIVE_END)
    VALUES(0, '', SYSDATE, SYSDATE);
    commit;
    SELECT * FROM AGENT_SILO.AS_TEMP_VALIDATE;

    So I wonder what else I'm doing wrong that's really obvious. Here's what i'm trying to accomplish and maybe there's a better way of going about it.
    I have a trigger that is supposed to do some validation before the insert is allowed to go through. So here's my approach. I have a trigger fired when there's an insert into the AS_Employee_history table. This passes some of the fields from this insert into a proc (the id, a flag and a couple of dates). Within the proc, i create a global temp table, insert these passed values into the temp table. Then I have a cursor to basically copy the rows from the as_employee_history table that have the same id. Then I can do some selects on the temp table to see if it passes the validation.
    I have outputs throughout for debugging and it gets to right after the inserts into the temp table, then the rest of the code doesn't appear to be executed. So it looks like it's failing at the execution of select statements on the temp table. Anything else obvious that I"m missing here?
    Here's my proc.
    PROCEDURE "PAS_VALIDATE" (STATUS OUT VARCHAR2, v_status OUT BOOLEAN, NEW_SBI_EMPLOYEE_ID IN NUMBER,
    NEW_CURRENT_FLAG IN CHAR, NEW_EFFECTIVE_START IN DATE,
    NEW_EFFECTIVE_END IN DATE)
    IS
    v_prev_effective_end date;
    v_flag_count number;
    v_flag_count_date number;
    --variables to store dynamic sql returns
    v_sql_flag_count_date varchar2(255);
    v_sql_flag_count varchar2(255);
    v_sql_prev_eff_end varchar2(255);
    cursor c_row is
    select * from AGENT_SILO.AS_EMPLOYEE_HISTORY EMP
    where (EMP.SBI_EMPLOYEE_ID = NEW_SBI_EMPLOYEE_ID);
    r_row c_row%ROWTYPE;
    BEGIN
    Status := 'Started';
    v_status := true;
    DBMS_OUTPUT.PUT_LINE('Creating temporary table...');
    execute immediate 'CREATE GLOBAL TEMPORARY TABLE AGENT_SILO.AS_TEMP_VALIDATE (
    SBI_EMPLOYEE_ID NUMBER,
    CURRENT_FLAG char(1),
    EFFECTIVE_START date,
    EFFECTIVE_END date
    ) ON COMMIT PRESERVE ROWS';
         DBMS_OUTPUT.PUT_LINE('Validating the data...');
         --DBMS_OUTPUT.PUT_LINE('Inserting submitted row into temp table');
    --Insert the new row being submitted from user into the temp table
    execute immediate 'INSERT INTO AGENT_SILO.AS_TEMP_VALIDATE(SBI_EMPLOYEE_ID, CURRENT_FLAG, EFFECTIVE_START, EFFECTIVE_END)
    VALUES(' || NEW_SBI_EMPLOYEE_ID || ',
    ''' || NEW_CURRENT_FLAG || ''',
    to_date(''' || to_char(NEW_EFFECTIVE_START, 'mm/dd/yyyy hh:mi:ss') || ''', ''mm/dd/yyyy hh:mi:ss''),
    to_date(''' || to_char(NEW_EFFECTIVE_END, 'mm/dd/yyyy hh:mi:ss') || ''', ''mm/dd/yyyy hh:mi:ss''))';
    --Insert the other rows to we end up with a subset of the employee history table
    --with only rows that match the sbi_employee_id of the submitted row
         --DBMS_OUTPUT.PUT_LINE('Inserting into temp table...');
    open c_row;
    loop
    fetch c_row into r_row;
    exit when c_row%NOTFOUND;
    execute immediate 'INSERT INTO AGENT_SILO.AS_TEMP_VALIDATE(SBI_EMPLOYEE_ID, CURRENT_FLAG, EFFECTIVE_START, EFFECTIVE_END)
    VALUES(' || r_row.SBI_EMPLOYEE_ID || ',
    ''' || r_row.CURRENT_FLAG || ''',
    to_date(''' || to_char(r_row.EFFECTIVE_START, 'mm/dd/yyyy hh:mi:ss') || ''', ''mm/dd/yyyy hh:mi:ss''),
    to_date(''' || to_char(r_row.EFFECTIVE_END, 'mm/dd/yyyy hh:mi:ss') || ''', ''mm/dd/yyyy hh:mi:ss''))';
    end loop;
    close c_row;
    DBMS_OUTPUT.PUT_LINE('After inserts');
    -----Store queries to determine values for validation--------------------------
    v_sql_prev_eff_end := 'SELECT to_char(max(effective_end), ''dd-mon-yy'')
    FROM AGENT_SILO.AS_TEMP_VALIDATE
    where to_char(EFFECTIVE_END, ''dd-mon-yy'') != ''31-dec-99'' AND
    SBI_EMPLOYEE_ID = NEW_SBI_EMPLOYEE_ID';
    --Find the largest effective_end, besides the 9999 value
    execute immediate v_sql_prev_eff_end into v_prev_effective_end;
    DBMS_OUTPUT.PUT_LINE('The highest previous end date: ' || v_prev_effective_end);
    --...........Validation testing...........
    execute immediate 'DROP TABLE AGENT_SILO.AS_TEMP_VALIDATE'; --Drop temp table
    DBMS_OUTPUT.PUT_LINE('Validation Procedure Complete');
    COMMIT;
    status:='Success';
    EXCEPTION
    When Others Then
    ROLLBACK;
    Status := SQLERRM;
    END;
    Thanks a bunch for helping a noob out.

  • How to insert into two differents tables at the same time

    Hi
    I'm newer using JDev, (version 3.1.1.2 cause the OAS seems to support just the JSP 1.0)
    and I want to insert into two differents tables at the same time using one view.
    How can I do that ?
    TIA
    Edgar

    Oracle 8i supports 'INSTEAD OF' triggers on object views so you could use a process similar to the following:
    1. Create an object view that joins your two tables. 'CREATE OR REPLACE VIEW test AS SELECT d.deptno, d.deptname, e.empname FROM DEPT d, EMP E'.
    2. Create an INSTEAD OF trigger on the view.
    3. Put code in the trigger that looks at the :NEW values being processed and determines which columns should be used to INSERT or UPDATE for each table. Crude pseudo-code might be:
    IF :NEW.deptno NOT IN (SELECT deptno FROM DEPT) THEN
    INSERT INTO dept VALUES(:NEW.deptno, :NEW.deptname);
    INSERT INTO emp VALUES (:NEW.deptno, :NEW.empname);
    ELSE
    IF :NEW.deptname IS NOT NULL THEN
    UPDATE dept SET deptname = :NEW.deptname
    WHERE deptno = :NEW.deptno;
    END IF;
    IF :NEW.empname IS NOT NULL THEN
    UPDATE emp SET empname = :NEW.empname
    WHERE deptno = :NEW.deptno;
    Try something along those lines.
    null

  • Inserting into a base table of a materialized view takes lot of time.......

    Dear All,
    I have created a materialized view which refreshes on commit.materialized view is enabled query rewrite.I have created a materialized view log on the base table also While inserting into the base table it takes lot of time................Can u please tell me why?

    Dear Rahul,
    Here is my materialized view..........
    create materialized view mv_test on prebuilt table refresh force on commit
    enable query rewrite as
    SELECT P.PID,
    SUM(HH_REGD) AS HH_REGD,
    SUM(INPRO_WORKS) AS INPRO_WORKS,
    SUM(COMP_WORKS) AS COMP_WORKS,
    SUM(SKILL_WAGE) AS SKILL_WAGE,
    SUM(UN_SKILL_WAGE) AS UN_SKILL_WAGE,
    SUM(WAGE_ADVANCE) AS WAGE_ADVANCE,
    SUM(MAT_AMT) AS MAT_AMT,
    SUM(DAYS) AS DAYS,
    P.INYYYYMM,P.FIN_YEAR
    FROM PROG_MONTHLY P
    WHERE SUBSTR(PID,5,2)<>'PP'
    GROUP BY PID,P.INYYYYMM,P.FIN_YEAR;
    Please help me if query enable rewrite does any performance degradation......
    Thanks & Regards
    Kris

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

    Hello - I have a variable defined in a package as VARCHAR2(32720). This is not a table column. I am building a string inside the vairable, loading in invoice data in sections one at a time. It seems that once I get a larger number of invoices (say 100+) to load in, I get the "ORA-01461: can bind a LONG value only for insert into a LONG column" error. I am not trying to insert into a table column; just stringing together data in this large variable.
    Why would I be getting this error ? And is there a workaround ? The variable is read back out iin 80 byte strings which are then loaded to a table column that is varchar2(80).
    Thanks !!
    Jim Ernst
    Invacare Corporation

    Here is the definition of the field:
    l_EDI820_Data VARCHAR2(32720);
    And here is the loop used to populate the field. As i mentioned, it seems that once the process gets over 100 invoices coming in that the field hits the error; seems as if we are hitting say 4000 characters or near it at that point...
    FOR r_INVOICE_DETAIL IN cr_INVOICE_DETAILS LOOP
    l_EDI820_Data := l_EDI820_Data
    ||l_RMR_Statement
    ||r_INVOICE_DETAIL.INVOICE_NUM
    ||'*PI*'
    ||LTRIM(TO_CHAR(NVL(r_INVOICE_DETAIL.PAYMENT_AMOUNT,0))) -- Net Amount to be applied
    ||'*'
    ||LTRIM(TO_CHAR(r_INVOICE_DETAIL.INVOICE_AMOUNT,'999999.99')) -- Gross Amount
    ||l_Delimiter;
    l_TOTAL_SEGMENTS := l_TOTAL_SEGMENTS + 1;
    END LOOP; -- r_INVOICE_DETAIL
    There are some other statements that are adding additional data onto l_EDI820_Data ; this one is the loop that is basedon the invoices coming in.
    This code writes it to the table (field EDI820_DATA in the table is VARCHAR2(94)):
    l_EDI820_String_Length := LENGTH(RTRIM(l_EDI820_Data));
    l_EDI820_SUBSTR_START := 1;
    l_RECORD_SEQ_NO := 1;
    WHILE SUBSTR(l_EDI820_Data, l_EDI820_SUBSTR_START, 80) <> ' ' LOOP
    INSERT INTO XXAP_NACHA_EDI820_GTEMP_TBL
    SELECTED_CHECK_ID
    ,EDI820_SEQ
    ,EDI820_DATA
    VALUES (
    r_CHECK_IDS.SELECTED_CHECK_ID
    ,l_RECORD_SEQ_NO
    ,'705'||SUBSTR(l_EDI820_Data, l_EDI820_SUBSTR_START, 80)
    -- * Increment starting point for substring and also record sequence number
    l_EDI820_SUBSTR_START := l_EDI820_SUBSTR_START + 80;
    l_RECORD_SEQ_NO := l_RECORD_SEQ_NO + 1;
    END LOOP; -- WHILE Loop

  • ORA-01461: can bind a LONG value only for insert into a LONG Classic Report

    I am trying to create a report but get a ORA-01461: can bind a LONG value only for insert into a LONG column error. I am a fairley new to Apex and my SQL skills are far from expert level. I have 3 groups we will call 'A' 'B' 'C'. 'A' is the best group 'B' is the next best and 'C' is the lowest group. Let say there are 5 people they all want to be in group A but where they are placed is based on their audition score and the users selection.
    Joe score is 50
    Beth 40
    John 30
    Ken 20
    Sally 10
    The user selects that he wants 2 people in group 'A' and 1 in group 'B' and 2 in group C. The SQL needs to rank Joe and Beth in Group A. John in group 'B' and Ken and Sally in group 'C'. The user does this type of selection for about 15 different instrument groups to make up group (band) for 'A', 'B', and 'C'.
    Here is what I have come up with that gives me the error mention above when creating a report but works in SQL developer. There is probably a far better way to write this than what I have. I am open to suggestions. Band 'A' SQL example is for all instruments. SQL's for 'B' and 'C' are just a samples of the whole thing.
    SQL for Band 'A'
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    ( ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Piccolo'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_piccolo from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Flute'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Flute from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Oboe'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Oboe from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'English_Horn'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Englishhorn from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'English_Horn'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Englishhorn from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Clarinet_Eflat'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Clarineteflat from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Clarinet'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Clarinet from festival_years where year = ':P6_YEAR')
    UNION ALL SELECT lname,fname,instrument,total FROM(SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank FROM band_students, festival_records A JOIN festival_records B on a.ID = b.ID where band_students.id = a.ID and a.instrument = 'Clarinet Bass' and a.festival_year = ':P6_YEAR' ORDER BY total, a.ID DESC NULLS LAST) WHERE Stu_Rank <= (select hb_Clarinetbass from festival_years where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Clarinet Contrabass'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Clarinetcontrabass from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Saxophone Alto'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Saxophonealto from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Saxophone Tenor'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Saxophonetenor from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Saxophone Bari'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Saxophonebari from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Bassoon'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Bassoon from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Bassoon Contra'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Bassooncontra from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Horn'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Horn from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Trumpet'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Trumpet from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Trombone'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Trombone from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Trombone Bass'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Trombonebass from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Euphonium'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Trombonebass from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Tuba'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Tuba from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Percussion'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Percussion from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Piano'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Piano from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Violin'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Violin from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Viola'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Viola from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Cello'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Cello from festival_years
    where year = ':P6_YEAR')
    UNION ALL
    SELECT lname,fname,instrument,total
    FROM
    (SELECT lname, fname, a.instrument, a.total, DENSE_RANK() OVER
    (ORDER BY a.total DESC,a.ID NULLS LAST) AS Stu_Rank
    FROM band_students, festival_records A
    JOIN festival_records B on a.ID = b.ID
    where band_students.id = a.ID
    and a.instrument = 'Bass'
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank <= (select hb_Cello from festival_years
    where year = ':P6_YEAR'
    SQL for band 'B'
    SELECT lname,fname,instrument, total
    FROM
    (SELECT lname, fname, instrument, total, RANK() OVER
    ( ORDER BY instrument,total ASC NULLS LAST) AS Stu_Rank
    FROM festival_records, band_students
    where band_students.id = festival_records.id
    and instrument = 'Piccolo'
    and festival_year = '2014'
    ORDER BY instrument, total ASC NULLS LAST)
    WHERE Stu_Rank < (select hb_piccolo from festival_years
    where year = :P6_YEAR)
    SQL for band 'C'
    SELECT lname,fname,instrument, total
    FROM festival_records, band_students
    where band_students.id = festival_records.student_id
    and instrument = 'Piccolo'
    and festival_year = ':P6_YEAR'
    minus
    SELECT lname,fname,instrument, total
    FROM
    (SELECT lname, fname, instrument, total, RANK() OVER
    ( ORDER BY instrument,total DESC NULLS LAST) AS Stu_Rank
    FROM festival_records, band_students
    where band_students.id = festival_records.student_id
    and instrument = 'Piccolo'
    and festival_year = ':P6_YEAR'
    ORDER BY instrument, total DESC NULLS LAST)
    WHERE Stu_Rank < (select hb_piccolo from festival_years
    where year = ':P6_YEAR')
    SQL

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already).
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    You should also always post code wrapped in <tt>\...\</tt> tags.
    I am trying to create a reportWhen asking a question about "reports" it's firstly essential to differentiate between standard and interactive reports. Which is it?
    but get a ORA-01461: can bind a LONG value only for insert into a LONG column error.Where and when do you get this error? When creating the report? Or running it?
    There's also an obvious bug (repeated many times):
    and a.festival_year = ':P6_YEAR'
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank &lt;= (select hb_piccolo from festival_years
                   where year = ':P6_YEAR')
    ...<tt>':P6_YEAR'</tt> is a literal string, not a bind variable reference. <tt>':P6_YEAR'</tt> seems an unlikely value for <tt>festival_year</tt> and <tt>year</tt> values. It should be:
    and a.festival_year = :P6_YEAR
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank &lt;= (select hb_piccolo from festival_years
                   where year = :P6_YEAR)
    ...or even better:
    and a.festival_year = to_number(:P6_YEAR)
    ORDER BY total, a.ID DESC NULLS LAST)
    WHERE Stu_Rank &lt;= (select hb_piccolo from festival_years
                   where year = to_number(:P6_YEAR))
    ...if the <tt>festival_year</tt> and <tt>year</tt> columns are of type NUMBER. There's a possibility that this bug is in fact the source of your error...
    Furthermore, this is a long piece of SQL. It may be that APEX can't cope with the length. However it's also very repetitive: we see the same SQL pattern repeated many times and UNIONed together. One way to reduce the length of the query would be to replace some (or all) of those repeating patterns. This will not only make the query more APEX-friendly, but it will probably be more efficient and easier to maintain too.
    I recommend that you Re: 2. How do I ask a question on the forums? that will enable others to have a go at this. Reproducing the app on apex.oracle.com and posting guest developer credentials would also be helpful.

  • 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!

  • Nologging direct-path insert into an indexed table

    Hello,
    Does anyone have an idea how I can suppress generation of undo logs for direct-path insert into an indexed table on 11.2.0.1.0:
    CREATE TABLE TBL(ID NUMBER) NOLOGGING;
    CREATE INDEX IDX ON TBL(ID) NOLOGGING;
    INSERT /*+ APPEND */ INTO TBL SELECT /*+ APPEND */ ROWNUM FROM ...; -- Source table has 400,000,000+ rows
    Regards,
    Angel Tsankov

    Pl do not post duplicates - Why does Oracle not use direct-path insert when instructed to do so - pl continue the discussion in your original thread

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

    I Use ODP.net Insert and update Image files to Oralce blob columns(Oracle8i Server,ora92 client),
    When the files larger than 4000 characters,It doesn't work.error:ORA-01461 can bind a LONG value only for insert into a LONG
    My Vb.net code:
    Dim dlg As OpenFileDialog
    Dim strFileName() As String
    Dim fsBLOB As System.IO.FileStream
    Dim Adapter As OracleDataAdapter
    Dim ds As New DataSet
    Dim row As DataRow
    Dim cb As OracleCommandBuilder
    Dim bytes() As Byte
    dlg = New OpenFileDialog
    dlg.Filter = "Import File (*.*)|*.*"
    Adapter = New OracleDataAdapter("select * from a_blob_contents where 1=0", Me.OraConnection)
    Adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
    Adapter.FillSchema(ds, SchemaType.Source, "BLOB")
    cb = New OracleCommandBuilder(Adapter)
    If dlg.ShowDialog() = DialogResult.OK Then
    strFileName = dlg.FileNames()
    Dim loopCount As Integer
    For loopCount = 0 To strFileName.GetLength(0) - 1
    row = ds.Tables("BLOB").NewRow()
    row("BLOB_ID") = GetMaxBh("A_BLOB_CONTENTS", "BLOB_ID")
    row("FILE_ID") = FileID
    row("FILE_TYPE") = FileType
    Dim file_name As String
    file_name = strFileName(loopCount)
    file_name = file_name.Substring(file_name.LastIndexOf("\") + 1, file_name.Length - file_name.LastIndexOf("\") - 1)
    row("BLOB_NAME") = file_name
    fsBLOB = New FileStream(strFileName(loopCount), FileMode.Open, FileAccess.Read)
    ReDim bytes(fsBLOB.Length)
    fsBLOB.Read(bytes, 0, System.Convert.ToInt32(fsBLOB.Length))
    fsBLOB.Close()
    row("blob_contents") = bytes
    row("user_code") = Global.user_code
    row("Operate_date") = Now
    ds.Tables("BLOB").Rows.Add(row)
    Next
    Try
    Adapter.Update(ds, "BLOB")
    Catch ex As Exception
    MessageBox.Show(ex.Message)
    End Try
    End If
    I'll appreciate for anyone who can help me solve this problem.

    Hi Zhenquan,
    The issue is that you can not direct insert more than 4K (as you have discovered). Two methods I use in this situation are:
    1) sql statement or procedure that returns a lob locator into an ODP.NET OracleBlob parameter such as:
    insert into the_table (primary_key, blob_column) values (pk_value, empty_blob()) returning blob_column into :blob_parameter.
    Once you have the OracleBlob you should be able to write/update the data.
    2) use an anonymous pl/sql block or package that uses the dbms_lob supplied package to work with the LOB.
    Here is a simple console example...
    SQL> create table blob_test
    2 (
    3 blob_id number,
    4 blob_data blob,
    5 constraint blob_test_pk primary key (blob_id)
    6 )
    7 tablespace users;
    Table created.
    Sub Main()
    Dim strFileName As String = "c:\temp\testimage.jpg"
    Dim fsBlob As FileStream = New FileStream(strFileName, FileMode.Open)
    Dim bytes(fsBlob.Length) As Byte
    fsBlob.Read(bytes, 0, fsBlob.Length)
    fsBlob.Close()
    Dim con As OracleConnection = New OracleConnection("User Id=/; Data Source=lt8i")
    con.Open()
    Dim trans As OracleTransaction = con.BeginTransaction()
    Dim sql As String = "insert into blob_test (blob_id, blob_data) values (1,empty_blob()) returning blob_data into :blob_parameter"
    Dim blob_parameter As OracleParameter = New OracleParameter
    blob_parameter.OracleDbType = OracleDbType.Blob
    blob_parameter.Direction = ParameterDirection.InputOutput
    Dim cmd As OracleCommand = New OracleCommand(sql, con)
    cmd.Parameters.Add(blob_parameter)
    cmd.ExecuteNonQuery()
    Dim blob As OracleBlob = blob_parameter.Value
    blob.Write(bytes, 0, bytes.Length)
    sql = "update blob_test set blob_data = :blob_parameter where blob_id = 1"
    cmd.CommandText = sql
    blob_parameter.Value = blob
    cmd.ExecuteNonQuery()
    trans.Commit()
    End Sub
    This sample was tossed together pretty quickly, so it is not a complete, bullet-proof sample, but hopefully it will give you what you need to get started. The 'testimage.jpg' file is just over 5MB in size.
    Hope that helps,
    Mark
    =======================================
    Mark A. Williams
    Oracle DBA
    Author, Professional .NET Oracle Programming
    http://www.apress.com/book/bookDisplay.html?bID=378

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

    Getting error --
    ORA-01461: can bind a LONG value only for insert into a LONG column ORA-02063: preceding line from APPS
    A page has 3 fields and a Add button
    (1) first field is a LOV "select with submit"
    (2) second field is getting its value from select statement with where clause = ID selected from field1
    (3) field 3 is the value of field1
    In After submit Process , I write simple insert as follows in the
    BEGIn
    INSERT INTO TABLE_NAME (ELEMENT_NAME,ELEMENT_TYPE_ID )
    VALUES (:P3_NAME ,to_number(:P3_ELEMENT_TYPE_ID));
    COMMIT;
    END;
    when i click on Add i get the error above

    try doing the bind locally before executing the remote dml...
    declare
    l_long long := :P3_NAME;
    begin
    insert into table_name (ELEMENT_NAME,ELEMENT_TYPE_ID )
    values (l_long ,to_number(:P3_ELEMENT_TYPE_ID));
    end;
    ...and if that doesn't work, please let us know the definition of you TABLE_NAME table.
    thanks,
    raj

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

    We are getting an error from Oracle DB --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
    The application was working fine with Oracle 10.2.0.4 and ojbc14 driver 10.2.0.1 Error occurs only after an upgrade to Oracle 10g 10.2.0.5. So after some googling, we found that a driver upgrade would eliminate this error. So the 10.2.0.5 version of the driver was used. But the ORA error still occurs. The readme of ojdb14.jar specified this - BUG 8847022 - ORA-01461: CAN BIND A LONG VALUE ONLY FOR INSERT INTO A LONG COLUMN
    The problem is that we are not able to reproduce this using a sample program however it is happening consistently in the client environment.
    we get the error ORA-01461, when the oracle version is upgraded to 10.2.0.5. This error occurs when we try to insert a file(BLOB) data with the file length greater than 4KB to a table.
    Exception trace
    uncategorized SQLException for SQL []; SQL state [72000]; error code [1461];
    --- The error occurred in nl/sss/gict/mcb/data/dao/config/StateQueries.xml.
    --- The error occurred while applying a parameter map.
    --- Check the setReceivedFile-InlineParameterMap.
    --- Check the statement (update failed).
    --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
    ; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
    --- The error occurred in nl/sss/gict/mcb/data/dao/config/StateQueries.xml.
    --- The error occurred while applying a parameter map.
    --- Check the setReceivedFile-InlineParameterMap.
    --- Check the statement (update failed).
    --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
    Oracle version installed in acceptance:
    1 Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    2 PL/SQL Release 10.2.0.5.0 - Production
    3 CORE 10.2.0.5.0 Production
    4 TNS for Linux: Version 10.2.0.5.0 - Production
    5 NLSRTL Version 10.2.0.5.0 - Production

    Is the server running Java 1.4? If it is Java 5 or higher there is no need to keep using OJDBC14, you can upgrade to OJDBC5.
    If you cannot do that, then I ask you: why make this post? What are you expecting someone to do? Your problem is with the OJDBC driver, you are not going to get tech support for it in this Java programming forum.

  • 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