NCLOB COLUMN

Hi
I have a problem in my report. In my report
one of the column I am using of data type
NCLOB. I am getting problem in displaying
my report. Can any one suggest me how to
solve this problem
Thank You,
Vijay

What are your objections to the OraclePreparedStatement approach? Are you looking for an approach that doesn't use any of the Oracle derived classes?
Justin
Distributed Database Consulting, Inc.
www.ddbcinc.com/askDDBC

Similar Messages

  • How to create a domain index on NCLOB Column

    hi all,
    My database version is 10.2.0.1.
    Any body know how to create a domain index on nclob column.
    SQL> alter table test add (nclob1   nclob);
    Table altered.
    SQL> CREATE INDEX test_nclob ON test (nclob1) indextype is ctxsys.context
      2  /
    CREATE INDEX test_nclob ON test (nclob1) indextype is ctxsys.context
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-20000: Oracle Text error:
    DRG-10509: invalid text column: NCLOB1
    ORA-06512: at "CTXSYS.DRUE", line 160
    ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 364Regards
    Singh

    Any body know how to create a domain index on nclob columnNot possible per design/documentation:
    The column that you specify must be one of the following types: CHAR, VARCHAR, VARCHAR2, BLOB, CLOB, BFILE, XMLType, or URIType.
    «

  • Need help - select data from NCLOB column problem

    Hi,
    Im having problem retrieving data from NCLOB columns via ODBC. After SQLExecdirect on my SELECT statement call to SQLFetch gives me following error:
    ORA-24806 LOB form mismatch
    I tried following two ways of data retrieval:
    SQLExecDirect(hstmt,(SQLTCHAR*)szSQLStatement,SQL_NTS);
    SQLBindCol(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
    SQLFetch(hstmt);
    OR
    SQLExecDirect(hstmt,(SQLTCHAR*)szSQLStatement,SQL_NTS);
    SQLFetch(hstmt);
    SQLGetData(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
    Both times call to SQLFetch gives me ORA-24806 LOB form mismatch error.
    INSERT and UPDATE for this table works just fine.
    If I change NCLOB type to CLOB works just fine, but I will be storing Unicode data, so using CLOB cant be a solution
    Any ideas appreciated.
    Thanks in advance,
    Vlad
    Server:
    Oracle 9.2 database on Windows 2000 Server
    NLS_LANGUAGE = AMERICAN
    NLS_TERRITORY = AMERICA
    NLS_CHARACTERSET = WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET = AL16UTF16
    Client:
    Unicode C++ application, connects via Oracle 9.2 ODBC driver on Windows XP
    NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252
    CREATE TABLE my_nclob_table (
         id number (10,0) NOT NULL ,
         name nvarchar2 (255) NOT NULL ,
         description nvarchar2 (255) NULL ,
         definition nclob NOT NULL ,
         creation date NOT NULL ,
         lastmodified date NOT NULL ,
         CONSTRAINT PK_cat_pricelist PRIMARY KEY
              id
    #define     nil NULL
    #define     null NULL
    #define     SQL_ERR(__sqlerr__)     (((__sqlerr__) != SQL_SUCCESS) && ((__sqlerr__) != SQL_SUCCESS_WITH_INFO))
    #define     STOP_IF_SQL_ERR(__sqlerr__)                                                                 \
                                                      do                                                       \
                                                           if (SQL_ERR(__sqlerr__)) goto stop_;     \
                                                      } while (false)                                                  
    void eqTestOracleLOBSelect(void)
         SQLHENV henv     = null;
         SQLHDBC hdbc     = null;
         SQLHSTMT hstmt     = null;
         SQLRETURN retcode     = SQL_SUCCESS;
         TCHAR          szSQLStatement[]     = T("select id, name, definition from mynclob_table");
         int               iFetchedRows = 0;
         TCHAR          szMsg[512];
         TCHAR          chBuffer[2049];
         SQLLEN          iDataLen = 0;
         try
              retcode = eqOpenConnectionODBC(_T("myTestDsn"),_T("user"),_T("pwd"),henv,hdbc);
              STOP_IF_SQL_ERR(retcode);
              retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
              STOP_IF_SQL_ERR(retcode);
              retcode = SQLExecDirect(hstmt,(SQLTCHAR*)szSQLStatement,SQL_NTS);
              STOP_IF_SQL_ERR(retcode);
              retcode = SQLBindCol(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
              STOP_IF_SQL_ERR(retcode);
                   while (retcode == SQL_SUCCESS)
                        retcode = SQLFetch(hstmt);
                        if (retcode == SQL_NO_DATA)
                             retcode = SQL_SUCCESS;
                             break;
                        STOP_IF_SQL_ERR(retcode);
                   //     retcode = SQLGetData(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
                   //     STOP_IF_SQL_ERR(retcode);
                        ++iFetchedRows;
         stop_:
              if (SQL_ERR(retcode))
                   MessageBox(null,_T("SQL statement execution error."),_T("Error"),MB_OK);
                   eqShowStatementError(SQL_HANDLE_STMT,hstmt,retcode);
              } else     {
                             _stprintf(szMsg,_T("SQL execution success. Fetched rows: %ld"),iFetchedRows);
                             MessageBox(null,szMsg,_T("Success"),MB_OK);
         catch(...)
              MessageBox(null,_T("Unknown exception in eqTestOracleLOBSelect"),_T("Unknown exception"),MB_OK);
         if (hstmt != null)
              SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
              hstmt = null;
         if (hdbc != nil)
              SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
              hdbc = nil;
         if (henv != nil)
              SQLFreeHandle(SQL_HANDLE_ENV, henv);
              henv = nil;
    SQLRETURN eqOpenConnectionODBC(TCHAR          *szDSN,
                                       TCHAR          *szUser,
                                       TCHAR          *szPassword,
                                       SQLHENV     &henv,
                                       SQLHDBC &hdbc)
         SQLRETURN retcode;
         henv = nil;
         hdbc = nil;
         //Allocate environment handle
         retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
         STOP_IF_SQL_ERR(retcode);
         //Set the ODBC version environment attribute
         retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
         STOP_IF_SQL_ERR(retcode);
         // Allocate connection handle
         retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
         STOP_IF_SQL_ERR(retcode);
         // Set login timeout to 5 seconds.
         SQLSetConnectAttr(hdbc, SQL_LOGIN_TIMEOUT, (void*)5, 0);
         STOP_IF_SQL_ERR(retcode);
         retcode = SQLConnect(hdbc, (SQLTCHAR*)szDSN, SQL_NTS,
                                            (SQLTCHAR*)szUser, SQL_NTS,
                                            (SQLTCHAR*)szPassword, SQL_NTS);
    stop_:
              if (SQL_ERR(retcode))
                   MessageBox(null,_T("Connection Error."),_T("Error"),MB_OK);
                   if (hdbc != nil)
                        eqShowStatementError(SQL_HANDLE_DBC, hdbc,retcode);
                        SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
                        hdbc = nil;
                   if (henv != nil)
                        eqShowStatementError(SQL_HANDLE_ENV, henv,retcode);
                        SQLFreeHandle(SQL_HANDLE_ENV, henv);
                        henv = nil;
              } else MessageBox(null,_T("Connected."),_T("Success"),MB_OK);
         return retcode;
    void eqShowStatementError(SQLSMALLINT chHandleType, SQLHANDLE hHandle,long lErrOrig)
         SQLRETURN          nErr          = SQL_SUCCESS;
         int                    nRecNum = 1;
         SQLTCHAR          szSqlState[6];
         SQLTCHAR          szMsg[SQL_MAX_MESSAGE_LENGTH];
         SQLSMALLINT          nMsgLen;
         SQLINTEGER          nNativeError;
         while ((nErr = SQLGetDiagRec(chHandleType,hHandle,nRecNum,
                                            szSqlState, &nNativeError,
                                            szMsg, sizeof(szMsg), &nMsgLen)) != SQL_NO_DATA)
              szSqlState[5] = 0;
              MessageBox(NULL,(const TCHAR *)szMsg,_T("ODBC Error"),MB_OK);
              ++nRecNum;

    Yes, the 9.2.0.2 driver can be downloaded from OTN. I don't believe it will solve your particular problem, but it will help in general. If you don't grab the latest version, you'll probably have to chack the "Force SQL_WCHAR Support" option in the DSN configuration.
    From the help file
    "The C data type, SQL_C_WCHAR, was added to the ODBC interface to allow applications to specify that an input parameter is encoded as Unicode or to request column data returned as Unicode. The macro SQL_C_TCHAR is useful for applications that need to be built as both Unicode and ANSI. The SQL_C_TCHAR macro compiles as SQL_C_WCHAR for Unicode applications and as SQL_C_CHAR for ANSI applications."
    My first thought would be that your application is not being compiled as Unicode. If you substitute SQL_C_WCHAR for SQL_C_TCHAR when you're dealing with NCLOB columns, I suspect you'll have better luck.
    More help file
    "The SQL data types, SQL_WCHAR, SQL_WVARCHAR, and SQL_WLONGVARCHAR, were added to the ODBC interface to represent columns defined in a table as Unicode. These values are potentially returned from calls to SQLDescribeCol, SQLColAttribute, SQLColumns, and SQLProcedureColumns. In Oracle release 8.1.7.0.0 or 9.0.1.0.0, the Oracle database does not support encoding columns as Unicode. These values would not be returned from the ODBC Drivers for Oracle release 8.1.7.0.0 or for Oracle 9.0.1.0.0 databases.
    In Oracle release 9.2.0.0.0, Unicode encoding was supported for SQL column types NCHAR, NVARCHAR2, and NCLOB. In addition, Unicode encoding was also supported for SQL column types CHAR and VARCHAR2 if the character semantics were specified in the column definition.
    Starting with release 9.2.0.2.0, the ODBC Driver supports these SQL column types and maps NCHAR to the SQL data type SQL_WCHAR, NVARCHAR2 is mapped to SQL_WVARCHAR, and NCLOB is mapped to SQL_WLONGVARCHAR. The SQL CHAR column is mapped to SQL_WCHAR and the VARCHAR2 column is mapped to SQL_WVARCHAR if the character semantics are specified for the column. While the Force SQL_WCHAR Support option is still available in the 9.2.0.2.0 ODBC Driver, it is no longer required for Unicode support."
    Justin

  • Get ORA-00600 when using ExecuteXmlQuery and NCLOB column

    I am using ODP.NET, I got the following exception:
    at Oracle.DataAccess.Client.OracleCommand.XmlHandleException(OracleException
    e)
    at Oracle.DataAccess.Client.OracleCommand.XmlHandleException(OracleException
    e)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlQuery(Boolean wantResult)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlQuery(Boolean wantResult)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlReader()
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlReader()
    at Wikipedia.WikipediaDumpXml.Run() in c:\documents and settings\atali\my doc
    uments\visual studio projects\datacentersolution\wikipedia\wikipediadumpxml.cs:l
    ine 98
    ORA-00600: internal error code, arguments: [kole_t2u], [34], [], [], [], [], [],
    This is my code for retrieving data from database and save it into xml file.
    The "TEXT" column in my select statement is NCLOB. When I leave TEXT column, my query works fine but with it I got exception.
    please, I need help for resolving this issue.
    // Open the connection
    oraConn.Open();
    OracleCommand selectCmd= new OracleCommand( String.Empty, oraConn);
    selectCmd.XmlQueryProperties.RootTag = "Newspaper";
    selectCmd.XmlQueryProperties.RowTag = "Article";
    selectCmd.CommandText= "SELECT ID, TITLE, LANG, TEXT FROM NEWSPAPER_DATA WHERE LANG='en' AND ID=1";
    selectCmd.XmlCommandType=OracleXmlCommandType.Query;
    // execute xml request
    XmlReader newsReader= selectCmd.ExecuteXmlReader();
    // Read
    while(newsReader.Read())
         string xmlfilename = row["TITLE"].ToString();
         using(TextWriter xmlWriter = new StreamWriter( this.DumpDirectory + xmlfilename + ".xml"))
              xmlWriter.Write( newsReader.ReadOuterXml());
    // Close the newsReader
    newsReader.Close();
    oraConn.Close();
    oraConn.Dispose();
    Atali DAOUD

    Mark is correct, you will need to contact support. ORA-600 errors usually require you to patch the database or at least use a workaround to avoid the error.

  • CLOB to NCLOB conversion in Oracle 9i

    Hi,
    I have a table with 8 million records. The table has a clob column that has to be converted in to a nclob column. I have writtten a procedure for the clob to nclob conversion using cursors and the limit functionality.The procedure is given as follows:
    CREATE OR REPLACE PROCEDURE pr_clob_to_nclob is
    TYPE type_dockey IS TABLE OF inf_doc_store.ds_doc_key%TYPE INDEX BY PLS_INTEGER;
    l_type_dockey type_dockey;
    TYPE type_rowid IS TABLE OF VARCHAR(100) INDEX BY PLS_INTEGER;
    l_type_rowid type_rowid;
    L_NUMERRORS NUMBER := 0;
    E_BULKINS_ILCHIS_EXCEPTION EXCEPTION;
    E_BULKINS_ELCHIS_EXCEPTION EXCEPTION;
    E_BULKINS_ILCTXN_EXCEPTION EXCEPTION;
    E_BULKINS_ELCTXN_EXCEPTION EXCEPTION;
    L_ERR_MESSAGE INF_ERROR_LOG.ERROR_TEXT%TYPE;
    L_FILE UTL_FILE.FILE_TYPE;
    CURSOR l_doc_store IS SELECT ds_doc_key,rowid from inf_doc_store where ds_doc_content1 is null;
    BEGIN
    --OPEN l_doc_store FOR 'select ds_doc_key,rowid from inf_doc_store1';
    OPEN l_doc_store;
    LOOP
    FETCH l_doc_store BULK COLLECT INTO l_type_dockey,l_type_rowid LIMIT 5000;
    BEGIN
    FORALL docidx IN 1 .. l_type_dockey.COUNT SAVE EXCEPTIONS
    UPDATE inf_doc_store SET DS_DOC_CONTENT1 = TO_NCLOB(DS_DOC_CONTENT)
    WHERE ROWID =l_type_rowid(docidx);
    EXCEPTION
    WHEN OTHERS THEN
    L_NUMERRORS := SQL%BULK_EXCEPTIONS.COUNT;
    FOR IDX IN 1 .. L_NUMERRORS LOOP
    L_ERR_MESSAGE := 'on bulk insert : Error in Doc key << ' ||
    l_type_dockey(IDX) || ' >> index << ' ||
    SQL%BULK_EXCEPTIONS(IDX)
    .ERROR_INDEX || ' IS ' ||
    SQLERRM(0 - SQL%BULK_EXCEPTIONS(IDX)
    .ERROR_CODE) || ' >>';
    PKG_INF_COMMON.PR_LOG_ERROR('CLOB_TO_NCLOB Migration',
    'inf_doc_store',
    L_ERR_MESSAGE,
    'NA');
    PKG_INF_COMMON.PR_UTL_PUTLINE(L_FILE,
    L_ERR_MESSAGE,
    'NA');
    END LOOP;
    PKG_INF_COMMON.PR_UTL_FCLOSE(L_FILE, 'inf_doc_store_updation');
    RAISE E_BULKINS_ILCHIS_EXCEPTION;
    END;
    COMMIT;
    EXIT WHEN l_doc_store%NOTFOUND;
    END LOOP;
    CLOSE l_doc_store;
    END pr_clob_to_nclob;
    The table in which the clob column is to be converted is inf_doc_header.
    The above procedure runs successfully but takes more than 48 hours to convert all the records.
    Can any body suggest me a way to optimise the procedure?
    Regards,
    Siddarth

    Hi,
    I have a table with 8 million records. The table has a clob column that has to be converted in to a nclob column. I have writtten a procedure for the clob to nclob conversion using cursors and the limit functionality.The procedure is given as follows:
    CREATE OR REPLACE PROCEDURE pr_clob_to_nclob is
    TYPE type_dockey IS TABLE OF inf_doc_store.ds_doc_key%TYPE INDEX BY PLS_INTEGER;
    l_type_dockey type_dockey;
    TYPE type_rowid IS TABLE OF VARCHAR(100) INDEX BY PLS_INTEGER;
    l_type_rowid type_rowid;
    L_NUMERRORS NUMBER := 0;
    E_BULKINS_ILCHIS_EXCEPTION EXCEPTION;
    E_BULKINS_ELCHIS_EXCEPTION EXCEPTION;
    E_BULKINS_ILCTXN_EXCEPTION EXCEPTION;
    E_BULKINS_ELCTXN_EXCEPTION EXCEPTION;
    L_ERR_MESSAGE INF_ERROR_LOG.ERROR_TEXT%TYPE;
    L_FILE UTL_FILE.FILE_TYPE;
    CURSOR l_doc_store IS SELECT ds_doc_key,rowid from inf_doc_store where ds_doc_content1 is null;
    BEGIN
    --OPEN l_doc_store FOR 'select ds_doc_key,rowid from inf_doc_store1';
    OPEN l_doc_store;
    LOOP
    FETCH l_doc_store BULK COLLECT INTO l_type_dockey,l_type_rowid LIMIT 5000;
    BEGIN
    FORALL docidx IN 1 .. l_type_dockey.COUNT SAVE EXCEPTIONS
    UPDATE inf_doc_store SET DS_DOC_CONTENT1 = TO_NCLOB(DS_DOC_CONTENT)
    WHERE ROWID =l_type_rowid(docidx);
    EXCEPTION
    WHEN OTHERS THEN
    L_NUMERRORS := SQL%BULK_EXCEPTIONS.COUNT;
    FOR IDX IN 1 .. L_NUMERRORS LOOP
    L_ERR_MESSAGE := 'on bulk insert : Error in Doc key << ' ||
    l_type_dockey(IDX) || ' >> index << ' ||
    SQL%BULK_EXCEPTIONS(IDX)
    .ERROR_INDEX || ' IS ' ||
    SQLERRM(0 - SQL%BULK_EXCEPTIONS(IDX)
    .ERROR_CODE) || ' >>';
    PKG_INF_COMMON.PR_LOG_ERROR('CLOB_TO_NCLOB Migration',
    'inf_doc_store',
    L_ERR_MESSAGE,
    'NA');
    PKG_INF_COMMON.PR_UTL_PUTLINE(L_FILE,
    L_ERR_MESSAGE,
    'NA');
    END LOOP;
    PKG_INF_COMMON.PR_UTL_FCLOSE(L_FILE, 'inf_doc_store_updation');
    RAISE E_BULKINS_ILCHIS_EXCEPTION;
    END;
    COMMIT;
    EXIT WHEN l_doc_store%NOTFOUND;
    END LOOP;
    CLOSE l_doc_store;
    END pr_clob_to_nclob;
    The table in which the clob column is to be converted is inf_doc_header.
    The above procedure runs successfully but takes more than 48 hours to convert all the records.
    Can any body suggest me a way to optimise the procedure?
    Regards,
    Siddarth

  • Full Text Indexing for Arabic using NVARCHAR and NCLOB?

    We have an Arabic database that uses UTF-16 and NVARCHAR and NCLOB column types.
    The full text indexing of Oracle gives an error saying that it does not support these column types.
    Can you please help by telling us what is the workaround for this?

    The only workarounds are:
    1) Store data in VARCHAR2 and CLOB in a AL32UTF8 database, or
    2) Use BLOB for document storage - unfortunately, this may be expensive for a lot of short text
    -- Sergiusz

  • NCLOB support in OCI8

    I'm currently developing a multilingual website with PHP and Oracle and I'm facing a problem concerning NCLOBs. I know that the "The Underground PHP and Oracle Manual" states that all NCHAR-related data types are not supported. However, apparently NCHAR and NVARCHAR2 do work just fine. So I'm wondering how up to date this information is. Anyway, the problem is that I can't write to NCLOB columns via OCI-Lob::write. The call succeeds and returns the number of chars written, but the column stays empty. Is there any hope I can get this to work? If not, is there another library that I could use to connect PHP with the database that supports NCLOBs?
    I'm using the following code:
    $s = oci_parse($dbc, "INSERT INTO trouble (xnclob) values (EMPTY_CLOB()) returning xnclob into :lob");
    $lob = oci_new_descriptor($dbc);
    oci_bind_by_name($s, "lob", $lob, -1, SQLT_CLOB);
    $result = oci_execute($s, OCI_NO_AUTO_COMMIT);
    $lob->write($data); // Succeeds, but column stays empty!
    oci_commit($dbc);
    The code seems to work fine with BLOBs and normal CLOBs. Out test server is running the following software:
    CentOS 6.4 64-Bit
    PHP 5.3.3
    OCI8 1.4.9
    Oracle 11g Release 2 XE
    Thanks for the help in advance.
    Best regards
    David

    The choices are (1) use UTF8 as the base character set and don't use
    NCHAR/NVARCHAR/NCLOB or (2) submit patches to PHP OCI8 to add NCLOB
    support or (3) use another language.
    I wouldn't trust NCHAR/NVARCHAR to work consistently in PHP OCI8,
    despite (or because of) there being automatic mapping to non N* types
    in some cases.
    I know you might be using XE 11.2 just for testing. However, if you
    are targeting that edition for production use, the character set is
    AL32UTF8 so there isn't a direct need to use NCHAR/NVARCHAR/NCLOB.
    From Choosing a Character Set:
    "Oracle recommends using SQL CHAR, VARCHAR2, and CLOB data types in [a] AL32UTF8
    database to store Unicode character data. Use of SQL NCHAR,NVARCHAR2, and NCLOB
    should be considered only if you must use a database whose database character set
    is not AL32UTF8."
    Regarding CentOS, I would recommend using Oracle Linux which is free
    to download & install, has free patches etc, has a faster kernel than
    RHEL available, and is the OS we test the DB on.  You can get it from
    http://public-yum.oracle.com/
    If possible target a newer version of PHP.  PHP 5.3 is in security
    fix-only mode, and this will end soon.  I would recommend building
    your own PHP, or using Zend Server (either the free or paid edition).
    For new development, use PHP 5.5.

  • Loading UTF-8 String into CLOB column

    Hello!
    I am trying to load UTF-8 encoded strings into a CLOB column in an Oracle 9i database from VB.Net using ODP.Net (9.2.0.414).
    The strings are XML snippets (Microsoft WordML to be precise). Each corresponds to a record which already exists in the database, therefore I do an update to add the UTF-8 string.
    Some of the XML snippets contain characters which once inserted look like upside down question marks (characters represented by 0x92 and 0x96 for example end up as 0xBF once in the database).
    Setting breakpoints in Visual Studio, I can watch the string values in the 'Locals' window and they appear correct (in fact I can copy from the 'Locals' window and using a tool such as TOAD can paste the strings into the database successfully). Pasting through TOAD, the characters are properly represented in the database (ie 0x92 is 0x92).
    I've tried a number of approaches with no luck.
    Any advice/suggestion are most welcome. Thanks!
    Here is my code:
    strConnectionString = ConfigurationSettings.AppSettings.Item("ConnectionString")
    strComponentsTable = ConfigurationSettings.AppSettings.Item("ComponentsTable")
    objConnection = New OracleConnection(strConnectionString)
    objCommand = objConnection.CreateCommand()
    objCommand.CommandType = CommandType.Text
    objCommand.CommandText = "UPDATE " & strComponentsTable & " SET TEMPLATE_COMPONENT_CONTENT = :p_content WHERE TEMPLATE_COMPONENT_ID = :p_id"
    objConnection.Open()
    For Each strId In objComponents.Keys
    strContent = objComponents.Item(strId)
    objCommand.Parameters.Clear()
    objParameter = objCommand.CreateParameter()
    objParameter.ParameterName = "p_content"
    objParameter.OracleDbType = OracleDbType.Clob
    objParameter.Direction = ParameterDirection.Input
    objParameter.Value = strContent
    objCommand.Parameters.Add(objParameter)
    objParameter = objCommand.CreateParameter()
    objParameter.ParameterName = "p_id"
    objParameter.OracleDbType = OracleDbType.Int32
    objParameter.Direction = ParameterDirection.Input
    objParameter.Value = CInt(strId)
    objCommand.Parameters.Add(objParameter)
    intResult = objCommand.ExecuteNonQuery()
    Next

    Some further research has revealed the following:
    Two of the characters I provided as examples of not being stored properly in the database are (in Unicode) U+2013 and U=2019. These characters, encoded as UTF-8 should each be three bytes (0xE2 80 93 and 0xE2 80 99 respectively). Sent via VB.Net and ODP.Net they both end up in the database as one byte each (0xBF). Copy and Pasted via TOAD they end up as one byte each (0x92 and 0x96 respectively).
    The NLS settings on the server side are:
    NLS_CHARACTERSET = WE8ISO8859P1
    NLS_NCHAR_CHARACTERSET = AL16UTF16
    I have tried using both CLOB and NCLOB column with the results being identical.
    Not sure what else to try...

  • UTF-8 encoding

    Hi,
    I'm having trouble with parsing XML stored in NCLOB column using UTF-8 encoding.
    Here is what I'm running:
    Windows NT 4.0 Server
    Oracle 8i (8.1.5) EE
    JDeveloper 3.0, JDK 1.1.8
    Oracle XML Parser v2 (2.0.2.5?)
    The following XML sample that I loaded into the dabase contains two UTF-8 multi-byte characters:
    <?xml version="1.0" encoding="UTF-8"?>
    <G><A>GBotingen, BrC<ck_W</A></G>
    G(0xc2, 0x82)otingen, Br(0xc3, 0xbc)ck_W
    If I'm not mistaken, both multibyte characters are valid UTF-8 encodings and they are defined in ISO-8859-1 as:
    0xC2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
    0xFC LATIN SMALL LETTER U WITH DIAERESIS
    I wrote a Java stored function that uses the default connection object to connect to the database, runs a Select query, gets the OracleResultSet, calls the getCLOB method and calls the getAsciiStream() method on the CLOB object. Then it executes the following piece of code to get the XML into a DOM object:
    DOMParser parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    parser.parse(istr); // istr getAsciiStream
    XMLDocument xmldoc = parser.getDocument();
    Before the stored function can do other thinks, this code seems to throw an exception complaining that the above XML contains "Invalid UTF8 encoding".
    Now, when I remove the first mutlibyte character (0xc2, 0x82) from the XML, it parses fine.
    Also, when I do not remove this character, but connect via the jdbc racle:thin driver (note that now I'm not running inside the RDBMS as stored function anymore) the XML is parsed with no problem and I can do what ever I want with the XMLDocument. Note that I loaded the sample XML into the database using the thin jdbc driver.
    One more thing, I tried two database configurations with WE8ISO8859P1/WE8ISO8859P1 and WE8ISO8859P1/UTF8 and both showed the same problem.
    I'll appreciate any help with this issue. Thanks...

    I inserted the document once by using the oci8 driver and once by using the thin driver. Then I used the DBMS_LOB package to look at the individual characters and convert those characters using the ASCII function.
    It looks like that when I inserted the document using the OCI8 driver, they got converted into a pair of 191 (0xbf) characters. However, when I used the thin driver they ended up being stored as 195 (0xc3) and 130 (0x82).
    So it looks like that the OCI8 driver is corrupting the individual characters and that if the characters is not corrupted they cause a following exception to be thrown:
    Error: 440, SQL execution error, ORA-29532: Java call terminated by uncaught Java exception: java.io.UTFDataFormatException: Invalid UTF8 encoding. ORA-06512: at "SYSTEM.GETWITHSTYLE", line 0 ORA-06512: at line 1
    Note that my other example of mutli-byte character (C<) also gets corrupted by the OCI8 driver but does not cause the above exception to be thrown if it's inserted via the thin driver.
    null

  • Large text with national caracters and full text index

    Hello,
    I have some large portion of string to index. So of these strings contains national characters so I have stored it into a NCLOB column. I would like to put a full text index of this column but I see that it is not possible for NCLOB column.
    Does anybody have the problem as me? If yes, how did you proceed? Could the XMLType be a solution ?
    Thanks for your help.
    Kind regards,
    Fred

    Hi Fred,
    "I do not think that I can manage all these characters with only one character set."
    Sure you can. The main reason for using the NLS characterset has nothing to do with whether you can/cannot support multiple languages with your database charset. It is there primarily in case your db characterset is not some unicode/multibyte charset and you need to add support for it while maintaining your original db charset. A secondary reason is for certain performance considerations, but that is for specific application architectures and doesn't seem to be the case here. One of my apps supports virtually every language on Earth - not using the 'N''s'. I'm using AL32UTF8 - it is up to Unicode 4.0 in version 10gR2 of the db.
    Choose a unicode character set for your db and you're fine unless you have some overwhelming reason why you are unable to do so. Any Text index will work for you and your problem is solved (and ctxxpath and context index will both work - just compare your requirements to the functionality provided by the index type).
    Further reading:
    Here's an OracleMag article from last Fall -
    http://www.oracle.com/technology/oramag/oracle/05-sep/o55global.html
    Here's a white paper -
    http://www.oracle.com/technology/tech/globalization/pdf/TWP_AppDev_Unicode_10gR2.pdf
    Thanks,
    Ron

  • Trouble with UTF-8 and PHP-OCI

    Hi there!
    I'm having some serious trouble with UTF-8. I just tried to insert a lambda into an NCLOB column in one of my databases and it was converted to an inverted question mark. I have verified that the string reaches my PHP script correctly encoded. Also selecting RAWTOHEX(column) in SQL Developer shows, that the inverted question mark is already stored in the column. So the problem must be somewhere between PHP-OCI and the database. Inserting a lambda via SQL developer works. I can also correctly fetch it via PHP.
    I'm using the latest PHP-OCI (2.0.8). v$version says "Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production".
    The database is fairly old and uses WE8MSWIN1252 as the character set and AL16UTF16 as the NCHAR character set. Hence I'm using NCLOB instead of CLOB. However, I connect to the database with AL32UTF8, since my app is running in UTF-8. I was under the impression that this would result in an automatic conversion from UTF-8 to UTF-16 when inserting into NCLOB columns, but apperently this is not the case. It looks like there is some sort of double conversion, first UTF-8 to WE8MSWIN1252 and then to UTF-16, because some non-ASCII characters like ä (a umlaut) get correctly converted from UTF-8 to UTF-16.
    Any ideas? I'm at a loss here. Thanks in advance.

    PHP OCI8 doesn't support NCLOB or NVARCHAR2.
    See NCLOB support in OCI8

  • ORACLE 9I 에서의 NATIONAL CHARACTERSET(AL16UTF16)

    제품 : ORACLE SERVER
    작성날짜 : 2002-05-27
    ORACLE 9I 에서의 NATIONAL CHARACTERSET("AL16UTF16" )
    ===================================================
    Description
    ~~~~~~~~~~~
    Oracle 9i 에서는 NCHAR(National Character Set) 를 UTF8 와 AL16UTF16 만을 지원한다.
    AL16UTF16 는 Oracle 9i 에서 새롭게 소개된 character set으로 16 bit unicode data 이다.
    그러므로 기존에 다양한 NCHAR 를 설정한 Oracle 8/8i 의 client에서 Oracle 9i 로 connect시
    지원하지 않는 NCHAR 로 문제가 야기될 수 있다.
    National Language Support character 이 지원하는 datatypes 은 다음과 같다.
    National Language Support character datatypes:
    NCHAR
    NVARCHAR2
    NCLOB.
    Oracle 9i 에서는 default NATIONAL CHARACTER SET 이 AL16UTF16 으로 설정되어 DB가 생성된다.
    8/8i 에서는 지원하지 않는 character set 이므로 character set이 깨지는것을 막고 data가 정상적으로
    저장되게 하기 위해서는 8/8i 의 client side에 NLS patch 를 적용해야만 한다.
    (NCHAR, NVARCHAR2 or NCLOB column data 사용이 가능하게 된다.)
    다음과 같은 경우 문제 발생
    ~~~~~~~~~~~~~~~~~~~~~~~~
    - 8/8i 과 9i 연동해서 datatype을 NCHAR, NVARCHAR2 or NCLOB 를 사용하고자 할 경우
    - Oracle 8/8i client 에서 9i의 NCHAR, NVARCHAR2 or NCLOB data 를 수정하거나 읽고자 할 경우
    Possible Symptoms
    ~~~~~~~~~~~~~~~~~
    a. Client 8/8i 에서 Oracle 9i 에 접속하여 NCHAR, NVARCHAR2 or NCLOB column 의 data를
    access 하고자 할때 다음 처럼 quer가 수행된다.
    eg: Assume a table NC defined as ( A VARCHAR2(10), B NVARCHAR2(100) )
    From an Oracle8 client running WE8DEC:
    SQL> insert into nc values('hello','hello');
    SQL> select * from nc;
    A B
    hello h e l l o
    ^^ Note the extra spaces between characters
    b. db link 를 이용하여 data 를 access 하고자 할때 ORA-24365 에러 발생
    SQL> select * from [email protected];
    ERROR at line 1:
    ORA-02068: following severe error from V9.WORLD
    ORA-24365: error in character conversion
    Workarounds
    ~~~~~~~~~~~
    새로운 character set 에 대한 이해가 가능토록 Patch 적용을 수행하거나
    NATIONAL CHARACTER SET 으로 UTF8을 사용하는 것이다.
    Patch 적용후에 query를 수행한 결과
    Eg:
    SQL> select convert(b,'WE8DEC') from nc;
    CONVERT(B,'WE8DEC')
    hello
    만약 Oracle 8/8i 를 Oracle 9i로 migratio 을 해야 한다면 다음 단계를 따라야 한다.
    Migration Path
    ~~~~~~~~~~~
    Oracle8/8i에서 NCAHR 를 사용하는 경우 우선 Oracle server 8.2로 다음 단계처럼
    migration 을 수행한다.(character set이 UTF8 인경우 제외)
    1) NCHAR, NVARCHAR, or NCLOB column이 포함된 table에 대해 모두 export를 한다.
    2) NCHAR, NVARCHAR, or NCLOB column이 포함된 table을 모두 drop 한다.
    3) Oracle8 Migration Utility를 이용하여 Oracle 8.2 로 upgrade를 한다.
    4) export 받은 table을 모두 import 한다.
    다음은 patch 에 대한 정보이다.
    Patches
    ~~~~~~~
    Oracle intends to make patches available for 8.1.7 and 8.0.6
    on all platforms where these releases are available. These patches
    can be used with any patch set release on that platform.
    Eg: The patch for 8.0.6 on HPUX 32 bit can be used with 8.0.6.0, 8.0.6.1,
    8.0.6.2 or 8.0.6.3.
    The patches must be installed in the ORACLE_HOME of any tools being
    used to connect to the Oracle9i database, and in the ORACLE_HOME of
    any Oracle8/8i server which uses database links to an Oracle9i instance.
    Oracle does not intend to make patches available for any other releases
    unless explicitly requested to do so. Any such request would need to be
    made whilst the target release is still in its "Error Correction Support"
    period. (Note : 8.1.6 will be desupported from October 2001)
    References
    ~~~~~~~~~~
    Note. 140014.1
    Notification of desupport of other NCHAR character sets besides UTF8 and AL16UTF16 <Note:102633.1>
    The base bug for tracking patches for this issue is <Bug:1634613>

    This is embarrasing, I feel just like a fool, I was reading Oracle 9i R2 documentation instead of Oracle 9i R1 documentation, that's why I was using "EXTENT MANAGEMENT LOCAL". Definitely I need get some sleep.
    You are right, I removed "EXTENT MANAGEMENT LOCAL" and additionally I changed "DATAFILE" for "TEMPFILE" at the specification of default temporary tablespace and the DB was successfully created.
    Thanks a lot!

  • Inconsistent datatypes problem (ORA-00932)

    Hi all,
    Given the following two tables , located in two different schemas :
    CREATE TABLE schema1.national_desc
    (     ENT CHAR(18 CHAR),
         COD_MAJ CHAR(1 CHAR),
         SID_DESC_COD_ADD NUMBER(8,0),
         ID_LANG CHAR(2 CHAR) DEFAULT 'FR',
         SID_COD_ADD NUMBER(8,0),
         ID_TYP_COD_ADD CHAR(1 CHAR),
         COD_ADD CHAR(3 CHAR),
         L_DESC NCLOB,
         DAT_MAJ DATE DEFAULT SYSDATE,
         DAT_MAD DATE,
         LL_DESC NCLOB,
         CONSTRAINT pk_national_desc PRIMARY KEY (SID_DESC_COD_ADD, ID_LANG)
    CREATE TABLE schema2.european_desc
    (     ENT CHAR(18 CHAR),
         COD_MAJ CHAR(1 CHAR),
         SID_DESC_COD_ADD NUMBER(8,0),
         ID_LANG CHAR(2 CHAR),
         SID_COD_ADD NUMBER(8,0),
         ID_TYP_COD_ADD CHAR(1 CHAR),
         COD_ADD CHAR(3 CHAR),
         L_DESC NCLOB,
         CONSTRAINT pk_european_desc PRIMARY KEY (SID_DESC_COD_ADD, ID_LANG)
    )we try this query :
    SELECT
    '1' origine,
    sid_cod_add,
    l_desc desc_cod_add,
    TO_CHAR (dat_mad, 'dd/mm/yyyy') dat_mad,
    TO_CHAR (dat_maj, 'dd/mm/yyyy') dat_maj
    FROM
    N24510
    WHERE
    dat_maj > '01/01/2010'
    AND id_lang='FR'
    UNION
    SELECT
    '0',
    sid_cod_add,
    l_desc,
    NULL,
    NULL
    FROM
    F24510
    where
    id_lang='FR'and Oracle complains with this error : ORA-00932.
    We have tried to "cast" the L_DESC column with TO_CHAR but some column value exceeds 4000 chars.
    Casting with TO_CLOB give the same first error.
    Any idea ?
    Stephan
    Oracle 10Gr2 - 10.2.0.3.0
    Linux 64bits

    Hi ,
    Thanks for your reply. We have finally find the problem :)
    Instead of UNION, we perform an UNION ALL. With UNION Oracle had to check unicity
    between rows containing NCLOB columns...
    Hopefully, in our case UNION ALL does the trick !
    Stephan

  • Cloning Oracle database 8.1.7.0

    Hi,
    We have upgraded our database from Oracle 8.1.7.0 to Oracle 8.1.7.4 , applied terminal patch set(Oracle 8.1.7.4) , as we have to upgrade it further to 10g rel2.
    After upgrading to 8.1.7.4, we required to apply the database fixes against the mentioned bugs.
    One of the Serious Server Issues is mentioned below after upgradation,
    Changing the Database Character Set can corrupt LOBs ( Note 118242.1)
    we have gone through the note mentioned above,
    In that one of the point regarding cloning is as below :
    If the database version is 8.1.7.3 or 8.1.7.4:
    - install non-patched Oracle 8.1.7.0.0 from the original CD-Pack
    into a separate ORACLE_HOME
    - take a full backup of the database
    - create a clone database from this backup using the 8.1.7.0.0
    version of the RDBMS software -- contact Oracle Support
    if you need help; the clone should open with the older
    non-patched software without any downgrade steps
    - export all non-system tables with non-NULL CLOB and/or NCLOB columns
    from the clone; do not forget to set NLS_LANG environment
    variable to the database character set for the export session;
    you can use the 8.1.7.0.0 version of the Export utility
    - truncate the exported tables but in the original database
    - reimport the exported tables into the original database;
    do not forget to set NLS_LANG environment variable to
    the database character set for the import session;
    use the Import utility from the original ORACLE_HOME
    - drop the clone database - do not use the clone for other
    purposes as it is not supported to run a patched database
    with the non-patched software.
    How to Clone the Oracle database (8.1.7.0) on windows OS ?
    From where i would get the Cloning steps to accomplish the above steps on Windows OS ?
    With Regards

    Hi,
    Please, refer to Steve Rea's Web for DB Cloning examples:
    For Cloning using Datafile copy:
    http://uaex.edu/srea/Cloning_a_Database_using_Datafile_Copy.htm
    For Cloning using Export/Import:
    http://uaex.edu/srea/Cloning_a_Database_using_Export_Import.htm
    Cheers:
    Francisco Munoz Alvarez
    www.oraclenz.com

  • Use of nls_length_semantics parameter

    What is the use of nls_length_semantics pratamter?
    And what is the difference if setting nls_length_semantics='CHAR' instead of 'BYTE'
    Thanks in advance

    NLS_LENGTH_SEMANTICS enables you to create CHAR and VARCHAR2 columns using either byte or character length semantics. Existing columns are not affected.
    NCHAR, NVARCHAR2, CLOB, and NCLOB columns are always character-based. You may be required to use byte semantics in order to maintain compatibility with existing applications.
    NLS_LENGTH_SEMANTICS does not apply to tables in SYS and SYSTEM. The data dictionary always uses byte semantics.
    http://www.oratransplant.nl/2005/11/

Maybe you are looking for

  • How to get LastModified time of a file in repository(in weblogic8 and Compa

    hi , my task is that i have to compare modified time of 2 file.one is in file system other is database file . which is most recently updated (which is newer). details : we have to check that which file is most recently updated .if database 's file is

  • Question on pfile in RAC environment

    DB version:10GR2,11GR2 OS Version: Solaris, AIX, Linux Lets say i have a 2 node RAC environment. DB name is : jerry I have a datagroup called DATA7 Node1's pfile would only contain a single like as shown below $ cat initjerry1.ora SPFILE='+DATA7/jerr

  • ICloud Voicemail Management?

    I use Google Voice to manage my voicemail, as I find it much more useful than the Visual Voicemail built into the phone application. Why won't Apple develop a similar solution to manage and store voicemail on iCloud, as well as integrate this into th

  • Why iphone get on and off when battery is good

    why iphone get on and off when battery is good

  • Java aplication in the internet

    Hi I've wrote a java aplication (about 30 clases) and I need to make an internet site that the user will be able to activate my program from it. what should I do? when running the main class a GUI is showed and I want the user to "play" with the GUI.