How to insert a very long string into a column of datatype 'LONG'

Can anyone please tell me how can I insert a very long string into a column of datatype 'LONG'?
I get the error, ORA-01704: string literal too long when I try to insert the value into the table.
Since it is an old database, I cannot change the datatype of the column. And I see that the this column already contains strings which are very long.
I know this can be done using bind variables but dont know how to use it in a simple query.
Also is there any other way to do it?

Hello,
To preserve formatting in this forum, please enclose your code output between \ tags. And when executing you code as a pl/sql or sql script
include following lineset define off;
     Your code or output goes here
  \Regards
OrionNet                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How to insert 4K of XML data into XMLType column?

    I use OCCI and our Oracle version is 9.2.0.1.0. I have successfully been able to insert xml data (any size) into a clob column using "insert into...values(.., empty_clob()) returning c1 into :3"; and then using Statement::GetClob() to acquire a reference to the internal clob and populate it. I cannot seem to be able to do the same when the column type is of XMLType.
    I could not find a single sample code which demonstrates inserting into a table with a XMLType column. Using SetDataBuffer(OCCI_SQLT_STR) with data over 4000 bytes does not work.
    I'd greatly appreciate any feedback.

    Pretty sure this was a bug in the base 9.2 release which was fixed in a patch drop. Try 9.2.0.6 or later.

  • In report layout, can format a long string display as Column mode?

    Hi,
    Just want to check in report builder any way can format a long string into a column mode?
    Example: I have a field to hold 8000 character, and would like to print
    30 character in each line, when reach 50 line, then print in column i/o to print next page?
    Any idea ? Thanks a lot if you can share your experience with me.
    best Regards,
    Klnghau

    hi let say your field name is x
    then if your want it word wrap then it's simple just get one field and make it's vertical
    elasticity variable. and asign the field to it..
    but if you want your field to be displayed as
    first colunm and then beside continuation of that column but in 2nd one...
    then create 2 formula columns make your field legth been distributed half in each.
    so cf_1 is:
    decalre
    t varchar2(1510);
    begin
    if length(:x) > 1500
    t := substr(x, 1, 1500); -- as 30 x 50 = 1500
    else
    t := :x;
    end if;
    return t;
    so cf_2 is:
    decalre
    t varchar2(1510);
    begin
    if length(:x) > 1500
    t := substr(x, 1500, length(:x)-1500); -- as 30 x 50 = 1500
    else
    t := '';
    end if;
    return t;
    and then in design view
    field1 field2
    for field1 source is cf_1 and
    for field2 source is cf_2
    that's all
    Enjoy Oracle...

  • ALV grid - how to break a long string into several lines?

    I have a ALV grid, where one of the fields contains a textstring that is typically 100 characters long.
    Is it possible to break this long string into shorter strings on multiple rows?
    Kind of like in Excel, when using row break...

    Thats not possible in ALV

  • How to read and write a string into a txt.file

    Hi, I am now using BEA Workshop for Weblogic Platform version10. I am using J2EE is my programming language. The problem I encounter is as the above title; how to read and write a string into a txt.file with a specific root directory? Do you have any sample codes to reference?
    I hope someone can answer my question as soon as possible
    Thank you very much.

    Accessing the file system directly from a web app is a bad idea for several reasons. See http://weblogs.java.net/blog/simongbrown/archive/2003/10/file_access_in.html for a great discussion of the topic.
    On Weblogic there seems to be two ways to access files. First, use a File T3 connector from the console. Second, use java.net.URL with the file: protocol. The T3File object has been deprecated and suggests:
    Deprecated in WebLogic Server 6.1. Use java.net.URL.openConnection() instead.
    Edited by: m0smith on Mar 12, 2008 5:18 PM

  • Insert data 32K into a column of type LONG using the oracle server side jdbc driver

    Hi,
    I need to insert data of more than 32k into a
    column of type LONG.
    I use the following code:
    String s = "larger then 32K";
    PreparedStatement pstmt = dbcon.prepareStatement(
    "INSERT INTO TEST (LO) VALUES (?)");
    pstmt.setCharacterStream(1, new StringReader(s), s.length());
    pstmt.executeUpdate();
    dbcon.commit();
    If I use the "standard" oracle thin client driver from classes_12.zip ("jdbc:oracle:thin:@kn7:1521:kn7a") every thing is working fine. But if I use the oracle server side jdbc driver ("jdbc:default:connection:") I get the exception java.sql.SQLException:
    Datasize larger then max. datasize for this type: oracle.jdbc.kprb.KprbDBStatement@50f4f46c
    even if the string s exceeds a length of 32767 bytes.
    I'm afraid it has something to do with the 32K limitation in PL/SQL but in fact we do not use any PL/SQL code in this case.
    What can we do? Using LOB's is not an option because we have client software written in 3rd party 4gl language that is unable to handle LOB's.
    Any idea would be appreciated.
    Thomas Stiegler
    null

    In rdbms 8.1.7 "relnotes" folder, there is a "Readme_JDBC.txt" file (on win nt) stating
    Known Problems/Limitations In This Release
    <entries 1 through 3 omiited for brevity >
    4. The Server-side Internal Driver has the following limitation:
    - Data access for LONG and LONG RAW types is limited to 32K of
    data.

  • Insert string into date column

    I'm writing a bash script that is supposed to insert a series of strings into a table. Problem is I may not know which column the date is in, so I don't want to hard code a to_date function in there.
    For instance this row may come in to be inserted:
    "06-APR-10 08:51:12","data","data","data","data","data","data","data","data"
    Assuming the data is in the proper order, I'm just going to sub out the "," for ',' which will let me insert everything just fine, except obviously it borks on the date.
    How do I insert the date this way as a string using the default internal call to to_date?? I know I can do it with '06-APR-10' and it works, but I need to get a little more specific with hour minute and second.

    user12947249 wrote:
    I'm writing a bash script that is supposed to insert a series of strings into a table. Problem is I may not know which column the date is in, so I don't want to hard code a to_date function in there.If you don't know which string maps to which column, how do you expect to have any data reliability? Even if you manage to load the data without error, how can an application make any sense of it?
    I'm curious because if you have a method to map the columns, that could be used to help you (maybe) and if you don't have a method ... then i don't see this post as being your number one problem :)

  • Is there an easy way to convert a long string into an array?

    I can convert a long string into a 1-d array by parsing and using build array, but I would like to know if there is a function to make this easier.
    For example:
    from/   aaaaaaaabbbbbbbbccccccccdddddddd         (string of ascii)
    to/       an array that is 1-d with each element having eight characters
              aaaaaaaa
              bbbbbbbb
              cccccccc
              dddddddd
    Thank you.
    Solved!
    Go to Solution.

    Try something like this:
    (If you can guarantee that the string length is an integer multiple of 8, you an drop the two triangular modes in the upper left. )
    Message Edited by altenbach on 03-14-2010 06:40 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ChopString.png ‏9 KB

  • How to insert the image or logo into the table as a field in webdynpro abap

    Hi Friends,
    Please tell me how to insert the image or logo into the table as a field in webdynpro abap.........

    Hi Alagappan ,
          In your view layout you take table UI element and then you bind it with some context nodes.
    The attributes of your nodes comes as a field.
    Now in these fields you can set various properties and image is one of them.
    Go to ->
    1. View Layout -> Right Click on ROOTUIELEMENTCONTAINER -> INSERT ELEMENT -> TABLE
    2. Right click on table -> Create Binding.
       Here you have to bind it with the appropriate context node.
    You will get two properties here
    a- Standard Cell Editor :- ( make it image )
    b- Standard properties :- ( If required set image properties ).
    3. If you want put image from out side then import it as a mime object and set the source of your table field ( used as a image )
    also have a look :-
    [Image Properties|http://help.sap.com/saphelp_nw04/helpdata/en/f3/1a61a9dc7f2e4199458e964e76b4ba/content.htm]
    Hope this will solve your problem.
    Reply if any case of any issue.
    Thanks & Regards,
    Monishankar C

  • Error by inserting data into a field of datatype LONG

    Hi,
    When inserting data into a field of datatype long in oracle8 database via SQL Plus or SQL worksheet there occurs the following error message: "field in data file exceeds the maximum length".
    If I access to the database from a selve written program via odbc there is no problem when inserting the data by the same sql statement.
    So what can I do?
    Thanks in advance!
    Juergen

    What does your SQL statement look like?

  • How to print different colors of Strings into JEditorpane?

    How to print different colors of Strings into JEditorpane?
    Can any body give me answer ...

    JEditorPane contain HTML. So write your HTML using the color attribute.
    Start by read the the API description of JEditorPane. you will find a link to the Swing tutorial on "Using Text Components" which has working examples of using a JEditorPane. It also has an example of using a JTextPane where you can dynamically change the attributes of individual pieces of text.

  • How to Store Encrypted String into OracleDatabase Column(vacrchar2)

    Hi..
    I encountered an error while inserting a Encryted String into oracle column.. Error "Quoted String Doesn't terminated properly"
    But i wrote Query string correctly and using Datatypes as String and vacharchar2(2000) in java and oracle respectively..
    what i need to do?

    Hi,
    if your code compose the sql programmatically without bind variables i.e.:
    String sqlInsert="insert into table A(encrypted_column) values ('" + encryptedValue+ ')");
    then if the string encryptedValue contains a ' character you end up with a wrong sql statement
    if you encryped values is something like AAABB#??£££'AAA the corresponding sql is
    insert into table A(encrypted_column) values ('AAABB#??£££'AAA')
    which is not correct becaus of the ' in the middle of the string.
    Giovanni

  • How to Splilit The String Into Single Column using Comma As Delimiter ?

    How to Splilit The String Into Single Column using Comma As Delimiter ?
    using Function

    refer my thread ,code is also available see if that helps you
    error while executing the sp ORA-21779: duration not active

  • How to insert the select query result into table?

    How to insert the select query result into table?
    SELECT  top 20 creation_time  
            ,last_execution_time 
            ,total_physical_reads
            ,total_logical_reads  
            ,total_logical_writes
            , execution_count 
            , total_worker_time
            , total_elapsed_time 
            , total_elapsed_time / execution_count avg_elapsed_time
            ,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
             ((CASE statement_end_offset 
              WHEN -1 THEN DATALENGTH(st.text)
              ELSE qs.statement_end_offset END 
                - qs.statement_start_offset)/2) + 1) AS statement_text
    FROM sys.dm_exec_query_stats AS qs
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
    ORDER BY total_elapsed_time / execution_count DESC;
    Thanks,
    Tirumala

    1. SELECT INTO
    Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
    Use AdventureWorks2008R2;
    Go
    ---Insert data using SELECT INTO
    SELECT AddressLine1, City
    INTO BothellAddresses
    FROM Person.Address
    where City = 'Bothell';
    GO
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    2. INSERT INTO SELECT
    Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
    another table.
    Use AdventureWorks2008R2;
    Go
    ---Create Table
    CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
    ---Insert into above table using SELECT
    INSERT INTO BothellAddresses(AddressLine1, City)
    SELECT AddressLine1, City
    FROM Person.Address
    where City = 'Bothell';
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    Regards,
    Vishal Patel
    Blog: http://vspatel.co.uk
    Site: http://lehrity.com

  • How to insert a blank value in not nul column using transform activity

    can anyone help me on how to insert blank values in a not null column using transform activity or however possible..This is a requirement in my project ..

    vidya
    In DB adapter or-mappings.xml , did you made any changes. If not the open that file in any notepad editor and change the following
    <attribute-mapping xsi:type="direct-mapping">
    <attribute-name>director</attribute-name>
    <field table="MYTABLE" name="MAKE_IT_BLANK_NOT_NULL" xsi:type="column"/>
    <attribute-classification>java.lang.String</attribute-classification>
    </attribute-mapping>You can try to add this:
    <attribute-mapping xsi:type="direct-mapping">
    <attribute-name>director</attribute-name>
    <field table="MYTABLE" name="MAKE_IT_BLANK_NOT_NULL" xsi:type="column"/>
    <null-value></null-value>
    <attribute-classification>java.lang.String</attribute-classification>
    </attribute-mapping>Refer below link for details
    Re: Insertion of Blank value to a Not Null varchar column in SQL server table
    Thanks
    AJ

Maybe you are looking for

  • I bought a used ipad on ebay and the icloud acct is still linked to the old owner who doesn't remember the acct information. How can I set up my apple id on the iPad.

    I bought a used ipad on ebay and the icloud acct is still linked to the old owner who doesn't remember the acct information. How can I set up my apple id on the iPad?

  • Add alpha channel to a BufferedImage

    Hi, I am making a small jigsaw puzzle type game. I read an image from a file into a BufferedImage using ImageIO.read(). From this image I cut out rectangular pieces using getSubimage(). Then I would like to mask out the small figure cuts that should

  • HELP...ipod locked up

    My ipod is locked up. The display is showing the podcast I was listening to and no keys work. Is there any way to manually reset the device (turn it off or something by holding a key down or removing some sort of internal battery)?

  • Need HTTP test Client

    Hi All, To Test Client Sender Scenario I need .exe Http Test Client,Which i can use it for testing.. (I can get code of it ,but how to make it .Exe) And Also please do send Altova Xml spy software for Soap scenario testing to mail ID [email protected

  • Auto-Lock "Never" not available

    I added an Exchange mail account and I found that the "Never" option is no longer available in *Settings > General > Auto-Lock*. This is a well-documented issue as in this article: http://www.macworld.com/article/152642/2010/07/noneverautolock.html I