When is String literal pool created compile time or runtime?

When is String literal pool created compile time or runtime?

I have replied to your question in the other thread related to the string pool:
http://forum.java.sun.com/thread.jsp?forum=31&thread=276893
Pierre

Similar Messages

  • How many java String objects are created in string literal pool by executin

    How many java String objects are created in string literal pool by executing following five lines of code.
    String str = "Java";
    str = str.concat(" Beans ");
    str = str.trim();
    String str1 = "abc";
    String str2 = new String("abc").intern();
    Kindly explain thanks in advance
    Senthil

    virtuoso. wrote:
    jverd wrote:
    In Java all instances are kept on the heap. The "String literal pool" is no exception. It doesn't hold instances. It holds references to String objects on the heap.Um, no.
    The literal pool is part of the heap, and it holds String instances.
    [http://java.sun.com/docs/books/jvms/second_edition/html/Overview.doc.html#22972]
    [http://java.sun.com/docs/books/jvms/second_edition/html/ConstantPool.doc.html#67960]
    You're referring to the JVM. That's not Java.It's part of Java.
    There is nowhere in Java where it is correct to say "The string literal pool holds references, not String objects."

  • Can you please differentiate between compile time and runtime?

    hi,
    I heard many of them speaking about complie time and runtime. I sometimes feel they talk about it but they themselves don't know about it.
    Please help me out.
    Thanks in anticipation
    Regards
    Deepa Datar

    Just remember, runtime means you are running the program. Compile time means your are in the process of building the program ("javac bla.java").

  • Access Migration Error Creating Migration Project - string literal too long

    I get this error when attempting to create an MS Access Migration Project:
    ORA-20001: GET_BLOCK Error. ORA-20001: GET_STMT error. ORA-20001: Execution of the statement was unsuccessful. ORA-06550: line 8, column 8: PLS-00172: string literal too long <pre>begin <br>declare <br> p varchar(32767) := null; <br> l_clob clob; <br>begin <br> dbms_lob.createtemporary(l_clob,FALSE, dbms_lob.session); <br> dbms_lob.open(l_clob,dbms_lob.lob_
    I suspected the 'string literal too long' was due to a very long code section in the Exporter .sql file -
    So I edited out that code except - essentially by cutting the macro code within the quotes, cutting down that code module.
    Same error.
    Any suggestions on what else may be causing this?
    Thanks - Karen

    I found it - two other big long ugly macros that I had to cut out as well. Then the migration project created just fine. Thanks for the moral support :)

  • Keep getting string literal when using CLOBs

    Hi, I am using Oracle 11.2.0.3 on Windows 2003 R2 and I have a procedure to extract various bits of XML and GML from an XMLType column. The GML for a record can be one or more geometries and I need to derive a single SDO_GEOMETRY from and convert to WGS84. I created a function called MULTI_GML_TO_SDOGEOM in which I parse my GML as a CLOB. I then add it to a SQL_STMT variable which is also a CLOB. In processing 10,000 records, this function worked fine for 8000 but then failed when it hit a record that had over 4000 characters in the GML (seven geometries) with a ORA-01704 string literal too long. I entered debug on every line of the function and found the function failed on the open cursor statement
    OPEN c_geoms FOR sql_stmt;I can't understand why I am getting this error as the total length of sql_stmt for the record that failed was about 7500 characters and I am using CLOBs which should be able handle that length. I am not sure if I have not used the CLOBs correctly or perhaps I need to use something from DBMS_LOB package but I cannot find any decent examples and I am not really sure why this doesn't work anyway.
    Here is the function:
    CREATE OR REPLACE FUNCTION MULTI_GML_TO_SDOGEOM (
       geometry_components IN CLOB)
       RETURN sdo_geometry
    IS
    v_count             NUMBER;
    v_gml               XMLType;
    v_gml_rec           XMLType;
    v_gml_clob          CLOB;
    v_gml_clob_rec      CLOB;
    sql_stmt            CLOB;
    v_sdogeom           SDO_GEOMETRY;
    v_sdogeom_all       SDO_GEOMETRY;
    varray_sdogeom      SDO_GEOMETRY_ARRAY;
    TYPE t_ref_cursor  IS REF CURSOR;
    c_geoms         t_ref_cursor;
    BEGIN
    varray_sdogeom := SDO_GEOMETRY_ARRAY();
    IF geometry_components is not null THEN
      v_gml := XMLType ('<GeometryComponents xmlns:gml="http://www.opengis.net/gml/3.2">'||geometry_components||'</GeometryComponents>');
      v_gml_clob := v_gml.getClobVal();
      SELECT count(*) INTO v_count FROM XMLTable ('declare namespace gml="http://www.opengis.net/gml/3.2"; (: :)
                                                 //polygon' PASSING v_gml);
      If v_count > 0 THEN
        sql_stmt := 'WITH gml_input AS (SELECT XMLType ('''||v_gml_clob||''') as gmldata from dual)
                     select poly.spatial_location from gml_input,
                                                     xmltable (xmlnamespaces (''http://www.opengis.net/gml/3.2'' as "gml"),
                                                              ''GeometryComponents/polygon/gml:Polygon''
                                                               PASSING gmldata
                                                               COLUMNS
                                                               spatial_location XMLTYPE PATH ''//gml:Polygon'') poly
                     UNION ALL
                     select point.spatial_location from gml_input,
                                                     xmltable (xmlnamespaces (''http://www.opengis.net/gml/3.2'' as "gml"),
                                                              ''GeometryComponents/polygon/gml:Point''
                                                               PASSING gmldata
                                                               COLUMNS
                                                               spatial_location XMLTYPE PATH ''//gml:Point'') point';
    --    dbms_output.put_line (sql_stmt);
        OPEN c_geoms FOR sql_stmt;
        LOOP
          FETCH c_geoms INTO v_gml_rec;
          EXIT WHEN c_geoms%NOTFOUND;
          v_gml_clob_rec := v_gml_rec.getClobVal;
          sql_stmt := 'SELECT SDO_CS.TRANSFORM(SDO_UTIL.FROM_GML311GEOMETRY ('''||v_gml_clob_rec||'''), 8307) FROM dual';
          EXECUTE IMMEDIATE sql_stmt INTO v_sdogeom;
          varray_sdogeom.EXTEND;
          varray_sdogeom(varray_sdogeom.COUNT) := v_sdogeom;
        END LOOP;   -- c_geoms fetch
        CLOSE c_geoms;
        select SDO_AGGR_SET_UNION(varray_sdogeom, 0.005) INTO v_sdogeom_all from dual;
      END IF;  -- v_count > 0
    RETURN v_sdogeom_all;
    END IF;
    END MULTI_GML_TO_SDOGEOM;
    show errorsUnfortunately I cannot add the data I am processing as it is classified but here is a dummy sample of the type of GML I am parsing though this is short enough that it works:
    <GeometryComponents xmlns:gml="http://www.opengis.net/gml/3.2">
    <polygon xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:srv="http://www.isotc211.org/2005/srv"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:mgmp="http://www.mod.uk/mgmp" xmlns:smr="http://www.mod.uk/smr"
    xmlns:xlink="http://www.w3.org/1999/xlink"><gml:Polygon gml:id="bp2" srsName="EPSG:4326">
    <gml:exterior>
    <gml:LinearRing>
    <gml:posList srsDimension="2">175 -40 176 -40 176 -39 175 -39 175 -40</gml:posList>
    </gml:LinearRing>
    </gml:exterior>
    </gml:Polygon>
    </polygon>
    </GeometryComponents>And although this function is normally called from a procedure, here is a call from dual
    select MULTI_GML_TO_SDOGEOM ('<GeometryComponents xmlns:gml="http://www.opengis.net/gml/3.2">
    <polygon xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:srv="http://www.isotc211.org/2005/srv"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:mgmp="http://www.mod.uk/mgmp" xmlns:smr="http://www.mod.uk/smr"
    xmlns:xlink="http://www.w3.org/1999/xlink"><gml:Polygon gml:id="bp2" srsName="EPSG:4326">
    <gml:exterior>
    <gml:LinearRing>
    <gml:posList srsDimension="2">175 -40 176 -40 176 -39 175 -39 175 -40</gml:posList>
    </gml:LinearRing>
    </gml:exterior>
    </gml:Polygon>
    </polygon>
    </GeometryComponents>') from dual;Thanks in advance.

    Hi,
    I fail to see why you use dynamic SQL here.
    As said above, you're doing a lot of bad and unnecessary stuff, first of which being not using bind variables.
    Then I see a lot serializing/constructing on XMLType which just adds more overhead.
    Basically, the function can be simplified down to :
    create or replace function multi_gml_to_sdogeom (
      geometry_components in clob
    return sdo_geometry
    is
      v_sdogeom_all       SDO_GEOMETRY;
    begin
      select SDO_AGGR_SET_UNION(
               cast(
                 collect(
                   SDO_CS.TRANSFORM(SDO_UTIL.FROM_GML311GEOMETRY(spatial_location), 8307)
                 as sdo_geometry_array
             , .005
      into v_sdogeom_all
      from (
        select xmlserialize(content x.column_value) as spatial_location
        from xmltable(
               xmlnamespaces ('http://www.opengis.net/gml/3.2' as "gml")
             , '/GeometryComponents/polygon/(gml:Polygon|gml:Point)'
               passing xmlparse(document geometry_components)
             ) x
      return v_sdogeom_all;
    end;
    SQL> select multi_gml_to_sdogeom('<GeometryComponents xmlns:gml="http://www.opengis.net/gml/3.2">
      2  <polygon xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:srv="http://www.isotc211.org/2005/srv"
      3  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:mgmp="http://www.mod.uk/mgmp" xmlns:smr="http://www.mod.uk/smr"
      4  xmlns:xlink="http://www.w3.org/1999/xlink"><gml:Polygon gml:id="bp2" srsName="EPSG:4326">
      5  <gml:exterior>
      6  <gml:LinearRing>
      7  <gml:posList srsDimension="2">175 -40 176 -40 176 -39 175 -39 175 -40</gml:posList>
      8  </gml:LinearRing>
      9  </gml:exterior>
    10  </gml:Polygon>
    11  <gml:Point gml:id="p21" srsName="EPSG:4326">
    12      <gml:coordinates>45.67, 88.56</gml:coordinates>
    13    </gml:Point>
    14  </polygon>
    15  </GeometryComponents>')
    16  from dual ;
    MULTI_GML_TO_SDOGEOM('<GEOMETR
    <Object>
    Edited by: odie_63 on 8 janv. 2013 18:02

  • "PLS-00172: string literal too long" When Writing XML file into a Table

    Hi.
    I'm using DBMS_XMLStore to get a XML file into a db table. See the example below, I'm using that for my PL/SQL format. Problem is that because there're too many XML elements that I use in "xmldoc CLOB:= ...", I get "PLS-00172: string literal too long" error.
    Can someone suggest a workaround?
    THANKS!!!
    DECLARE
    insCtx DBMS_XMLStore.ctxType;
    rows NUMBER;
    xmldoc CLOB :=
    '<ROWSET>
    <ROW num="1">
    <EMPNO>7369</EMPNO>
    <SAL>1800</SAL>
    <HIREDATE>27-AUG-1996</HIREDATE>
    </ROW>
    <ROW>
    <EMPNO>2290</EMPNO>
    <SAL>2000</SAL>
    <HIREDATE>31-DEC-1992</HIREDATE>
    </ROW>
    </ROWSET>';
    BEGIN
    insCtx := DBMS_XMLStore.newContext('scott.emp'); -- get saved context
    DBMS_XMLStore.clearUpdateColumnList(insCtx); -- clear the update settings
    -- set the columns to be updated as a list of values
    DBMS_XMLStore.setUpdateColumn(insCtx,'EMPNO');
    DBMS_XMLStore.setUpdateColumn(insCtx,'SAL');
    DBMS_XMLStore.setUpdatecolumn(insCtx,'HIREDATE');
    -- Now insert the doc.
    -- This will only insert into EMPNO, SAL and HIREDATE columns
    rows := DBMS_XMLStore.insertXML(insCtx, xmlDoc);
    -- Close the context
    DBMS_XMLStore.closeContext(insCtx);
    END;
    /

    You ask where am getting the XML doc. Well, am not
    getting the doc itself.I either don't understand or I disagree. In your sample code, you're certainly creating an XML document-- your local variable "xmldoc" is an XML document.
    DBMS_XMLSTORE package needs
    to know the canonical format and that's what I
    hardcoded. Again, I either don't understand or I disagree... DBMS_XMLStore more or less assumes the format of the XML document itself-- there's a ROWSET tag, a ROW tag, and a then whatever column tags you'd like. You can override what tag identifies a row, but the rest is pretty much assumed. Your calls to setUpdateColumn identifies what subset of column tags in the XML document you're interested in.
    Later in code I use
    DBMS_XMLStore.setUpdateColumn to specify which
    columns are to be inserted.Agreed.
    xmldoc CLOB :=
    '<ROWSET>
    <ROW num="1">
    <KEY_OLD> Smoker </KEY_OLD>
    <KEY_NEW> 3 </KEY_NEW>
    <TRANSFORM> Specified </TRANSFORM>
    <KEY_OLD> Smoker </KEY_OLD>
    <VALUEOLD> -1 </VALUEOLD>
    EW> -1 </VALUENEW>
         <DESCRIPTION> NA </DESCRIPTION>
    </ROW>
    ROWSET>';This is your XML document. You almost certainly want to be reading this from the file system and/or have it passed in from another procedure. If you hard-code the XML document, you're limited to a 32k string literal, which is almost certainly causing the error you were reporting initially.
    As am writing this I'm realizing that I'm doing this
    wrong, because I do need to read the XML file from
    the filesystem (but insert the columns
    selectively)...What I need to come up with is a proc
    that would grab the XML file and do inserts into a
    relational table. The XML file will change in the
    future and that means that all my 'canonical format'
    code will be broken. How do I deal with anticipated
    change? Do I need to define/create an XML schema in
    10g if am just inserting into one relat. table from
    one XML file?What does "The XML file will change in the future" mean? Are you saying that the structure of the XML document will change? Or that the data in the XML document would change? Your code should only need to change if the structure of the document changes, which should be exceptionally uncommon and would only be an issue if you're adding another column that you want to work with, which would necessitate code changes.
    I found an article where the issue of changing XML
    file is dealt by using a XSL file (that's where I'd
    define the 'canonical format'), but am having a
    problem with creating one, because the source XML is
    screwed up in terms of the format:
    it's not <x> blah </x>
    <x2> blah </x2>
    x2="blah" x3="blah> ...etc
    Can you point me in the right direction, please?You can certainly use something like the DBMS_XSLProcessor package to transform whatever XML document you have into an XML document in an appropriate format for the XMLStore package and pass that transformed XML document into something like your sample procedure rather than defining the xmldoc local variable with a hard-coded document. Of course, you'd need to write appropriate XSL code to do the actual transform.
    Justin

  • Is there any way to create a time machine backup to an external hard drive with content already on it?  I have a hard drive that i have used for pictures but when i try to run a backup it says i need to start from a blank drive. Can i get around it?

    Is there any way to create a time machine backup to an external hard drive with content already on it?  I have a hard drive that i have used for pictures but when i try to run a backup it says i need to start from a blank drive. Can i get around it?

    It would be much better if you had separate drives for the pictures and Time Machine backups.....but, if you want to use the same drive for both purposes, temporarily move the folder with the pictures to another location for safe storage.
    Run the Time Machine backup on the hard drive and verify that everything is working correctly. Time Machine will format the disk for you in Mac OS Extended (Journaled) as part of the backup process.
    Then move the folder with the pictures back to the hard drive with the Time Machine backups.
    When you have tested to make sure that everything is working again, then and only then should you delete the folder with pictures from the temporary storage area.
    Again....it would be much better to keep Time Machine backups on a drive just for that purpose, and other data on another drive for that purpose. This is clearly one of those times when the fact that you can do something does not mean to imply that you should do it.

  • Unterminated string literal error every time firefox opens a page.

    Every time firefox opens a new page, the error pops up. It says Javascript error at the top of the error window - and the error is "unterminated string literal. It very annoying, some pages have multiple instances of the error window popping up on top of each other. I reloaded the program, no changes. I am ready to give up and go to Chrome (which does not have the error)

    This issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    If it works in Safe Mode and in normal mode with all extensions (Firefox/Tools > Add-ons > Extensions) disabled then try to find which extension is causing it by enabling one extension at a time until the problem reappears.
    Close and restart Firefox after each change via "Firefox > Exit" (Windows: Firefox/File > Exit; Mac: Firefox > Quit Firefox; Linux: Firefox/File > Quit)
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Email being sent multiple times when actions are triggered after creating an incident. Anyone has a resolution?

    Email being sent multiple times (3 times) when actions are triggered after creating an incident.
    Below is the snip of "Scheduled Actions" of the created Incident.

    Hi Ritesh
    Email is triggered based upon conditions and you set
    on closer look it is 3 different email on three 3 different requirement for e.g
    email triggered to reporter on new status
    email trigerred to processor on Proposed solution and New status
    Therefore, check the start condition for above 2 email actions and refer below blog
    Sending E-Mail from Support Message
    Thanks
    Prakhar

  • How can I create a Face Time account.  I have an Apple ID and password.  When I Google how to create an account all I get is what I need for the system

    I have a 13" MacPro.  How can I create a Face Time account.  I have an Apple ID and password.  When I Google how to create an account all I get is what I need for the system

    You don't need to create an account.   Your use your Apple ID to log into Facetime.
    If you haven't already you will need to download the Facetime App from the Mac App Store.
    https://itunes.apple.com/us/app/facetime/id414307850?mt=12&ls=1
    FaceTime for Mac: Troubleshooting FaceTime - Apple Support

  • Customer is getting created multiple tims when it has multiple sites

    Hi,
    I developed customer conversion.
    when I load data through conversion in R12 Customer is getting created multiple tims when it has multiple sites.
    what are the things I have to take care to prevent this.
    Please suggest me If any one has Idea.
    Thanks & Regards,
    Narendra.

    Hi Gabriel,
    Thanks for taking time to reply to my post.
    When one of my collegue giving the print, there is only one spool which is getting created, but when I run the program there are multiple spools are getting created.
    -Pradeep

  • String literal is not properly closed by a double-quote

    Hi,
    In my Java Class, this message appears:
    String literal is not properly closed by a double-quote
    LINE: The red part of the statement.
    Please help! Thanks!
    package demo;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.Persistence;
    public class Flights {
         private EntityManagerFactory emf;
        private EntityManager getEntityManager() {
            if (emf == null) {
                emf = Persistence.createEntityManagerFactory("Flights");
            return emf.createEntityManager();
        public Flights[] getFlights() {
            EntityManager em = getEntityManager();
            try {
                javax.persistence.Query q = em.createQuery("SELECT /*+ INDEX(lh_master_q lh_master_pk)*/ DISTINCT to_char(FD.FLIGHT_DATE, 'DY')||'.'|| FD.FLIGHT_DATE AS DATE_HEADER,
      FD.FLIGHT_DATE AS TRAVEL_DATE,
      B.CITY                       AS LEAVING,
      LM.STD                       AS DEPART,
      C.CITY                       AS ARRIVING,
      LM.STA                       AS ARR,
      LM.FNR                       AS FLIGHT,
      E.CARRIER                    AS AIRLINE,
      LM.ACTYPE                    AS AIRCRAFT,
      LM.ACTYPEFULLNAME            AS EQUIP,
      LM.STD ||' '|| LM.DEP ||' - '|| LM.STA ||' '|| LM.ARR AS SCHEDULE,
      B.CITY ||' - '|| C.CITY AS ROUTE
      MAX(CASE WHEN FA.BOOKING_CLASS = 'S' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS ECONOMY_SAVER,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'H' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS ECONOMY,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'B' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS ECONOMY_FLEXIBLE,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'Z' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS BUSINESS,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'D' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS BUSINESS_FLEXIBLE,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'F' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS FIRST_CLASS
    FROM LH_MASTER_Q LM, LH_FLIGHT_DATE FD, AIRPORTS_LOOKUP B, AIRPORTS_LOOKUP C, CARRIERS E, LH_FARES FA, LH_SERVICE_CLASS SC, LH_CABIN_CLASS CC
    WHERE LM.ROWNR = FD.FLIGHT_LEG_ID
       AND LM.DEP = FA.FROM_AP
       AND LM.ARR = FA.TO_AP
       AND LM.DEP = B.IATA_CODE
       AND LM.ARR = C.IATA_CODE
       AND LM.AL = E.CARRIER_CODE
       AND FA.BOOKING_CLASS = SC.BKG_CLASS_ID
       AND SC.CABIN_CLASS_ID = CC.CABIN_CLASS_ID
       AND LM.ACTYPE = FD.AIRCRAFT_TYPE
       AND B.CITY_CODE = :p_leaving
       AND C.CITY_CODE = :p_arriving
       AND CC.CABIN_CLASS_NAME = :p_class
       AND E.CARRIER = :p_airline
       AND FD.FLIGHT_DATE = :p_outbound
    GROUP BY FD.FLIGHT_DATE,
             to_char(FD.FLIGHT_DATE, 'DY')||'.'|| FD.FLIGHT_DATE,
             B.CITY,
             LM.STD,
             C.CITY,
             LM.STA,
             LM.FNR,
             E.CARRIER,
             LM.ACTYPE,
             LM.ACTYPEFULLNAME,
             LM.STD ||' '|| LM.DEP ||' - '|| LM.STA ||' '|| LM.ARR,
             B.CITY ||' - '|| C.CITY,
             to_char(FD.FLIGHT_DATE, 'DY')
    ORDER BY Depart;");
                return (Flights[]) q.getResultList().toArray(new Flights[0]);
            } finally {
                em.close();
    }

    From the Java specification (http://docs.oracle.com/javase/specs/jls/se5.0/html/lexical.html#3.10.5):
    It is a compile-time error for a line terminator to appear after the opening " and before the closing matching ".
    In other words, string literals cannot span lines.
    You can use the concatenation operator ( + ) to fix this:
    String myLiteral = "A long line " +
    "Another long line " +
    "Another long line, etc.";
    If you're going to ever print out that string literal (like for debugging purposes), it would probably be better to have a return at the end of each line (\n):
    String myLiteral = "A long line\n" +
    "Another long line\n" +
    "Another long line, etc.";
    Edited by: user739461 on Mar 5, 2012 8:10 AM

  • String Literal too long / CLOB Issue

    I have a table with a "Clob" column called Message. This is where I store the message of an email. We have an internal email app. What is happening is I can't insert anything bigger then around 3990 or something around there. In my procedure I have the parameter coming in as clob and I use a TO_CHAR() around the table column and my parameter or my procedure gives me this error
    PL/SQL: ORA-00932: inconsistent datatypes: expected - got CLOB
    But when it runs and I put in a 9000 character message it says
    Oracle.DataAccess.Client.OracleException was unhandled by user code
    Message="ORA-01704: string literal too long
    I'm using C# with
    Oracle.DataAccess.Client.OracleConnection to create my oracle connection and Oracle 10g.
    I'm calling this procedure from my app. By doing this am I causing it to only hold 4000 characters?
    Here is a scaled down version of my code on just that column
    CREATE OR REPLACE PROCEDURE EMAILINS (
    P_MSG IN CLOB
    AS
    varT VARCHAR2(10000);
    varSQL VARCHAR2(20000);
    varTemp NUMBER;
    BEGIN
    -- SEE IF STRING EXISTS
    SELECT 1 INTO varTemp
    FROM tblEmail
    WHERE TO_CHAR(MESSAGE) = P_MSG
    EXCEPTION
    WHEN TOO_MANY_ROWS THEN
    varSQL := varT||CHR(10)||'***Multiple Rows Exist in Table tblEmail***';
    DBMS_OUTPUT.PUT_LINE(varSQL);
    WHEN NO_DATA_FOUND THEN
    varT := P_MSG;
    varSQL := 'INSERT INTO TBL_EMAIL( MESSAGE)'||CHR(10);
    varSQL := varSQL || 'VALUES (tblEmail_SEQ.NEXTVAL,'||varT||')';
    EXECUTE IMMEDIATE varSQL;
    END EMAILINS;

    In the first place, you don't need (and surely don't want) dynamic SQL to do the insert. Replace
    varT := P_MSG;
    varSQL := 'INSERT INTO TBL_EMAIL( MESSAGE)'||CHR(10);
    varSQL := varSQL || 'VALUES (tblEmail_SEQ.NEXTVAL,'||varT||')';
    EXECUTE IMMEDIATE varSQL;with the simpler
    INSERT INTO tbl_email( <<primary key column>>, message )
      VALUES( tblEmail_Seq.nextval, p_msg );Secondly, you want to use the DBMS_LOB.COMPARE function to determine whether the contents of the LOBs match. So replace
    SELECT 1
      INTO varTemp
      FROM tblEmail
    WHERE TO_CHAR(MESSAGE) = P_MSG with
    SELECT 1
      INTO varTemp
      FROM tblEmail
    WHERE dbms_lob.compare( message, p_msg ) = 0Of course, it is going to be relatively expensive to run this query every time you insert a new message unless the table is always going to be very small, which seems unlikely. It also doesn't prevent duplicate entries if there are multiple threads executing at the same time.
    Justin

  • Feedback compilation time to the program

    I would like to be able to feedback the compilation time (or any information really) to the resulting java classes (or the resulting jar) when I compile. Eg so when the java program starts it writes somehing like "Program compiled 2003-08-25 13:10:31".
    I know this i possible in unix/linux by compiling with scripts (eg from the script modifying a String in the Java code before compiling), but my problem is that I'm using JBuilder so I can only compile without scripts.
    Any suggestions how this can be achieved without scripts?
    Gil

    ... without me having to sweat to
    keep track of the hundreds of java files...
    Ant is relatively intimidating, at least
    I thought so when I was trying to figure it out.
    The thing that really makes it manageable is that
    it uses regular expressions to specify lists of
    files.
    This allows one to easily ask Ant to run
    javac on all the java code files in directory
    "a" and put the resulting class "tree" into
    directory "b".
    The line of ant "code" to do what is described above
    would be as follows. The ${*} are properties that are
    substituted for values that are set earlier in the
    script. They can (of course) be literal paths.
    <javac srcdir="${src_dir}" destdir="${build_dir}"/>The above example does not actually use regular
    expressions, but hopefully it will demonstrate
    that Ant is not as complicated as it would appear.

  • Whats a String constant pool?

    I was reading an article about weak references and came across a peice of code
       Map<String,String> map = new WeakHashMap<String, String>();
          map.put(new String("Scott"), "McNealey");They also said
    if you don't call new String(), the reference for the map key will be to the system's string constant pool. This never goes away, so the weak reference will never be released. To get around this, new String("Scott") creates a reference to the reference in the string constant pool. The string contents are never duplicated. They stay in the constant pool. This simply creates a separate pointer to the string constant in the pool.
    I never heard of String constant pool could any one enlighten me. I didnt get the point of what above paragraph says also.
    Jubs

    No it won't: it will only be removed when the garbage collector rears
    its ugly head. Until then the reference will be present in the map.Okay it was unprecise. The item MAY be removed immediately after it
    has been inserted because the key object is only referenced from the
    Map itself.Yes, that is true, but mind though: any object that still has a strong
    reference to it will not be removed from that map. I use such weak maps
    for localization reasons a lot. When a localization changes (while the
    application is running), a whole lot of visual components must have
    their text part changed. They are all stored in such a weak reference map.
    Of course quite some visual components can be garbage collected
    at some time (think of labels etc. in JDialogs after the dialog has been
    disposed).
    These maps are ideal for those purposes.
    kind regards,
    Jos

Maybe you are looking for

  • Computer not responding during migration assist

    I bought a 27" iMac and have been trying to use migration assist to transfer my files and settings over from my 17" MacBook Pro with little success.  The iMac recognizes the MacBook and the confirmation code pops up on both but once the migration beg

  • Installing Windows 8.1 Enterprise on a Windows 8.1 OEM Laptop

    Hello, I have a new ASUS laptop running an OEM version of basic Windows 8.1. I've installed many applications and put much time personalizing the GUI. I wish to upgrade it to Windows 8.1 Enterprise (I have an enterprise key from MVLS volume license).

  • BIP 11g data set links

    Hi Gurus, I'm not sure if this is how BIP was designed to work or if this is an issue. I have 2 very simple queries that I am using as data sets. These queries are only for illustrative purposes. In my first data model, I type in the SQL queries (I d

  • Cant print in Word 2010 or Adobe Reader pdf files

    I run Windows 7 and have an HP Officejet Pro 6835 connected wirelessly via my router.  I am able to print test pages and WordPad docs but not from Word 2010 or Adobe Reader.  Please help! =)

  • Passing resultsets in a method

    Hello all I am curious what the general thought/idea is about methods passing result sets to the caller - I am guessing bad idea correct ?