Sybase 'TEXT' datatype

i am trying to update one of the sybase table which has 'TEXT' datatype for one of the column,
In general how do we query this 'TEXT' datatype in Java i.,e Casting object, Hope this is not a String ?
Any help with the code to retrieve this 'TEXT' field is appreciated,
Thanks
Mathew

I am doing this below ...
public int updateCustomSQL(String headerInfo,String upString,String caseObjId) throws DAOException
        String methodName = "queryUpdateCustomSQL";
        LogMgr.debug(this.getClass(),methodName,"you are in queryUpdateCustomSQL");
        ResultSet rst;
        int rowsReturned = 0;
        LogMgr.debug(this.getClass(), methodName, "query string obtained =" + headerInfo.toString());
        try
            getConnection();
            LogMgr.debug(this.getClass(), methodName, "headerInfo obtained =" + headerInfo);
            PreparedStatement pstmt1 = conn.prepareStatement(
            "SELECT objid,case_history as caseHistory FROM table_case WHERE objid = ?");
            int numericCaseId = new Integer(caseObjId).intValue();
            pstmt1.setInt(1,numericCaseId);
            rst = pstmt1.executeQuery();
            java.sql.Clob clob = null;
            while (rst.next()) {
                //clob = rst.getClob("case_history");
            if(clob != null){
            long length = clob.length();
            LogMgr.debug(this.getClass(),methodName,"length of the clob =" + length);
            clob.setString(length + 1,headerInfo);
            PreparedStatement pstmt2 = conn
                        .prepareStatement("UPDATE table_case SET case_history = ? WHERE objid = ?");
            pstmt2.setClob(1,clob);
            pstmt2.setInt(2,new Integer(caseObjId).intValue());
            rowsReturned = pstmt2.executeUpdate();
        catch (Exception ex)
            LogMgr.debug(this.getClass(), methodName, "exception occurred while updating =" + ex.toString());
        LogMgr.debug(this.getClass(), methodName, "rows returned =" + rowsReturned);
        return rowsReturned;
    }The method com.sybase.jdbc2.jdbc.SybResultSet.getClob(String) is not supported and should not be called.
let me know if i can use any other method instead of getClob()
Thanks
KM

Similar Messages

  • Problem in reading Text (DataType) field.

    Hi
    Its j2sdk1.4.2_05, Tomcat 5.0, and MS SQL server 2000.
    My clients requirement is to store bulk text data into database.
    I created a table with one field of text datatype, I am unable to read the value in the field. If I change the field datatype to varchar, it works. I am reading data using Recordset class Object.
    If my problem is not clear, plz ask me to explain.
    Somewhere I read that this problem is due to Database drivers.
    - Need Your Help.

    Problem resolved
    http://forum.java.sun.com/thread.jspa?threadID=393559
    Mishra

  • Sybase TEXT to Oracle CLOB migration

    Hi All,
    We are doing the migration from Sybase to Oracle 10g.
    Migration steps include..
    1. Creation of Oracle staging area similar structure as Sybase database.
    2. Extract the data through BCP
    3. Import to oracle by Sqlldr (sql loader)
    But we have problem in migrating the SYBASE TEXT column into ORACLE CLOB, as Sqlldr ( sql loader) can load clob column only 500 bytes, unless we are not using LOBFILE clause.
    To use LOBFILE clause, we have to create "Secondary Data file " , But BCP have limitation. It is not supporting custom query to generate CLOB column data file.
    Help me in resolving this issue.

    umesh chandru wrote:
    To use LOBFILE clause, we have to create "Secondary Data file " , But BCP have limitation. It is not supporting custom query to generate CLOB column data file.As I understand it, the core issue is that SQL*Loader wants you to point it to the file containing the CLOB to load. While BCP puts the TEXT/CLOB inline in what is essentially a BCP produced CSV file.
    Now this is a problem. As the CLOB can contain all kinds of formatting, including end-of-CSV-row characters, special characters and so on, it can easily render the format of that CSV file useless.
    SQL*Loader expects a CSV file where the CLOB column contains a filename to load - and where that file contains the contents of the CLOB. With this approach there is no issues dealing with complex file formatting rules in trying to load the CLOB as a part of a CSV file.
    So extract the data in this format - do not restrict yourself to the limitations of BCP. That TEXT column must have a PK column (or two). Write a script that extract the TEXT into a default directory, creating a file that is uniquely identified by the PK.
    Extract the rest of the table's content (using BCP for example) into CSV format. Now you have the data in the two parts (CSV file and separate CLOB files) that SQL*Loader expects. Create the appropriate control file and load the data. This should not be that complex to do.

  • TEXT datatype in Stored Procedure and concat Carriage returns

    Anyone,
    I am trying to create a stored procedure that will allow me to grab a bunch of 255 Char records in a cursor and concatenate them together adding a carriage return after each row.
    Here is pseudo code would look like:
    CREATE OR REPLACE PROCEDURE myproc IS
       CURSOR c1 IS
          SELECT myVARCHAR_255_col
          From mytable
          where criteria = something
          rec c1%ROWTYPE;
          var_my_new_TEXT TEXT;
    BEGIN
       OPEN c1;
       LOOP
          FETCH c1 INTO rec;
          EXIT WHEN c1%NOTFOUND;
            IF rec.myVARCHAR_255_col IS NOT NULL THEN
                var_my_new_TEXT := CONCAT(rec.myVARCHAR255_col, '%char(13)+char(10)%')
            END IF
       END LOOP;
       CLOSE c1;
    END;There is a bit more to code then this but most important issue is how to deal with TEXT datatype? Should/can it be RAW instead. And also how do I get a CARRIAGE RETURN into the body of the column of type TEXT.
    Thanks in advance,
    Miller

    Is there a specific reason for concatenating 255 characters at a time and returning it? This example may be of help.
    SQL> set long 500
    SQL> DESC MYTABLE
    Name                                      Null?    Type
    COL1                                               NUMBER(2)
    COL2                                               LONG
    SQL> select * from mytable;
          COL1
    COL2
             1
    This text is very long This text is very long This text is very long This text i
    s very long This text is very long This text is very long This text is very long
    This text is very long This text is very long This text is very long This text
    is very long This text is very long This text is very long This text is very lon
    g This text is very long This text is very long This text is very long
    SQL> select length(col2) from mytable;
    select length(col2) from mytable
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected NUMBER got LONG
    SQL> select length('This text is very long This text is very long This text is very long This text i
      2  s very long This text is very long This text is very long This text is very long
      3   This text is very long This text is very long This text is very long This text
      4  is very long This text is very long This text is very long This text is very lon
      5  g This text is very long This text is very long This text is very long') from dual;
    LENGTH('THISTEXTISVERYLONGTHISTEXTISVERYLONGTHISTEXTISVERYLONGTHISTEXTISVERYLONG
                                                                                 393
    SQL> R
      1  DECLARE
      2  V_VARIABLE VARCHAR2(4000);
      3  BEGIN
      4  SELECT COL2 INTO V_VARIABLE FROM MYTABLE;
      5  DBMS_OUTPUT.PUT_LINE(SUBSTR(V_VARIABLE,1,255));
      6  DBMS_OUTPUT.PUT_LINE(SUBSTR(V_VARIABLE,256,138));
      7* END;
    This text is very long This text is very long This text is very long This text
    is very long This text is very long This text is very long This text is very
    long This text is very long This text is very long This text is very long This
    text is very long Th
    is text is very long This text is very long This text is very long This text is
    very long This text is very long This text is very long
    PL/SQL procedure successfully completed.
    SQL> SELECT SUBSTR(COL2,1,255) FROM MYTABLE;
    SELECT SUBSTR(COL2,1,255) FROM MYTABLE
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected NUMBER got LONG

  • Reading Sybase Text data in java

    I am trying to read sybase text type column from my java code,
    I appreciate if you any one could help me out on this with code
    thanks
    mathew

    Its an TEXT data type in Sybase , So if i get the
    result set , should i cast it to String or which type
    ?Use the rs.getString() method on a TEXT field.
    D.

  • Synonym for TEXT datatype (migration from postgres)

    Hi,
    we want to migrate a Java application currently using a postgres database to Oracle with the least changes possible. One open question is the use of TEXT datatypes in postgres. We need some trick that the 2 statements in Oracle will work:
    create table COFFEEStext
    (COF_NAME varchar(32),
    SUP_ID int,
    PRICE float,
    SALES text,
    TOTAL float)
    and
    INSERT INTO MONALISA.COFFEESTEXT (
    COF_NAME, SUP_ID, PRICE,
    SALES, TOTAL)
    VALUES ( 'arabica', 1, 2.35,
    'good stuff', 2.35 );
    I tried using a TYPE
    CREATE OR REPLACE TYPE TEXT AS OBJECT (
    COL VARCHAR2 (4000))
    but then the INSERT statement does not work (Needs TEXT('good stuff') and easy select does not work as well).
    I would need to define a synonym TEXT for VARCHAR2(4000) or CLOB (like the datatype REAL and FLOAT are synonyms for some NUMBER(x,y)).
    How can I achieve this without changing the original statements from the Java Application?
    Thanks, Michael

    yes, that's true. But this means to change the code in the Application from datatype TEXT to VARCHAR2.
    This is only an example, in realityt there are dozens of tables with their DDLs spread in the code, so I look for a solution without changing the DML and without changing the DDL of the application if possible!
    The problem is that the same code still runs on postgres and the maintainer is not willing to make great changes everywhere.

  • Querying data in a text datatype in informix

    I currently use HS to query an informix database from oracle. When I do a select * from... which includes a column that is a 'text' datatype, the query fails with :-
    ERROR:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    ORA-02063: preceding line from QA01
    The query will return a certain number of rows and then fail. Any ideas/clues would be much appreciated.
    Thanks

    Do you need the data in the Text column? If not don't select it.
    If you do need the Text column can you cast to a more common type like a varchar?

  • Question about the text datatype in SQL server 2008 r2

    How do I read/write this datatype to/from the database using C#? (visual studio 2010) I am not sure how to handle it.

    Go to Tools/Designers and uncheck this option (see the image). Also, instead of executing the change right away, click on the script option and examine the proposed change. SSMS often makes changes script more difficult than it needs to be.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Problems displaying Sybase Numeric DataTypes

    Hello,
    I have a universe built on top of a Sybase ASE database. The universe contains a Number object which maps to a Sybase Numeric data type with a data type length of 9 and precision of 19.
    When we pull the data form this object onto a webi report the values are being rounded up for example 75000000041611650 instead of 75000000041611700.
    Has anyone encountered this problem before and what was the solution? We are on SAP BI 4.1 SP5
    Thanks..

    Hi ,
    For numeric data Bo will not support data having digits > 15.
    So for correct output convert the numberic data to varchar in universe then use the same object on report.
    Thanks,
    Swapnil

  • Loading Text Datatype account members using rule file

    Hi,
    I have seen some blogs but still having the issue to load the text data type value to my Planning application.
    I am using EPM 11.1.2.1, my planning application has 3 plan type including workforce where i have few attributes of employee(position, role,location etc) free text input using planning webform. so i define those account members as Text data type.
    Note: we don't have ODI or any other tool used for metadata or Data loading.
    I am using **Outline Load utility** to refresh my dimension , do we have a way to load text data type using load rule. i tried using Load rule and getting following error
    \\ Invalid number in data column
    "010"     "1000"     "Budget"     "Draft1"     "Local" "Hsp_InputValue"     "Jan"     "Fong, Siu Lung (Felix), 4"     "FY12"     "sr sft eng"     "testing test"
    please guide me if any other way to load the text data i am getting in the employee file.
    -KK

    You can use the outline load utility to load data, there are examples available at http://download.oracle.com/docs/cd/E17236_01/epm.1112/hp_admin/ch05s02s01.html
    If you are trying to load using an essbase rules file then you will experience issues trying to load text to essbase, essbase only stores a numeric value for planning text data and it is the planning relational database that stores the text value, this is why the outline load utility would be better to use.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Datatypes in MySQL: getInt for integer, what for text?

    As question. We use getInt to retrieve integer types in an MySQL database and getString for varchar types and so forth.What should i use for the text datatype? There is no getText. getString too?
    Second question, I have a table which needs to store paragraphs of text in a row. What should i use? Text or blob? Any special precautions i need to take when using blob? Any special steps to take or is it just like the others?
    Lastly, I also have the following error, i googled it up already, but mainly the results says something about missing jar files.To be honest i dont get them at all. Can anyone please explain it to me? Thanks.
    javax.servlet.ServletException: Wrapper cannot find servlet class Maintenance.Support.AddProdLog or a class it depends on
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         java.lang.Thread.run(Thread.java:619)Thanks.

    The various getters on resultset relate to the form that the data is to be used in the program, rather than the form it's stored on the database. getString is fine for text.
    The choice between clobs and text is often moot, it depends on how big the entries are likely to get, CLOBs are more complicated to use, they are stored separately from the database record and are optimised for quite large blocks. I wouldn't go to CLOBs if I expected the paragraphs to be less than about 2K characters.

  • How to migrate Sybase 12 TEXT column to Oracle XMLType column

    The Migration Workbench does not appear to support mapping a Sybase TEXT column to an Oracle XMLType column. What is the best way to workaround this limitation?
    - Ron

    CLOB?

  • Data of column datatype CLOB is moved to other columns of the same table

    Hi all,
    I have an issue with the tables having a CLOB datatype field.
    When executing a simple query on a table with a column of type CLOB it returns error [POL-2403] value too large for column.
    SQL> desc od_stock_nbcst_notes;
    Name Null? Type
    OD_STOCKID N NUMBER
    NBC_SERVICETYPE N VARCHAR(40)
    LANGUAGECODE N VARCHAR(8)
    AU_USERIDINS Y NUMBER
    INSERTDATE Y DATE
    AU_USERIDUPD Y NUMBER
    MODIFYDATE Y DATE
    VERSION Y SMALLINT(4)
    DBUSERINS Y VARCHAR(120)
    DBUSERUPD Y VARCHAR(120)
    TEXT Y CLOB(2000000000)
    NBC_PROVIDERCODE N VARCHAR(40)
    SQL> select * from od_stock_nbcst_notes;
    [POL-2403] value too large for column
    Checking deeply, some of the rows have got the data of the CLOB column moved in another column of the table.
    When doing select length(nbc_providercode) the length is bigger than the datatype of the field (varchar(40)).
    When doing substr(nbc_providercode,1,40) to see the content of the field, a portion of the Clob data is retrieved.
    SQL> select max(length(nbc_providercode)) from od_stock_nbcst_notes;
    MAX(LENGTH(NBC_PROVIDERCODE))
    162
    Choosing one random record, this is the stored information.
    SQL> select length(nbc_providerCode), text from od_stock_nbcst_notes where length(nbc_providerCode)=52;
    LENGTH(NBC_PROVIDERCODE) | TEXT
    -------------------------+-----------
    52 | poucos me
    SQL> select nbc_providerCode from od_stock_nbcst_notes where length(nbc_providerCode)=52;
    [POL-2403] value too large for column
    SQL> select substr(nbc_providercode,1,40) from od_stock_nbcst_notes where length(nbc_providercode)=52 ;
    SUBSTR(NBC_PROVIDERCODE
    Aproveite e deixe o seu carro no parque
    The content of the field is part of the content of the field text (datatype CLOB, containts an XML)!!!
    The right content of the field must be 'MTS' (retrieved from Central DB).
    The CLOB is being inserted into the Central DB, not into the Client ODB. Data is synchronized from CDB to ODB and the data is reaching the client in a wrong way.
    The issue can be recreated all the time in the same DB, but between different users the "corrupted" records are different.
    Any idea?

    939569 wrote:
    Hello,
    I am using Oracle 11.2, I would like to use SQL to update one column based on values of other rows at the same table. Here are the details:
    create table TB_test (myId number(4), crtTs date, updTs date);
    insert into tb_test(1, to_date('20110101', 'yyyymmdd'), null);
    insert into tb_test(1, to_date('20110201', 'yyyymmdd'), null);
    insert into tb_test(1, to_date('20110301', 'yyyymmdd'), null);
    insert into tb_test(2, to_date('20110901', 'yyyymmdd'), null);
    insert into tb_test(2, to_date('20110902', 'yyyymmdd'), null);
    After running the SQL, I would like have the following result:
    1, 20110101, 20110201
    1, 20110201, 20110301
    1, 20110301, null
    2, 20110901, 20110902
    2, 20110902, null
    Thanks for your suggestion.How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Help:  Not getting all data from text data type

    Hi there
    I have a stored procedure that returns a couple of fields and one of the fields is of datatype TEXT. In my ResultSet, I do not get all the data back that is stored in the TEXT datatype. I have say about 600 charactors in this field, but only 30 charactors are returned. Is there a reason why this is happening and how can I fix it?
    Please help?
    Thanks

    I set that field to have a normal string of about 50 charactors. Namely: "this is a note that is about 49 charactosrs long." (exclude the quotes). And I still got 30 charactors back only.
    I set a shorter text value of 21 charactors and that returned all 21 charactors.
    The text that is usually in this field is:
    "URL=SubsidiaryNarrative.html�BABY_CARE_PRODUCTS=false�AIDS_FOR_PHYSICALLY_DISABLED=false�SPORT_SUPPLEMENTS=true�NATURAL_REMEDIES=false�COSMETICS_FRAGRANCE=false�WOMANS_HEALTH=false�ADDITIONAL_CARDS=No�EXERCISE_ROUTINE=Yes�NUMBER_OF_CHILDREN=0"
    And I got out "URL=SubsidiaryNarrative.html�B"

  • Custom Text Format not available

    Hi,
    I'm trying to specify a column (text datatype) in a report as a hyperlink, but when I navigate to the column properties screen and check the "Overide default data format" box, I only have the two "Plain Text" options in the drop down list. This is driving me crazy as I know I should be able to select HTML, hyperlink, etc, but for some reason they're not present...
    Is there any reason why they may have become unavailable?
    Many thanks,
    Andy

    Turns out the answer is fairly straightforward, though reasonably well hidden...
    metalink3 note 739736.1 gives the answer:
    "Customer wants to set the data format of a column to HTML or hyperlink. To do this they need the privilege "Save System-Wide Column Formats".
    When they don't have this privilege, they are only able to set the data format to "plain text".
    This is the current behaviour of the application and there is no workaround."
    Lo and behold, changing the privilege sorted all the format options...

Maybe you are looking for

  • Select on Cursor in oracle 10g

    Hi Experts , I have a cursor which selects the data from another source. Now I am having a problem with this cursor because i cannot put any where condition as it takes huge time to retrive the data (data's are retrived from views) The "select *  fro

  • RE: (forte-users) When Fort 3.0.M.0?

    Hi Stella How about release 4.0??? -----Original Message----- From: Stephen Szalla [mailto:sszallaforte.com] Sent: Tuesday, January 11, 2000 6:02 AM To: Daniel; Dave Leach; Lista Fort (II) Cc: Manuel Fernndez; Federico Muoz; Jose Ignacio Subject: Re:

  • ITunes 10.4.1.10 is moving my songs as I play them.

    It is set to "keep iTunes media folder organised". My media folder is D:\, and iTunes has created folders d:\music; d:\podcasts; etc. yet is moving songs to new folders d:\'artist'\'album' as they are played. Periodically I "Consolidate files" and "R

  • Pavilion a6412p cannot find seagate hard drives.

    Get disk not found msg at bootup.  Drive hooks up to other PC via USB and is OK.      Cannot boot to update bios via sp40966.exe    Any way to fix bios from bootable CD?

  • Not clickable after hide()

    Hello again, I have created a main stage just with a simple button. After clicking the button, a new page ("slider") appears. It works well. Then I added a close button to this new page to come back to the main stage. I used the click-function sym.$(