Creating CTXCAT on CLOB

Can I create a CTXCAT type index on a CLOB. When I tried to do that I got the following error.
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-10509: invalid text column: STORYDATA
ORA-06512: at "CTXSYS.DRUE", line 157
ORA-06512: at "CTXSYS.CATINDEXMETHODS", line 100
I tried CONTEXT and it worked but I need a CTXCAT...
Thanks

CLOB is not supported in CTXCAT.

Similar Messages

  • HELP:Problem in creating a temporary CLOB using JDBC connection pooling

    Hi All,
    i am inserting a large xml document in an xml type column by creating a temporary clob of this document
    tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
    I am not having any success getting the following statement working using a JDBC connection pool rather than a hard coded URL connection
    it works with:
    "jdbc:oracle:thin:@server:port:dbname" connection
    Does NOT work with:
    datasource.getConnection()
    Does any one know how to successfully get this to work?
    urgently plz........

    Hi Dharmi
    Here is a quote of Dafna's post in [another thread in this forum|Re: Copy VC controls]
    CE7.1.1 will be released at September 2008 for ramp-up customers.
    There are many improvements and new capabilities in the new release of Visual Composer for CE7.1.1. Among the new features you can find:
    The missing features from Visual Composer 7.0 (Html view, portal Eventing support (EPCM), JDBC, Undo/Redo, and more..)
    Many layout & modeling improvements
    Additional ALV table functionality - export to Excel, switch to chart, configure ALV behavior at design time
    Integration of Visual Composer in Eclipse - additional entry point to the Visual Composer models from the NWDS. This integration provides the option to add a WD component (in case of missing functionality in Visual Composer), as a black box component to the Visual Composer model. Right-clicking the component will open the Web Dynpro perspective for creating/modifying the component.
    Regards,
       Shai

  • Pl/sql Procedure is Not Creating With the CLOB data Type

    Hi,
    I am Using Oracle 10g Express Edition Release2.... My Doubt is While creating a table With CLOB Data Type the table is created successfully,but while Creating a Procedure With the CLOB Data type i am getting an Error Message
    2667/5 PL/SQL: Statement ignored
    2667/24 PLS-00382: expression is of wrong type
    then i tried With the Varchar2(30000) the Procedure is Created Successfully note i have not changed any thing in my code except the data type.
    I am Just Confused ......Why the Procedure is not Created with CLOB Data type?
    Please advice ...
    Thank U
    SHAN

    hi,
    Thanks for reply....Another Example
    CREATE TABLE USER_MAS (USER_ID     VARCHAR2 (20 Byte),MAIL_ID     VARCHAR2 (255 Byte));
    set serveroutput on
    declare
    atable varchar2(64) := 'USER_MAS';
    acolumn varchar2(64) := 'MAIL_ID';
    avalue varchar2(64) := 'NEWYORK' ;
    dyn_sql clob;
    begin
    dyn_sql := 'update '||atable||' set '||acolumn||' = '''||avalue|| '''' ;
    dbms_output.put_line(dyn_sql);
    execute immediate dyn_sql;
    end;
    commit ;
    Error at line 2
    ORA-06550: line 9, column 23:
    PLS-00382: expression is of wrong type
    ORA-06550: line 9, column 5:
    PL/SQL: Statement ignored
    When i Changed the Data type to varchar2(64)
    update USER_MAS set MAIL_ID = 'NEWYORK'
    PL/SQL procedure successfully completed.
    Commit complete.
    I like to Know the Reason Why the Procedure is Not Created in Oracle 10g XE DB
    Note :the Same Script i used in 11g DB the Procedure is Created Successfully....
    Why you need use CLOB or VARCHAR2 in your temp_num variable as you sending parameters as number?
    In the Procedure we are create some run time queries while executing the procedure. There are around 10 run time queries created.
    The size of each query is more than 4000 characters . We then add all the queries using union all after each query  to the clob variable as the normal varchar will not support.
    Please Advice
    Thank U
    SHAN

  • How to create and send clob value to SP?

    Hi,
    Does any one of an example of how to create and send
    a clob value(as a IN parameter to storedprocedure) from JAVA to
    the StoredProcedure. I need the JAVA code.
    null

    Hi 
    Following is sample code you can use.
    DECLARE @testID Int
    DECLARE @year int 
    DECLARE @testtype datatype
    SELECT @testtype=testtype from yourTable Where Your condition
    SELECT  @year= year from yourTable Where your conditon (you need to make sure you assign or get @year variable )
    SELECT @testid=id from test where  year=@year and testtype=@testtype)
    Hope this helps
    Regards

  • "Failed to open cursor" while creating CTXCAT index. Bug?

    Hi,
    I'm trying to create a catalog index on a rather large table. And I am consistently getting the following error. When the table was half the size, the same CREATE INDEX statement worked just fine. However, when the table grows to a certain size, that statement no longer works.
    I searched the whole forum and I did not find anything about this error. Am I the first to encounter it? Can this be a bug?
    Any advice is greatly appreciated.
    Yongtao
    SQL>create index myindex on mytable(mycolumn) indextype is ctxsys.ctxcat parameters ('index set myindexset section group mysectiongroup stoplist mystoplist storage mystorage lexer mylexer');
    create index myindex on mytable(mycolumn) indextype is ctxsys.ctxcat parameters ('index set myindexset section group mysectiongroup stoplist mystoplist storage mystorage lexer mylexer')
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-20000: Oracle Text error:
    DRG-50800: failed to open cursor
    DRG-50857: oracle error in drsxsopen
    ORA-00942: table or view does not exist
    ORA-06512: at "CTXSYS.DRUE", line 160
    ORA-06512: at "CTXSYS.CATINDEXMETHODS", line 97
    Elapsed: 09:07:26.25
    SQL>

    Looks like a bug to me. Did it error out immediately, or only after processing for some time?
    Do you get the same problem without the storage clause?

  • Create CTXCAT  index in parallel mode

    I am using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production with oracle text version 11.2.0.2.0.
    Following script is used to create the ctxcat index but I noticed it is not creating the index in parallel. We have 16 cpu server. The table onto which text index is created has no partition.
    BEGIN
    --Storage preference
    Ctx_Ddl.Create_Preference ('IDX_STORE', 'basic_storage');
    Ctx_Ddl.Set_Attribute (preference_name => 'IDX_STORE',
    attribute_name => 'I_TABLE_CLAUSE',
    attribute_value => 'TABLESPACE C_DATA_02');
    Ctx_Ddl.set_attribute ('IDX_STORE',
    'I_INDEX_CLAUSE',
    'TABLESPACE C_IDX_02 COMPRESS 2');
    Ctx_Ddl.set_attribute (
    'IDX_STORE',
    'R_TABLE_CLAUSE',
    'TABLESPACE C_DATA_02 LOB(DATA) STORE AS (CACHE)'
    --Wordlist
    ctx_ddl.create_preference ('nbcwordlist', 'BASIC_WORDLIST');
    ctx_ddl.set_attribute ('nbcwordlist', 'PREFIX_INDEX', 'TRUE');
    ctx_ddl.set_attribute ('nbcwordlist', 'PREFIX_MIN_LENGTH', 1);
    ctx_ddl.set_attribute ('nbcwordlist', 'PREFIX_MAX_LENGTH', 64);
    ctx_ddl.set_attribute ('nbcwordlist', 'SUBSTRING_INDEX', 'NO');
    END;
    CREATE INDEX FTS_IDX ON INDVL_SRCH_NM (SRCH_NM)
    INDEXTYPE IS CTXSYS.CTXCAT
    PARAMETERS('STORAGE IDX_STORE STOPLIST C_STOPLIST WORDLIST C_WORDLIST')
    PARALLEL (DEGREE 16);
    What should be done to create this index in parallel? Is there any other thing that can be done to speed up creation without disabling prefix index.
    Thanks. I appreciate you time and effort.
    Edited by: spur230 on Nov 14, 2011 4:53 PM

    Hi,
    in the manual some remarks are made for parallel indexing, see http://download.oracle.com/docs/cd/E14072_01/text.112/e10945/ind.htm#CIHCBABI
    So it is possible to index in parallel, but you don't have control, the oracle db decides this for you. So it is possible that Oracle thinks that single indexing is faster, more work is done in the database besides the index creation, and many more factors (also mentioned in above document).
    I did many parallel indexing on systems, but always on quiet moments, so I have the most resources for creating indexes. Furthermore I noticed that system statistics can influence the creation. If the statistics are good for the CPU and I/O, the parallel creation can be optimised by the db.
    Herald ten Dam
    http://htendam.wordpress.com

  • What's the best way to create and free temporaries for CLOB parameters?

    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production on Solaris
    I have a procedure calling another procedure with one of the parameters being an IN OUT NOCOPY CLOB.
    I create the temporary CLOB in proc_A, do the call to proc_B and then free the temporary again.
    In proc_B I create a REFCURSOR, and use that with dbms_xmlgen to create XML.
    So the code basically looks like
    CREATE OR REPLACE PROCEDURE client_xml( p_client_id IN            NUMBER
                                           ,p_clob      IN OUT NOCOPY CLOB   ) AS
       v_rc         SYS_REFCURSOR;
       v_queryCtx   dbms_xmlquery.ctxType;
    BEGIN
       OPEN c_rc FOR
          SELECT col1
                ,col2
                ,col3
            FROM clients
           WHERE client_id = p_client_id;
       v_queryCtx := dbms_xmlgen.newContext(v_rc);
       p_clob     := dbms_xmlgen.getXML(v_queryCtx, 0);
    END;
    CREATE OR REPLACE PROCEDURE my_proc AS
       v_clob       CLOB;
       v_client_id  NUMBER;
    BEGIN
       v_client_id := 123456;
       dbms_lob.createTemporary(v_clob, TRUE, dbms_lob.CALL);
       client_xml( p_client_id => v_client_id
                  ,p_clob      => v_clob);
       dbms_lob.freeTemporary(v_clob);
    END;However, I just learned the hard way that IN OUT NOCOPY is only a hint, and that Oracle sometimes creates a local variable for the CLOB anyway.
    A solution is to change the client_xml procedure above to
    CREATE OR REPLACE PROCEDURE client_xml( p_client_id IN            NUMBER
                                           ,p_clob      IN OUT NOCOPY CLOB   ) AS
       v_rc         SYS_REFCURSOR;
       v_queryCtx   dbms_xmlquery.ctxType;
    BEGIN
       IF NOT NVL(dbms_lob.istemporary(p_clob),0) = 1 THEN
          dbms_lob.createTemporary(p_clob, TRUE, dbms_lob.CALL);
       END IF;
       OPEN c_rc FOR
          SELECT col1
                ,col2
                ,col3
            FROM clients
           WHERE client_id = p_client_id;
       v_queryCtx := dbms_xmlgen.newContext(p_refcursor);
       p_clob     := dbms_xmlgen.getXML(v_queryCtx, 0);
    END;My concern is that in case Oracle does create a local variable, 2 temporaries will be created, but there will only be 1 freeTemporary.
    Could this lead to a memory leak?
    Or should I be safe with the solution above because I'm using dbms_lob.CALL?
    Thanks,
    Arnold
    Edited by: Arnold vK on Jan 24, 2012 11:52 AM

    Arnold vK wrote:
    However, I just learned the hard way that IN OUT NOCOPY is only a hint, and that Oracle sometimes creates a local variable for the CLOB anyway.A CLOB variable in called a locator. Just another term for a pointer.
    A CLOB does not exist in local stack space. The variable itself can be TBs in size (max CLOB size is 128TB depending on DB config) - and impossible to create and maintain in the stack. Thus it does not exist in the stack - and is why the PL/SQL CLOB variable is called a locator as it only contains the pointer/address of the CLOB.
    The CLOB itself exists in the database's temporary tablespace - and temporary LOB resource footprint in the database can be viewed via the v$temporary_lobs virtual performance view.
    Passing a CLOB pointer by reference (pointer to a pointer) does not make any sense (as would be the case if the NOCOPY clause was honoured by PL/SQL for a CLOB parameter). It is passed by value instead.
    So when you call a procedure and pass it a CLOB locator, that procedure will be dereferencing that pointer (via DBMS_LOB for example) in order to access its contents.
    Quote from Oracle® Database SecureFiles and Large Objects Developer's Guide
    >
    A LOB instance has a locator and a value. The LOB locator is a reference to where the LOB value is physically stored. The LOB value is the data stored in the LOB.
    When you use a LOB in an operation such as passing a LOB as a parameter, you are actually passing a LOB locator. For the most part, you can work with a LOB instance in your application without being concerned with the semantics of LOB locators. There is no requirement to dereference LOB locators, as is required with pointers in some programming languages.
    >
    The thing to guard against is not freeing CLOBs - the age old issue of not freeing pointers and releasing malloc'ed memory when done. In PL/SQL, there is fairly tight resource protection with the PL/SQL engine automatically releasing local resources when those go out of scope. But a CLOB (like a ref cursor) is not really a local resource. And as in most other programming language, the explicit release/freeing of such a resource is recommended.

  • Creating a CLOB in jdbc

    I have a PL/SQL stored procedure which accepts a CLOB data type as one of the arguments. This procedure inserts a record into a table which has a column of datatype CLOB.
    Using jdbc, my java program creates a CallableStatement to the stored proc. Now I wish to create the CLOB based on a String value and pass it to the stored proc.
    This is a snippet of my code.
    import java.io.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.*;
    public class TestClob2 {
    public static Connection getConnection() throws FPError {
    Connection connection = null;
    String hostname= "ahost";
    String host = "jdbc:oracle:thin:@" + hostname+ ":1521:db";
    String user = "user";
    try {
    DriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver());
    connection = DriverManager.getConnection(host, user, user);
    } catch ( Exception e ){
    System.out.println("could not get connection" + e.toString());
    } catch ( Throwable t ){
    System.out.println("could not get connection" + t.toString());
    } finally {
    return connection;
    public static void main( String[] args){
    Connection con = null;
    try {
    con = getConnection();
    OracleCallableStatement stmt = (OracleCallableStatement) con.prepareCall("{call plsqlStoredProc(? )}");
    String message="Test for Clob";
    try
    oracle.sql.CLOB cl = new oracle.sql.CLOB( (OracleConnection) con);
    //byte[] msg = message.getBytes("UTF8");
    //CLOB cl = new CLOB( (OracleConnection) con, msg);
    if ( cl == null ) System.out.println("clob is null");
    long index = cl.getLength();
    System.out.println("length is " + l );
    int i = cl.putString(index+1, message);
    stmt.setCLOB(1, cl);
    stmt.executeUpdate();
    catch (SQLException excep)
    System.out.println(excep.getMessage());
    excep.printStackTrace();
    //new LogException(excep.getMessage());
    } catch (Exception e ) {
    System.out.println("caught exception " + e.toString());
    e.printStackTrace();
    } finally {
    try { if (con != null ) con.close(); } catch ( Exception e){ }
    I get the following error
    caught exception java.lang.NullPointerException:
    java.lang.NullPointerException:
    at oracle.sql.Datum.getBytes(Datum.java:147)
    at oracle.jdbc.driver.OraclePreparedStatement.setCLOB(OraclePreparedStat
    ement.java)
    at oracle.sql.CLOB.plsql_write(Compiled Code)
    at oracle.jdbc.ttc7.TTC7Protocol.lobWrite(TTC7Protocol.java)
    at oracle.sql.CLOB.putChars(CLOB.java)
    at oracle.sql.CLOB.putString(CLOB.java)
    at TestClob3.main(TestClob3.java:38)
    Can anybody tell me how I can create a CLOB in jdbc to pass it over to a PL/SQL stored proc.
    When I test the stored procedure using a PL/SQL proc ( creating a temporary clob and passing it to the stored proc ) it works fine.
    Can somebody point out the mistake in my code. Appreciate it.
    Thanks.
    null

    Hello,
    First of i must admit that i am naive to installation softwares. But i can tell u that u can create tables using java and jdbc. I have done it myself. As far as creating database in concerned i haven't tried it out yet. But my gut feeling is that u can create it. I u are interested in having a look at the sample code then here it is.
    import java.sql.*;
    public class demoddl
    public static void main(String[] args) throws SQLException
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@10.0.0.8:1521:oraserv","scott","lion");
    Statement stmt = con.createStatement();
    boolean b = stmt.execute("create table demoddl(a number)");
    System.out.println("Boolean
    catch(Exception e)
    System.out.println("Exception="+e.toString());
    }

  • How do I create a 'external table' against clob

    Hi there,
    I have a need, where I will have multiple csv files, which I plan to load it to a temporary table using the 'external table' concept. My issue is that I will have many at the same time and I don't want to create too many tables.
    So is there a way I can create tables against clob (which will have ',' separated data.
    Basically instead of putting the ',' separated data in a file I want to keep it in CLOB.
    Let me know
    Thanks

    Yes I understand that. Problem is I will be having lot of data so I need good indexes to process it. That's why I am loading into a permanent temp table.
    The issue is I have to load multiple csv files at the same time. So either I have to have multiple external tables defined or I have to single thread.
    So I was wondering if there is a way to replace the csv file with CLOB, that will be very useful.
    Thanks

  • How do I fill by chunks a clob inside a table while XML is generated?

    Hello everybody:
    Needed to generate a single XML file from around 50 million rows, where the XML ouput matches not only row data but another default values for another elements and attributes (not from database but using strings and types with default values). Its generation will be a monthly task, so the process will repeat time by time. For generating that document, currently focus is based on using a batch process relying on Spring Batch, by using a single JDBC query where a join happens between a table and a materialized view (Both are datawarehouses, so it is not expected a change onto the data, and are single, non-partitioned tables). From my point of view, that approach uses: database resources, network resources, disk resources, and processing resources, including the price of making the join, sending to network, creating objects, validating, and making the file, finally wasting too much time generating that XML file. Promisse above that approach is to restart from the last execution point (savepoints) and to process by chunks of data (ResultSets). That processs currently is in development.
    Seen Oracle has XML capabilites, another approach may be delegating the complete generation of that file to the database (Current version in use here is 10g release 2). My current approach is to generate a clob where I will put all the XML throughput and putting it inside a table (My first approach was to put directly into a disk file, unfortunately, isn't possible because internal policies). Considering limitations on memory, processing and disk space, needed to append a single row-as-xml to the clob as soon as it is rendered, and putting the clob inside the field as soon as possible, or putting the clob inside the field, and appending into it as the data is generated (preffered approach); also, considering its a very large operation, needed to make savepoints for each chunk of data processed (each 20,000 rows, as example). Some way I think it may be done is making a temporary clob, filling the clob while getting the rowid, using that rowid as savepoint (No other CRUD operations awaited for the table and the materialized view), and later appending the clob to the clob(s) in table (is there some way for append one clob to another one in table?). Explained all those points, how do I manage the process in order to achieve that goals, using a PL/SQL stored procedure while using built-in functions?.
    Update: I did a small pseudocode where I describe my current approach:
    Defining a cursor;
    Creating a segment clob;
    Creating a temporary clob;
    Defining a chunk size;
    Defining a temp rowid variable;
    Defining a control number to be 0;
    While cursor
         getting rowid and generating next row as xml into a temporary clob (XMLSerialize):
         increment the control number;
         if control number equals 1
    write rowid variable to a control table;
         append the temporary clob to a segment clob;
         if control number is equals than the chunk size defined:
              append the segment clob to the clob inside a control table;
              restart the control number to be 0;
         else
              continue;
    At this time, I'm with doubt about how to append the segment clob directly to the clob inside the control table (I find using that clob as PL/SQL variable would use too much memory and swap).
    Any help shall be apreciated. Thanks in advance.

    Well, of course it's looping. That's what the "while" statement does. What you need is more like this:
    if (tableNumberJTextField.getText().equals("")){
      JOptionPane.showMessageDialog(null, "Table Number cannot be empty","Error", JOptionPane.ERROR_MESSAGE);
      tableNumberJTextField.requestFocusInWindow();
    }and you want this code to be called every time tableNumberJTextField loses focus.

  • Calling a stored procedure with a CLOB as input parameter

    Hello,
    I was unsuccessfully trying to call a stored procedure with a clob as input parameter from my C++ application using occi.
    Anyone got a working example to look at?
    I already checked the thread Invalid OCI handle when creating a Blob which didn't help.
    The problem seems to be that I don't have a lob locator to write my data (xml file) to. I tried creating a temporary clob using the sys.dbms_lob package which only resulted in a major headache on my part...
    I would appreciate any help.
    Kind regards
    Horst
    my environment:
    Visual Studio 2008, C++ application
    Oracle 11g

    To start using a blob you have to insert it into the database and then get it back. Sounds weird but that is how it is. Here is a very simple program to do this:
    #include<occi.h>
    #include <iostream>
    using namespace oracle::occi;
    using namespace std;
    int main()
      try
        Environment *env = Environment::createEnvironment(Environment::OBJECT);
        Connection *conn = env->createConnection("hr","hr","");
        string stmt1 = "insert into blob_tab values (:1) ";
        string stmt2 = "select col1 from blob_tab";
        Blob blob(conn);
        blob.setEmpty(conn);
        Statement *stmtObj = conn->createStatement(stmt1);
        stmtObj->setBlob(1,blob);
        stmtObj->executeUpdate();
        conn->commit();
        Blob blob1(conn);
        Statement *stmtObj2 = conn->createStatement(stmt2);
        ResultSet *rs = stmtObj2->executeQuery();
        while(rs->next())
         blob1 = rs->getBlob(1);
        string stmt3 = "begin my_proc(:1) ;end;";
        Statement *stmtObj3 =  conn->createStatement(stmt3);
        stmtObj3->setBlob(1,blob1);
        stmtObj3->executeUpdate();
      catch (SQLException e)
        cout << e.getMessage();
      /* The tables and procedure are primitive but ok for demo
        create table blob_tab(col1 blob);
        create or replace procedure my_proc(arg in blob)
        as
        begin
         -- just a putline here. you can do other more meaningful operations with the blob here
          dbms_output.put_line('hello');
       end;
    }Hope this helps.
    Thanks,
    Sumit

  • Inserting to a CLOB field in Oracle 8i  Database

    Hi All,
    I am trying to insert a value to a CLOB field in Oracle 8i DB.
    The value gets inserted when the size is less (Up to around 80 Bytes).
    When the size becomes larger the insertion does not take place but no exception is thrown.
    Please see below the code I have written.
    PreparedStatement preparedStatement = null;
              try {
                   connection = getConnection(MMAKeys.WMDS_DATASOURCE);
                   String query = "UPDATE s_mmhp_batch SET MMHP_REPORT_CLOB=(?) WHERE MMHP_BATCH_ID=(?) AND MMHP_USER_ID=(?) AND MMHP_MEMBER_KEY=(?)";
              preparedStatement=connection.prepareStatement(query);
              Reader r = new StringReader(clobReport);
              preparedStatement.setCharacterStream(1, r, clobReport.length());
              oracle.sql.CLOB newClob = oracle.sql.CLOB.createTemporary(connection , false, oracle.sql.CLOB.DURATION_CALL);
              newClob.putString(1,clobReport);
              preparedStatement.setClob(1,newClob);
              preparedStatement.setInt(2,batchId);
              preparedStatement.setString(3,userId);
              preparedStatement.setString(4,memberKey);
              preparedStatement.executeUpdate();
              System.out.println("inside the write to Batch method after executing the query");
              } catch (SQLException exception) {
                   throw new DAOException(
                        "MREDMMSDAO -> writeToTable():SQLException"
                             + exception.getMessage());
              } catch (Exception exception) {
                   throw new DAOException(
                        "MREDMMSDAO -> writeToTable():Exception"
                             + exception.getMessage());
              } finally {
                   closeStatement(preparedStatement);
                   closeConnection(connection);
    I came to know that this method is not supported in Oracle 8i.
    I tried to create an empty CLOB and call the putValue() method.
    But Then, I got an exception stating that the method is not supported.
    Is there any other way to insert a CLOB value to Oracle 8i?
    Please help.
    Thanks in advance,
    Neelambary

    And cursor.callproc('insert_clob_proc', (clob,))
    doesn't work for you?
    PrzemekYes - I should have been more clear in my original post. The callproc function works until we have a value which is over 32K. At values over 32K, we get an error message "ORA-01460: unimplemented or unreasonable conversion requested". I believe this is because we are sending the value as a string and so we would need to figure out how to send as a CLOB in cx_Oracle? Here is some code to use to test if interested...
    Oracle (Oracle Database 10g Release 10.1.0.4.0 - Production):
    CREATE TABLE clob_test (CLOB_FIELD CLOB);
    CREATE OR REPLACE PROCEDURE ins_clob_test (v_clob_field IN CLOB)
    AS
    BEGIN
    INSERT INTO clob_test (clob_field) VALUES (v_clob_field);
    END ins_clob_test;
    Python (2.5):
    conn = cx_Oracle.connect(xhash['oraclelogin'])
    cursor = conn.cursor()
    clob_var = 'Some test data' * 10000
    cursor.callproc('ins_clob_test',(clob_var,))
    conn.commit()
    cursor.close()
    conn.close()
    I should also mention that I am the Oracle developer and not the Python programmer - my knowledge of Python is very limited. I would like the Python programmers to use the procedures (packages) I have created to do their inserts but this situation has caused them to put the SQL directly in their code.
    Thanks again for any assistance you can provide.
    Jason

  • Xmldom.writetoclob hanging forever when writing a domnode to a temp clob

    Hi
    Wondering has anyone come across anything similar (or know a work around)
    1. Basically the the procedure below loads an XML file. (OK)
    2. Removes reference to external dtd, ref was causing and error (OK)
    3. Parses the XML (OK)
    4. Gets a list of the "item" tags (OK) - should be up to 500 item elements in XML
    5. Loops on all elements
    a. writes node to temp clob *(PROBLEM HERE)*
    b. Creates xmltype from clob (OK)
    c. transforms xmltype and assigns to another xmltype (OK)
    d. inserts new xmltype (OK)
    This procedure is used by a threaded os java app to load thousands of files to db.
    It works fine 99% of the time but for some files the procedure is hanging at (5.a : write domnode to clob using xmldom.writetoclob)
    I am absolutely sure the problem is due to the characters in the domnode as all files that have hung on processing contain these bizarre characters,
    the db character set is Unicode AL32UTF8 so it should be able to handle almost anything, saying that, if the it is a prob with the characters then why does
    the loadclobfromfile procedure succeed.
    Developed on Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
    I have no prob rejecting node and continue processing but procedure just hangs and i have to kill the thread on the os.
    Is there a way to
    1. Test for invalid AL32UTF8 chars and skip on error.
    or
    2. Get around the xmldom.writetoclob procedure and create an xmltype from the xmldom.domnode (i tried to convert domnode -> domdocument -> xmltype, no joy)
    or
    Open to suggestions
    PROCEDURE
    PROCEDURE process_blog_xml_file (
          p_file_name     IN   VARCHAR2,
          p_insert_date   IN   VARCHAR2,
          p_dir           IN   VARCHAR2 DEFAULT NULL
       IS
          newsurl        VARCHAR2 (80);
          parser         xmlparser.parser;
          newsxml        xmldom.domdocument;
          titles         xmldom.domnodelist;
          titles_found   NUMBER;
          curnode        xmldom.domnode;
          textchild      xmldom.domnode;
          dest_clob      CLOB;
          l_temp_clob    CLOB;
          src_clob       BFILE         := BFILENAME (g_zip_file_dir, p_file_name);
          dst_offset     NUMBER             := 1;
          src_offset     NUMBER             := 1;
          lang_ctx       NUMBER             := DBMS_LOB.default_lang_ctx;
          warning        NUMBER;
          l_xml          XMLTYPE;
          xsldata        XMLTYPE;
          xmldata        XMLTYPE;
          l_dir          VARCHAR2 (1000);
       BEGIN
          LOG (   'Start Processing file '
               || p_file_name
               || ' from zip '
               || p_insert_date
          IF p_dir IS NULL
          THEN
             SELECT directory_path
               INTO l_dir
               FROM all_directories
              WHERE directory_name = g_zip_file_dir;
          ELSE
             l_dir := p_dir;
          END IF;
          IF g_xsl_clob IS NULL
          THEN
             init_xsl_clob;
          END IF;
          com_polecat_xmldb_utils.set_load_date
                                      (TO_DATE (REPLACE (REPLACE (p_insert_date,
                                                         '.zip',
                                                'DD-MM-YYYY'
          LOG ('ITEM.Loaddate set : ' || com_polecat_xmldb_utils.get_load_date);
          xsldata := XMLTYPE.createxml (g_xsl_clob);
          LOG ('Read xsl file to clob');
          DBMS_LOB.OPEN (src_clob, DBMS_LOB.lob_readonly);
          DBMS_LOB.createtemporary (dest_clob, TRUE);
          DBMS_LOB.loadclobfromfile (dest_lob          => dest_clob,
                                     src_bfile         => src_clob,
                                     amount            => DBMS_LOB.getlength
                                                                         (src_clob),
                                     dest_offset       => dst_offset,
                                     src_offset        => src_offset,
                                     bfile_csid        => NLS_CHARSET_ID
                                                                       ('AL32UTF8'),
                                     lang_context      => lang_ctx,
                                     warning           => warning
          LOG ('Read xml file to clob');
          DBMS_LOB.CLOSE (src_clob);
          parser := xmlparser.newparser;
          dest_clob := REPLACE (dest_clob, g_blog_dtd_remove, '');
          LOG ('Parse xml ');
          xmlparser.parseclob (parser, dest_clob);
          DBMS_LOB.freetemporary (dest_clob);
          newsxml := xmlparser.getdocument (parser);
          xmlparser.freeparser (parser);
          titles := xmldom.getelementsbytagname (newsxml, 'item');
          LOG ('Load  blogs items to ITEM table. ');
          FOR j IN 1 .. xmldom.getlength (titles)
          LOOP
             curnode := xmldom.item (titles, j - 1);
             DBMS_LOB.freetemporary (l_temp_clob);
             DBMS_LOB.createtemporary (l_temp_clob, TRUE);
             LOG ('write node to temp clob ' || j);
             xmldom.writetoclob (curnode, l_temp_clob);                                              <-- Hanging Here
             LOG ('create xml type from clob ' || j);
             l_xml := XMLTYPE.createxml (l_temp_clob);
             LOG ('apply xsl transform to xml ' || j);
             xmldata := l_xml.transform (xsldata);
             LOG ('Insert to item table  ' || j);
             BEGIN
                INSERT INTO item
                     VALUES (xmldata);
             EXCEPTION
                WHEN OTHERS
                THEN
                   LOG ('Error::  ' || SQLERRM);
             END;
          END LOOP;
          xmldom.freedocument (newsxml);
          LOG (   'Finished Processing file '
               || p_file_name
               || ' from zip '
               || p_insert_date
       EXCEPTION
          WHEN OTHERS
          THEN
             LOG (SQLERRM);
       END;note variables starting with g_ are defined in package spec
    Cheers
    Ian
    Edited by: user3604054 on 01-Apr-2010 06:52
    Edited by: user3604054 on 01-Apr-2010 14:57
    Edited by: user3604054 on 01-Apr-2010 15:00
    Edited by: user3604054 on 01-Apr-2010 15:00
    Edited by: user3604054 on 01-Apr-2010 15:05
    Edited by: user3604054 on 01-Apr-2010 15:06

    2. Get around the xmldom.writetoclob procedure and create an xmltype from the xmldom.domnode (i tried to convert domnode -> domdocument -> xmltype, no joy) Which version of Oracle (4 digits)?
    Also look in the FAQ in the upper right for how to use the tag to wrap PL/SQL to retain formatting to make it easier for all to read.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Using sqlldr to load CLOB data from DB2

    I am stuck trying to resolve this problem. I am migrating data from DB2 to Oracle. I used DB2 export to extract the data specifying lobsinfile clause. This created all the CLOB data in one file. So a typical record has a column with a reference to the CLOB data. "OUTFILE.001.lob.0.2880/". where OUTFILE.001.lob is the name specified in the export command and 0 is the starting position in the file and 2880 is the length of the first CLOB.
    When I try to load this data using sqlldr I'm getting a file not found.
    The control file looks something like this:
    clob_1 FILLER char(100),
    "DETAILS" LOBFILE(clob_1) TERMINATED BY EOF,
    I'm using Oracle 11gR2 and DB2 9.7.5
    Your help is appreciated.

    OK..here are additional details. Some names have changed but the idea is the same. Also the sqlldr is executing in the same directory as the data files and the control file
    Primary data file is VOIPCACHE.dat Secondary datafile (file with lob data) is VOIPCACHE.001.lob
    Control Fileload data
    infile 'VOIPCACHE.dat'
    badfile 'VOIPCACHE.bad'
    discardfile 'VOIPCACHE.dsc'
    replace into table VOIPCACHE
    fields terminated by ',' optionally enclosed by '"' TRAILING NULLCOLS
    (KEY1 "rtrim(:KEY1)",
    FIELD8,
    clob_1 FILLER char (100),
    "DATA" LOBFILE(clob_1) TERMINATED BY EOF)
    Snippet from Log file
    IELD7 NEXT * , O(") CHARACTER
    FIELD8 NEXT * , O(") CHARACTER
    CLOB_1 NEXT 100 , O(") CHARACTER
    (FILLER FIELD)
    "DATA" DERIVED * EOF CHARACTER
    Dynamic LOBFILE. Filename in field CLOB_1
    SQL*Loader-502: unable to open data file 'VOIPCACHE.001.lob.0.0/' for field "DATA" table VOIPCACHE
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file 'VOIPCACHE.001.lob.0.47/' for field "DATA" table VOIPCACHE
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file 'VOIPCACHE.001.lob.47.47/' for field "DATA" table VOIPCACHE
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file 'VOIPCACHE.001.lob.94.58/' for field "DATA" table VOIPCACHE
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file 'VOIPCACHE.001.lob.152.58/' for field "DATA" table VOIPCACHE
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file 'VOIPCACHE.001.lob.210.206/' for field "DATA" table VOIPCACHE
    This is repeated for each record
    sqlldr command
    sqlldr userid=${SCHEMA}/${PASSWD}@$ORACLE_SID control=${CTLDIR}/${tbl}.ctl log=${LOGDIR}/${tbl}.log direct=true errors=50
    I dont think the variables are important here
    -EC

  • Problem using CLOB in JDBC (NewLOBAPISample)

    I've just tried to run the JDBC NewLOBAPISample, and everything works fine until I try to insert or update on the CLOB column using any characters other than base ASCII. For example, if I attempt to insert the String "$100", it works just fine, but "£100" results in:
    java.sql.SQLException: No more data to read from socket
    I've experimented with this issue with a much smaller test case of my own, and I've been able to narrow down the problem, as I've outlined below. In all cases, PreparedStatement is used for executing.
    Let's say we have a table named "Test" with one CLOB column named "text".
    The original "official" API for inserting a CLOB using the latest 1.4 JDBC Oracle thin driver is:
    // first insert an "empty CLOB"
    PreparedStatement ps;
    ps = con.prepareStatement("INSERT INTO Test (text) VALUES (empty_clob())");
    ps.executeUpdate();
    // then select the empty CLOB
    con.setAutoCommit(false);
    ps = con.prepareStatement("SELECT text FROM Test FOR UPDATE");
    ResultSet rs = ps.executeQuery();
    rs.next();
    CLOB clob = ((OracleResultSet)rs).getCLOB(1);
    // now write to the CLOB
    Writer out = clob.getCharacterOutputStream();
    out.write(myLongText);
    out.close();
    // we're done
    connection.commit();
    The method that is advertised in NewLOBAPISample, and which I've also seen on the Java Developer Forum, is outlined here:
    // first, create statement to insert
    PreparedStatement ps;
    ps = con.prepareStatement("INSERT INTO Test (text) VALUES (?)");
    // create a temporary CLOB and write to it
    CLOB clob = CLOB.createTemporary(con, true, CLOB.DURATION_SESSION);
    Writer out = clob.getCharacterOutputStream();
    out.write(myLongText);
    // set the CLOB on the PreparedStatement and execute
    ps.setClob(1, clob);
    ps.executeUpdate();
    Now, in the above two cases, if "myLongText" has any characters in it besides standard alpha-numerics, the latter approach will fail, although the former (original) approach will still work. In my case, I need to save Danish characters in the CLOB data. (I can't type these characters in this message, as for some reason they are being converted to "æ å ø" during posting, instead of the letters I've typed on my keyboard.)
    Here is a stack trace when I try the createTemporary approach with a short String that contains one or more non-standard characters:
    java.io.IOException: No more data to read from socket
         at oracle.jdbc.dbaccess.DBError.SQLToIOException(DBError.java:716)
         at oracle.jdbc.driver.OracleClobWriter.flushBuffer(OracleClobWriter.java:270)
         at oracle.jdbc.driver.OracleClobWriter.close(OracleClobWriter.java:232)
    Here's the strack trace when the insert String contains only ONE character that is non-standard:
    java.sql.SQLException: No more data to read from socket
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
         at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:963)
         at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:893)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:369)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
    Any help with this would be MUCH appreciated.
    Thanks,
    David Karlton

    hi David,
    i tried inserting non-alphanumeric chars but still it goes thru fine.
    here is what i did,
    create table testlob ( id number(5),lobcol clob);
    LobInJava.java
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.sql.*;
    class LobInJava
    public static void main(String args[]) throws Exception
    DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@host:1522:ora9idb", "scott", "tiger");
    StringBuffer myLongText = new StringBuffer("nm{H$ñVmZ".length() * 10 );
    for(int i=0 ;i < 1000 ;i++ )
    myLongText.append("nm{H$ñVmZ");
    System.out.println( myLongText.length());
    PreparedStatement ps;
    ps = conn.prepareStatement("INSERT INTO Testlob (id,lobcol) VALUES (2,empty_clob())");
    ps.executeUpdate();
    // then select the empty CLOB
    conn.setAutoCommit(false);
    ps = conn.prepareStatement("SELECT lobcol FROM Testlob where id=2 FOR UPDATE");
    ResultSet rs = ps.executeQuery();
    rs.next();
    CLOB clob = ((OracleResultSet)rs).getCLOB(1);
    // now write to the CLOB
    java.io.Writer out = clob.getCharacterOutputStream();
    out.write(myLongText.toString());
    out.close();
    // we're done
    conn.commit();
    ps.close();
    // first, create statement to insert
    PreparedStatement ps;
    ps = conn.prepareStatement("INSERT INTO Testlob (id,lobcol) VALUES (1,?)");
    // create a temporary CLOB and write to it
    CLOB clob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
    java.io.Writer out = clob.getCharacterOutputStream();
    out.write(myLongText.toString());
    out.close();
    // set the CLOB on the PreparedStatement and execute
    ps.setClob(1, clob);
    ps.executeUpdate();
    ps.close();
    conn.close();
    i am using jdk 1.3 and Oracle9i v9.0.1
    Regards
    Elango.

Maybe you are looking for

  • How do I use p3scan to scan email (Thunderbird) using Clamav? [/b]

    How do I use p3scan to scan email (Thunderbird) using Clamav? I followed this http://p3scan.sourceforge.net/readme.html I searched for hours in Google and in forums looking for a way to get Clamav to scan email using p3Scan? I have three  questions (

  • Error during import of Transport Request in PI 7.1

    Hi Friends, I have installed PI 7.1 server on HP-UX 11.23 with Oracle 10g. After completing all the post-installation activities,I configured CTS for moving objects developed by PI consultant to Quality & Production server. Using CTS I Successfully i

  • Pan and Tilt Camera Recording Duration

    Whenever my Pan and Tilt camera motion sensor goes off, it only records 12 seconds and not the full 30 seconds it should.  My other regular inside camera records motion for the full 30 seconds. Anyone else notice this?  I've looked for a setting but

  • ADS configuration error

    hello Gurus, We wanto to configure ADS but we have some issues that made the ADS doesn't work. our system is SAP ECC 6.0 with EhP 4 on HP-UX - Oracle: The issues are: ==================================================================== Issue 1 RFC co

  • Notes in Interaction Record

    Hi Experts, We are working on CRM 2007 as frontend and ISU as backend. When we Generate an interaction record in the Interaction Center, there is an option of viewing Notes History of any BP. The notes are viewed in a textarea which is declared in th