SQL Error: ORA-01704: string literal too long

select * from table(fn_split('some 10000 characters with comma separation .........................'))
Error report:
SQL Error: ORA-01704: string literal too long
01704. 00000 - "string literal too long"
*Cause:    The string literal is longer than 4000 characters.
*Action:   Use a string literal of at most 4000 characters.
how to pass my 10k record string

933663 wrote:
The string is through a user interface.So, that interface is using what datatype for the string? What language is the interface written in?
insert into table
select * from table(fn_split('2,4,2,5,7'));Do you understand what a string literal is? You cannot provide a varchar2 string that exceeds 4000 bytes from within SQL. Fact. It just cannot be done.
If you are passing the string from a user interface using a datatype that supports more than 4000 bytes, and you pass it directly to PL/SQL code by calling the function or procedure directly (not using SQL) then you can use up to 32767 bytes for your VARCHAR2.
The code you've posted (which happens to be some of my own code posted years ago on these forums) takes a VARCHAR2 as an input. You would have to change that to accept a CLOB datatype and work on the CLOB instead. However, you still wouldn't be able to pass in a string literal of more than 4000 bytes from SQL for it.
Looking at your other thread: Seperate the string value
... it looks like the 'user' is trying to pass in a table definition. What is it your application is trying to do? Surely you are not trying to create a table at run time?
So explain, what is the business issue you are trying to solve? We may be able to provide a better way of doing it.

Similar Messages

  • How to handle the SQL Error: ORA-01704: string literal too long

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta name="generator" content="HTML Tidy for Java (vers. 26 Sep 2004), see www.w3.org">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta content="MSHTML 6.00.2900.2963" name="GENERATOR">
    </head>
    <body class="BodyContent">
    HI please chek the query getting error like string literal too long update PRVDR_ENRLMNT_AGREEMENT B set b.terms=q'#
    <div class="widget-title">
    <h5>Medical Assistance Provider Enrollment & Trading Partner Agreement - Conditions:</h5>
    <a href="# class="btn-minimize pull-right"></a></div>
    <div class="widget-content">
    <table width="100%" border="0">
    <tbody>
    <tr valign="center">
    <td class="Label" align="left" width="14%" colspan="2" height="32">In applying for enrollment as a provider or trading partner in the Medical Assistance Program (and programs for which the Michigan Department of Community Health (MDCH) is the fiscal intermediary), I represent and certify as follows:</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>1.</b></td>
    <td class="LabelValue" valign="top" align="left" height="32">The applicant, and the employer (if applicable), certify that the undersigned has/have the authority to execute this Agreement.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>2.</b></td>
    <td class="LabelValue" valign="top" align="left" height="32">Enrollment in the Medical Assistance Program does not guarantee participation in MDCH managed care programs nor does it replace or negate the contract process between a managed care entity and its providers or subcontractors.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>3.</b></td>
    <td class="LabelValue" valign="top" align="left" height="32">All information furnished on this Medical Assistance Provider Enrollment & Trading Partner Agreement form is true and complete.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>4.</b></td>
    <td class="LabelValue" valign="top" align="left" height="32">The providers and fiscal agents of ownership and control information agree to provide proper disclosure of provider's owners and other persons criminal related to Medicare, Medicaid or Title XX involvement. [42 CFR 455.100]</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>5.</b></td>
    <td class="LabelValue" align="left" height="32">The applicant and the employer agree to provide proper disclosure of any criminal convictions related to Medicare (Title XVIII), Medicaid (Title XIX), and other State Health Care Programs (Title V, Title XX, and Title XXI) involvement. [42 CFR 455.106 and 42 U.S.C. ? 1320a-7]</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>6.</b></td>
    <td class="LabelValue" align="left" height="32">I agree to read the Medicaid Provider Manual from the Michigan Department of Community Health (MDCH). I also agree to comply with 1) the terms and conditions of participation noted in the manual, and 2) MDCH's policies and procedures for the Medical Assistance Program contained in the manual, provider bulletins and other program notifications.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>7.</b></td>
    <td class="LabelValue" align="left" height="32">I agree to comply with the provisions of 42 CFR 455.104, 42 CFR 455.105, 42 CFR 431.107 and Act No. 280 of the Public Acts of 1939, as amended, which state the conditions and requirements under which participation in the Medical Assistance Program is allowed.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>8.</b></td>
    <td class="LabelValue" align="left" height="32">I agree to comply with the requirements of Section 6032 of the Deficit Reduction Act of 2005, codified at section 1902 (a)(68) of the Social Security Act which relates to the conditions and requirements of "Employee Education About False Claims Recovery."</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>9.</b></td>
    <td class="LabelValue" align="left" height="32">I agree that, upon request and at a reasonable time and place, I will allow authorized state or federal government agents to inspect, copy, and/or take any records I maintain pertaining to the delivery of goods and services to, or on behalf of, a Medical Assistance Program beneficiary. These records also include any service contract(s) I have with any billing agent/service or service bureau, billing consultant, or other healthcare provider.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>10.</b></td>
    <td class="LabelValue" align="left" height="32">I agree to include a clause in any contract I enter into which allows authorized state or federal government agents access to the subcontractor's accounting records and other documents needed to verify the nature and extent of costs and services furnished under the contract.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>11.</b></td>
    <td class="LabelValue" align="left" height="32">I understand that the incentive payment requested using my National Provider Identifier (NPI) number will be made directly to the Tax ID Number (TIN) that was indicated during the registration process.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>12.</b></td>
    <td class="LabelValue" align="left" height="32">I am not currently suspended, terminated, or excluded from the Medical Assistance Program by any state or by the U.S. Department of Health and Human Services.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>13.</b></td>
    <td class="LabelValue" align="left" height="32">I agree to comply with all policies and procedures of the Medical Assistance Program. I also agree that all disputes, including overpayments, may be adjudicated in administrative proceedings convened under Act No. 280 of the Public Acts of 1939, as amended, or in a court of competent jurisdiction. I further agree to reimburse the Medical Assistance Program for all overpayments, and I acknowledge that the Medicaid Audit System, which uses random sampling, is a reliable and acceptable method for determining such overpayments.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>14.</b></td>
    <td class="LabelValue" align="left" height="32">I agree to comply with the privacy and confidentiality provisions of any applicable laws governing the use and disclosure of protected health information, including the privacy regulations adopted by the U.S. Department of Health and Human Services under the Health Insurance Portability and Accountability Act of 1996 (HIPAA), and Public Acts 104-191 (45 CFR Parts 160 and 164, Subparts A and E). I also agree to comply with the HIPAA security regulations, as applicable, for electronic protected health information by the compliance date, which is currently April 21, 2005 (45 CFR Parts 160 and 164, Subparts A and C).</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>15.</b></td>
    <td class="LabelValue" align="left" height="32">This Agreement shall be governed by the laws of the State of Michigan and applicable federal law including, but not limited to, the Health Insurance Portability and Accountability Act of 1996 (HIPAA).</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>16.</b></td>
    <td class="LabelValue" align="left" height="32">The provisions of this Agreement are severable. If any provision is held or declared to be illegal, invalid or unenforceable, the remainder of the Agreement will continue in full force and effect as though the illegal, invalid or unenforceable provision had not been contained in this Agreement.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>17.</b></td>
    <td class="LabelValue" align="left" height="32">Failure or delay on the part of either party to exercise any right, power, privilege, or remedy in this Agreement will not constitute a waiver. No provision of this Agreement may be waived by either party except in writing and signed by an authorized representative of the party requesting the waiver.</td>
    </tr>
    <tr valign="center">
    <td class="Label" align="left" width="14%" colspan="2" height="32"></td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>18.</b></td>
    <td class="LabelValue" align="left" height="32">If the nursing facility named on the Medical Assistance Provider Enrollment & Trading Partner Agreement is sold, the seller will notify MDCH of the sale at least ninety (90) days prior to the expected sale date. Further, it is understood that the sale will not be recognized for reimbursement purposes under the Medical Assistance Program until ninety (90) days after such notification. Provisions of 42 CFR 413.135(f) will be retrospectively satisfied at that time. Any exception must be approved in writing by MDCH. The new owner/provider must receive Medicare certification for all Medicaid-only beds in the facility within one year from the date of purchase of an operating nursing facility or from the date of reopening a previously closed nursing facility.</td>
    </tr>
    <tr valign="center">
    <td class="Label" align="middle" width="14%" colspan="2" height="32">Medical Assistance Provider - Employer/Employee Conditions</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>19.</b></td>
    <td class="LabelValue" align="left" height="32">The applicant is employed by the business listed, now referred to as the "employer", to provide Medical Assistance Program services to eligible beneficiaries at the service address listed.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>20.</b></td>
    <td class="LabelValue" valign="top" align="left" height="32">The employer and the applicant shall advise MDCH within thirty (30) days after any change(s) in the employment relationship.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>21.</b></td>
    <td class="LabelValue" align="left" height="32">The employer and the applicant agree to be jointly and severally liable for any overpayments billed and paid under Act No. 280 of the Public Acts of 1939, as amended, for services provided by the applicant to eligible beneficiaries.</td>
    </tr>
    <tr valign="center">
    <td class="Label" align="middle" width="14%" colspan="2" height="32">Trading Partner Provisions</td>
    </tr>
    <tr valign="center">
    <td class="Label" align="left" width="14%" colspan="2" height="32">The MDCH and its Trading Partner desire to facilitate the exchange of healthcare transactions ("Transactions") by electronically transmitting and receiving data in agreed formats in substitution for conventional paper-based documents.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>1.</b></td>
    <td class="LabelValue" align="left" height="32">Companion Documents; Standards; Other Documentation. MDCH makes available certain inbound and outbound Electronic Data Interchange (EDI) transaction sets/formats and associated version. From time to time during the term of this Agreement, MDCH may modify supported transaction sets/formats. In submitting Transactions to MDCH, the Trading Partner agrees to conform to MDCH-issued provider publications and MDCH Companion Guides as amended from time to time. The MDCH Companion Guides, incorporated by reference herein, contain specific instructions for conducting each Transaction and as such supplement Implementation Guides issued under the Standards for Electronic Transactions mandated by the Health Insurance Portability and Accountability Act of 1996 (HIPAA) as amended. The MDCH Companion Guides are not intended to be complete billing instructions and do not alter or replace applicable physician guides or other healthcare provider billing publications issued by MDCH or by other third party payers. The Trading Partner agrees to comply with the requirements set forth in the applicable MDCH Companion Guides. The Trading Partner, or its vendor, or other authorized technical representative responsible for EDI software will document Trading Partner Information, data formats and related versions, trading partner identifiers, and other information MDCH requires to receive and transmit specific Transactions supported by MDCH.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>2.</b></td>
    <td class="LabelValue" align="left" height="32">Support.<br>
    As to software, equipment, and services associated with each party's performance under this Agreement, the parties agree to provide support services sufficient for Transactions to be exchanged. Each party will assist the other in establishing and/or maintaining support procedures, and will complete appropriate problem determination procedures prior to contacting the other with a support related matter. The parties agree to use all commercially reasonable efforts to avoid and resolve performance and unavailability issues. Each party will perform remedial action, as requested by the other, to assist in problem resolution. Each party, at its own expense, shall provide and maintain the equipment, software, services, and testing necessary to effectively and reliably transmit and receive transactions.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>3.</b></td>
    <td class="LabelValue" align="left" height="32">Data Retention.<br>
    MDCH will log all Transactions for the purpose of problem investigation, resolution, and servicing. The Trading Partner is responsible for maintaining and retaining its own records of data submitted to MDCH. Trading Partners who are healthcare providers will ensure that electronic healthcare claims submitted to MDCH can be readily associated and identified with the correct patient medical and business office records, and that these records are maintained in a manner that permits review, and for the time period as may be required by MDCH or other third party payer responsible for claim payment.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>4.</b></td>
    <td class="LabelValue" align="left" height="32">Proper Receipt and Verification for Transactions.<br>
    Upon proper receipt of any ANSI ASC X12N Standard Transaction, the receiving party shall promptly and properly transmit a functional acknowledgement in return, unless otherwise specified. The functional and interchange acknowledgements must be accepted and reviewed, when applicable, to confirm the receipt of a Transaction. The ability to send or receive functional acknowledgements is applicable only to ANSI ASC X12N Standard Transactions. Additionally, MDCH originated outbound Transactions must be accepted and reviewed, when appropriate, to obtain MDCH's response to specific inbound Transactions. The acknowledging party does not attest to the accuracy of the data contained in the transmission; rather, it only confirms receipt of the transmission.</td>
    </tr>
    <tr valign="center">
    <td class="Label" valign="top" nowrap align="right" width="1%" height="32"><b>5.</b></td>
    <td class="LabelValue" align="left" height="32">Liability.<br>
    MDCH shall not be responsible to the Trading Partner nor anyone else for any damages caused by loss, delay, rejection, or any misadventure affecting such electronic information. In addition, MDCH shall be excused from performing any EDI servi

    You cannot use string literal of more than 4000 characters in an Oracle SQL statement. I'm not going to count that string you so rudely posted but I presume it is longer than that figure. You'll need to use a variable instead.
    declare
        c clob := '<your vast XML doc here>';
    begin
        update PRVDR_ENRLMNT_AGREEMENT B set b.terms= c
        where ....
    {code}
    Cheers, APC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Using clobs and ORA-01704: string literal too long

    Hi,
    I am attempting to add oracle support to an existing J2ee application. The issue I am facing is the use of CLOB datatypes and the 4k string literal limitation that Oracle has.
    I have dowloaded the 10.2.0.3 thin driver and am connected to a 9i release 2 database. When I execute a statement such as the following (say the table has one varchar2 field and two clob fields
    Insert into my_table VALUES ('hi','something','pretend this string is 5000 characters')
    I still receive the error
    java.sql.SQLException: ORA-01704: string literal too long
    I have read that the version 10 drivers were supposed to address this limitation. Is there something I am missing or must I change my home grown database layer to use bind variables or clob manipulation in a separate update/insert statement.? I am trying to avoid this situation since the database layer works fine for the situation of MSSQL and text fields which have no such limitation.
    Any advice you have here is greatly appreciated.
    Thanks,
    Joe

    Hi,
    I am attempting to add oracle support to an existing J2ee application. The issue I am facing is the use of CLOB datatypes and the 4k string literal limitation that Oracle has.
    I have dowloaded the 10.2.0.3 thin driver and am connected to a 9i release 2 database. When I execute a statement such as the following (say the table has one varchar2 field and two clob fields
    Insert into my_table VALUES ('hi','something','pretend this string is 5000 characters')
    I still receive the error
    java.sql.SQLException: ORA-01704: string literal too long
    I have read that the version 10 drivers were supposed to address this limitation. Is there something I am missing or must I change my home grown database layer to use bind variables or clob manipulation in a separate update/insert statement.? I am trying to avoid this situation since the database layer works fine for the situation of MSSQL and text fields which have no such limitation.
    Any advice you have here is greatly appreciated.
    Thanks,
    Joe

  • ORA-01704: string literal too long (URGENT)

    Folks,
    I get error - ORA-01704: string literal too long,
    when trying to insert a value >4k into the SDIDOC column of the table below:
    CREATE TABLE "B1"."SDI_XML_TAB"
    ( "SDIID" VARCHAR2(60 BYTE) NOT NULL ENABLE,
    "SDIDOC" "SYS"."XMLTYPE" ,
    CONSTRAINT "SDI_XML_TAB_PK" PRIMARY KEY ("SDIID")
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "B1SYSTEM" ENABLE
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "B1SYSTEM"
    XMLTYPE COLUMN "SDIDOC" STORE AS CLOB (
    TABLESPACE "B1SYSTEM" ENABLE STORAGE IN ROW CHUNK 16384 PCTVERSION 10
    NOCACHE LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)) ;
    The SQL I used using OCI was:
    "INSERT INTO SDI_XML_TAB(SDIID,SDIDOC) VALUES('ABC','clobVal')"
    What am I doing wrong?
    P.S. I also used the following and it gives the same error:
    "INSERT INTO SDI_XML_TAB(SDIID,SDIDOC) VALUES('ABC',XMLType('clobVal'))"
    Thanks,
    Arthur
    Message was edited by:
    ArthurJohnson

    Check this cool-bi.com

  • [ORA-01704: string literal too long] in a long xquery

    I get an error when using queries with xmlquery.
    If the quoted string part is longest than 4000 chr then I get
    ORA-01704: string literal too long.
    Example...
    select xmlquery(
    ' <Root >
         {for $xxx in ora:view("ttttttt")
            let $nnn := $xxx/ROW/nnn/number()
    [total chr>4000] '
    RETURNING CONTENT)
    from dual
    Is it really not possible to write Oracle xmlqueries longest than 4000chr or there's a workaround for it?

    I got similary problem using the OCCI to insert record in my table.
    I have a BLOB field in my table and whenever I quote an HEX string that is bigger than 4000 chars I get the error: ORA-01704: string literal too long
    To sort that problem I have to pass to the prepared SQL statement, but now I got a new problem for which I do not have solution.
    I write here the piece of C++ code to insert and the error I get hoping somebody can help me.
    I have problem to write into a Blob object.
    I get the error: ORA-22275: Invalid LOB Locator Specified.
    The error occurs when I try to write into the blob variable:
    blobField.writeChunk(....
    Routine:
    void insert2 (void) throw (SQLException)
    cout << "=== Prepare Statement ===" << endl;
    Statement* stmtIns = occiConn->createStatement("insert into test_tab values (:1,:2,:3,:4,:5)");
    cout << "=== Prepare the Blob data ===" << endl;
    // Prepare all Blobs in an array of char.
    char* data[5];
    ub2 dataLen[5];
    int i;
    for (i = 0; i < 5; i++)
    data[i] = new char[16364];
    memset(data, 65+i, 16364);
    dataLen[i] = 16364;
    cout << "=== Assign the other fields ===" << endl;
    stmtIns->setInt(1, i + 10);
    stmtIns->setInt(2, i + 1000);
    stmtIns->setInt(3, i + 10000);
    stmtIns->setInt(4, i + 20);
    // Assign the blob field
    Blob blobField(occiConn);
    blobField.setEmpty();
    cout << "=== Opening the blob field in read/write mode ===" << endl;
    blobField.open(OCCI_LOB_READWRITE);
    cout << "=== Writing data into the blob ===" << endl;
    blobField.writeChunk(dataLen[0], reinterpret_cast<unsigned char*>(data[0]), dataLen[0], 1);
    blobField.close();
    cout << "=== Done ===" << endl;
    stmtIns->setBlob(5, blobField);
    cout << "=== Execute the iteration ===" << endl;
    stmtIns->executeUpdate();
    for (i = 0; i < 5; i++)
    delete [] data[i];
    stmtIns->executeUpdate("COMMIT");
    occiConn->terminateStatement(stmtIns);

  • ORA-01704:String literal too long with update of more than 4000 chars

    Hi,
    I want to update a table column in Oracle Database(version 10) with more than 4000 chars.
    The datatype of the table column is NCLOB.
    I want to achieve this with one single line of update query as below,
    update mytable set MY_DESCRIPTION = 'longdesc' where ID = '111' ;
    But there's a problem, if the 'longdesc' is more than 4000 chars, it gives the error , "ORA-01704:String literal too long"
    How can I achieve this in sql developer ?
    I dont want to do this using stored procedures, I want to do this update using only sql statement.
    Please help.
    thanks,
    sudhakar

    Hello Sudhakar,
    I am afraid, this will never work by SQL.
    Just because an SQL-Statement must not contain a string literal over 4,000 characters (or did that change lately?).
    Maybe you can bypass the limit with PL/SQL ... but you will certainly run into the 32K limit sooner or later
    regards
    Peter

  • "ORA-01704: string literal too long" in Oracle 10g

    I would like to explain my problem with an example, let's create the following table:
    CREATE TABLE longtest
    (text LONG);
    I have to insert lots of data into this table and when I run this command:
    INSERT INTO LONGTEST VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    ..................more than 4000 characters..................
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
    I get the following error:
    ORA-01704: string literal too long
    To workaround this, I used bind variables, like this:
    BEGIN
    EXECUTE IMMEDIATE 'INSERT INTO LONGTEST VALUES (:a) '
    using
    'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    ..............(repeat more than 32768 characters)..............
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
    COMMIT;
    END;
    This worked fine with Oracle 9.2.0.4 but when I do the same thing
    in Oracle 10.2.0.2 there is a 32768 characters limit.
    I am planning to upgrade the database but I need a workaround for
    this, anyone knows why Oracle behaves differently in 10g??

    So, I wonder if anyone can explain why the following code works fine in Oracle 9.2.0.4 but not in Oracle 10.2.0.2:
    CREATE TABLE longtest
    (text LONG);
    BEGIN
    EXECUTE IMMEDIATE 'INSERT INTO LONGTEST VALUES (:a) '
    using
    'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    ..............(repeat more than 32768 characters)..............
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
    COMMIT;
    END;
    Regards,
    Cassiano

  • PL-SQL-ORA-01704 - String literal too long

    Hello guyz;
    I am trying to store a value of over 4000 character long in a CLOB column and I got the error message that says "PL-SQL-ORA-01704 - String literal too long".
    What can I do to overcome this challenge?
    Thanking you for your usual support.

    sb92075 wrote:
    Problem Exists Between Keyboard And Chair
    We can't say what you are doing wrong since we don't know specifically what you actually do.Okay let me put it down this way.
    I have an application using SQL Server as d backend engine & now, the user wants to migrate to Oracle. I now wrote a mini-program to create a schema/user in oracle with the schema/database (being used by the app) from SQL server. I verified the structure very well & every is just fine. Now, data migration (from SQL Server to Oracle).
    I was able to move most tables data successfully without issue until I attempted to load a table which has a column (in SQL defined as text with over 4000 (var)chars/CLOB in Oracle). On moving a particular row to oracle db (after few rows have already been INSERTed into this particular table x), I got that err msg.
    After battling with that for a while, I concluded to make d (DataMigrator) app take just d first 4000 string - only if the value in that field value length > 4000. This worked perfectly without issue but you know the implication - Data lost.
    Do I need to switch something on/off in Oracle that expands the CLOB default maximum field size? Because I foresee this happening as soon as the application (that would now sit on Oracle) is now in use.
    If you still don't understand this, I don't know how beta 2 explain this!
    Edited by: aweklin on Mar 17, 2013 8:25 AM
    Edited by: aweklin on Mar 17, 2013 8:25 AM
    Edited by: aweklin on Mar 17, 2013 8:27 AM
    Edited by: aweklin on Mar 17, 2013 8:27 AM

  • Error message :ORA-01704: string literal too long

    Hello:
    I need your help. I have a long long string must be insert to
    database. I use long data type and long varchar data type to
    define table. But I got the error messages is ORA-01704: string
    literal too long when I insert data. Please tell me the solution.
    Thank you so so much.

    Hello,
    I have a table with a column "XML_Data" of type CLOB.
    I am trying to insert XML of the size 59975. I
    get a error message ORA-01704: string literal too
    long.
    How to enter that large XML??
    Regards,
    Sanjeev.Try using Oracles XMLDB, by dropping the XML file into the XMLDB WebDAV area and then you can access it directly through the database "resource_view". No limits on file size whatsoever.
    If you're using XML within an Oracle database you're better off doing things this way as it gets stored in an XMLType column (sys.xmltype) which is a superset object of the CLOB datatype, providing all the object methods you need to navigate, update and query your XML. You won't be able to do much with it just sitting in a CLOB column without re-writing the wheel that Oracle have already built.
    ;)

  • Limitation for CLOB columns? - ORA-01704: string literal too long

    Hello!
    I'm trying to update a CLOB column with more than 35000 characteres, but I get "ORA-01704: string literal too long".
    The code:
    declare
    l_clob clob;
    begin
    update test set test = empty_clob()
    WHERE ID = 1
    returning test into l_clob;
    dbms_lob.write( l_clob, length('A...here 35000xA...A'), 1,'A...here 35000xA...A');
    end;
    Is there any limitation for CLOB columns?
    Thanks for help.
    Daniel

    user605489 wrote:
    32768 characteres :)Actually it's 1 character less than 32K...
    *32767*
    SQL> declare
      2    v_vc varchar2(32768);
      3  begin
      4    null;
      5  end;
      6  /
      v_vc varchar2(32768);
    ERROR at line 2:
    ORA-06550: line 2, column 17:
    PLS-00215: String length constraints must be in range (1 .. 32767)
    SQL>I guess it comes from a legacy thing where signed words (2 bytes) are/were used to represent a value. As the most significant bit of the word is used to represent the sign of the number the range goes from -32768 to 32767.

  • ORA-01704: string literal too long for CLOB colum

    Hi,
    I'm trying to execute sql script containing a lot of insert into statements.
    Insert into table (clob_column) values ("value of 5500 characters");
    I get the below error message. Please let me know how do resolve this issue without PL/SQL ?
    ORA-01704: string literal too long

    Hi,
    LOB columns store locators that reference the location of the actual LOB value. Depending on the column properties you specify when you create the table, and depending the size of the LOB, actual LOB values are stored either in the table row (inline) or outside of the table row (out-of-line).
    LOB values are stored out-of-line when any of the following situations apply:
    •If you explicitly specify DISABLE STORAGE IN ROW for the LOB storage clause when you create the table.
    •If the size of the LOB is greater than approximately 4000 bytes (4000 minus system control information), regardless of the LOB storage properties for the column.
    •If you update a LOB that is stored out-of-line and the resulting LOB is less than approximately 4000 bytes, it is still stored out-of-line.
    LOB values are stored inline when any of the following conditions apply:
    •When the size of the LOB stored in the given row is small, approximately 4000 bytes or less, and you either explicitly specify ENABLE STORAGE IN ROW or the LOB storage clause when you create the table, or when you do not specify this parameter (which is the default).
    •When the LOB value is NULL (regardless of the LOB storage properties for the column).
    Read this for more details..
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28393/adlob_tables.htm

  • "ORA-01704: string literal too long" with Usage Tracking

    Hello,
      We are facing “ORA-01704: string literal too long" with Usage Tracking in OBIEE 11.1.1.6.0 environment and as per Doc ID 1274586.1 we upgraded the environment to 11.1.1.6.12. But still the issue is not resolved.
    Any ideas or suggestions?
    Thanks

    Check this cool-bi.com

  • ORA-01704: string literal too long in Oracle 10.2.0.2

    We are running some Xqueries that are larger than 4k.
    Yesterday we were running on an Oracle 10.2.0.1 database, when we tried to run a large Xquery then we immediately got an ORA-01704 error.
    Since some messages on this forum indicate that in Oracle 10.2.0.2 this problem was solved, we patched the database this morning to level 10.2.0.2.
    At first everything seemd fine after that. The xquery had a type-mismatch and running the query resulted in a normal XP0003 syntax error. However, after we solved the type-mismatch in the query we got our old ORA-01704 error back.
    Might it be that the XMLQuery function now can handle larger input than 4k. but the parsing under water is still limited?
    And how can we solve this problem? It's urgent!
    By the way, the Xquery we used in this example is 5599 characters long.
    Hope to hear from you.
    Andre

    Hi,
    I faced the same problem and I created an EXE in .NET. I copied all my XML files in a directory named ReviewCaseXML and used the same to generate the script for all the xml files.
    class Migrate
    static void Main(string[] args)
    Console.Clear();
    string directorypath = ConfigurationManager.AppSettings["DirectoryPath"];
    string[] filePaths = Directory.GetFiles(directorypath, "*.xml");
    Array.Sort(filePaths);
    FileStream finalScript = null;
    File.Open(directorypath + "\\DBScript\\Final.sql", FileMode.Create);
    foreach (string file in filePaths)
    ProcessXMLFile(file);
    // ProcessXMLFile(directorypath + "\\CCV41E051v2 - Equipment Breakdown Clarification Clause (Amended).xml");
    Console.WriteLine("Complete. Press any key to exit.");
    Console.ReadKey();
    private static void ProcessXMLFile(string file)
    string endorsementName = string.Empty;
    XmlDocument doc = new XmlDocument();
    doc.Load(file);
    XmlNodeList varNodes = doc.SelectNodes("//var");
    foreach (XmlNode varNode in varNodes)
    foreach (XmlAttribute attrib in varNode.Attributes)
    if (attrib.Value.Equals("Name", StringComparison.InvariantCultureIgnoreCase))
    endorsementName = varNode.InnerText;
    if (!string.IsNullOrEmpty(endorsementName))
    GenerateScriptFileForXML(endorsementName, doc.OuterXml);
    public static void GenerateScriptFileForXML(string EndorsementName, string xml)
    int startingIndex;
    decimal fragmentCount;
    string fagmentToBeCopied;
    int fragmentLenght = 3000;
    fragmentCount = (Convert.ToDecimal(xml.Length) / Convert.ToDecimal(fragmentLenght));
    StringBuilder sb = new StringBuilder();
    sb.AppendFormat("SET DEFINE OFF {0}", Environment.NewLine);
    sb.AppendFormat("DECLARE TEMPLOB clob := '';{0}BEGIN {1}", Environment.NewLine, Environment.NewLine);
    sb.AppendFormat("dbms_lob.createtemporary(TEMPLOB, TRUE);{0}", Environment.NewLine);
    for (int ctr = 0; ctr < fragmentCount; ctr++)
    if (ctr == 0)
    startingIndex = ctr * fragmentLenght;
    else
    startingIndex = (ctr * fragmentLenght) ;
    if (ctr + 1 > fragmentCount)
    fragmentLenght = xmltobeScript.Length - (ctr * fragmentLenght );
    sb.Append("dbms_lob.append(TEMPLOB,'");
    fagmentToBeCopied = xmltobeScript.Substring(startingIndex, fragmentLenght);
    fagmentToBeCopied = fagmentToBeCopied.Replace("'", "''");
    sb.AppendFormat(fagmentToBeCopied);
    sb.AppendFormat("');{0}", Environment.NewLine);
    sb.AppendFormat("{0}Update ENDORSEMENTMASTER set THTEMPLATEXML = XMLTYPE(TEMPLOB) where ENDORSEMENTNAME='{1}';",Environment.NewLine, EndorsementName);
    sb.AppendFormat("{0} END ; {1}", Environment.NewLine, Environment.NewLine);
    sb.AppendFormat("COMMIT; {0} / {1}", Environment.NewLine, Environment.NewLine);
    SaveFile(EndorsementName + ".sql", ConfigurationManager.AppSettings["DirectoryPath"], sb.ToString());
    public static void SaveFile(string filename, string directory, string data)
    try
    filename = filename.Replace("/", "");
    StreamWriter stringWriter = new StreamWriter(directory + "\\DBScript\\" + filename);
    stringWriter.Write(data);
    stringWriter.Flush();
    stringWriter.Close();
    FileStream finalScript = null;
    byte[] finalString;
    finalString = System.Text.Encoding.Unicode.GetBytes(data);
    finalScript = File.Open(directory + "\\DBScript\\Final.sql", FileMode.Append, FileAccess.Write);
    finalScript.Write(finalString, 0, finalString.Length);
    finalScript.Close();
    Console.WriteLine("{0} saved sucessfully.", filename);
    catch (Exception e)
    Log.ErrorFormat(e, "{0} not saved.", filename);
    Console.WriteLine("{0} not saved.", filename);
    Console.Write(e.Message);
    Console.ReadKey();
    }

  • ORA-01704: string literal too long and PHP

    Ok all of you Oracle experts out there, I've had one heck of a day wrestling with this oracle stuff.
    I've had a couple of posts/threads today with great success and currently I face another problem.
    I'm using PHP/PEAR to execute my queries on an oracle table. I'm trying to store very long (2-3 pages) texts. Currently I'm getting a string too long error.
    I've googled to find that there are certain limits when inserting into a table. The CLOB datafield may hold 4 gigs of text, but you may only insert 4000 bytes at a time. Or at least that's how I understand it.
    Anyone got a work around for this? I've tried:
    OCIBindByName($sql,":fieldName",&$myVariable, -1);
    But that gets me the error:
    ocibindbyname(): supplied argument is not a valid OCI8-Statement resource
    which is an actual PHP/PEAR error....I think...
    Anyone out there have any work around suggestions? I really dont want to parse the insert statement into pieces each being less then 4000 bytes.
    Thanks,
    R

    <snip>
    But that gets me the error:
    ocibindbyname(): supplied argument is not a valid OCI8-Statement resource
    </snip>
    Try check the enviroment setup for oracle in your apachectl (off course if you are using apache web server).
    Just enviroment configuration in /etc/profile or .profile is not enough.

  • ORA-01704: string literal too long

    How can I have an argument (CLOB) of a function PL / SQL with more than 32767 bytes?
    Thanks.

    Use for example long
    declare
    v long;
    begin
    for i in 1..4000 loop
    v := v || 'x';
    end loop;
    dbms_output.put_line(length(v));
    end;
    For more information of :
    - datatype (summary) : http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/sql_elements2a.htm#45649
    -lobs (large objects):
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96591/toc.htm
    MAX LENGTH OF LONG:
    11:49:09 SQL@>> ed
    Escrito archivo afiedt.buf
    1 declare
    2 v long;
    3 i number := 1;
    4 begin
    5 while i <32761 loop
    6 v := v || 'x';
    7 i := i+1;
    8 end loop;
    9 dbms_output.put_line(length(v));
    10* end;
    11:49:14 SQL@>> /
    32760
    Procedimiento PL/SQL terminado correctamente.
    11:49:15 SQL@>> ed
    Escrito archivo afiedt.buf
    1 declare
    2 v long;
    3 i number := 1;
    4 begin
    5 while i <32762 loop
    6 v := v || 'x';
    7 i := i+1;
    8 end loop;
    9 dbms_output.put_line(length(v));
    10* end;
    11:49:21 SQL@>> /
    declare
    ERROR en lÝnea 1:
    ORA-06502: PL/SQL: error numÚrico o de valor
    ORA-06512: en lÝnea 6
    11:49:22 SQL@>>
    Message was edited by:
    cth

Maybe you are looking for

  • Error in Variant Configuration CO684

    Hello, friends ! Back in the forum, now with a problem in Variant Configuration. I was able to carry out the whole process up to the creation of the production order. There I have the error message CO 684 "You cannot make an assignment to make to ord

  • Adding fields in EDI output of Invoice List

    Hi! I am trying to find out what is a process of adding fields in EDI output of Invoice List... I mean that I need to add some extra fields to Invoice lists. The information I have is: name of Form, print program and output type. I guess I need to mo

  • Lost icon

    i have lost my contacts icon from home screen how do i get it back on my iphone 4

  • LOGO in STANDARD REPORTS

    Hi, I am working on Interactive Reports (R/3 4.6c). Is there a way by which i can generate a LOGO in a standard REPORT. Is there any other alternative where i can generate my company's logo in STANDARD REPORTS. Thanks and Regards AK

  • Where is the long line "--" on the key board?

    where is the long line "--" on the key board? I can only find a short one and thus have to press is twice.