Convert String to CLOB problem, CLOB is a input parameter in the procedure.

I can not flush and close "Writer"??
The following code:
CLOB inclob=null;
CallableStatement csr=conn.prepareCall ("begin TestClob(?); end;");
csr.registerOutParameter (1, Types.CLOB);
inclob = CLOB.createTemporary(conn,false,CLOB.DURATION_CALL);
inclob .open(CLOB.MODE_READWRITE);
Writer tempClobWriter = inclob.getCharacterOutputStream();
tempClobWriter.write("This is In CLOB");
// Flush and close the stream
tempClobWriter.flush(); // problem is here
tempClobWriter.close();//problem is here
inclob.close();// this works
Btw:
How to use CLOB.setString() to specify string to CLOB directly?
Message was edited by:
user515324

sorry, I fogot mention the error is "No data to read from socket"
My Oracle JDBC driver is 9.2.0.4, Oracle database is 10.2.1.0
Some guy said it is driver's problem.

Similar Messages

  • How can I search for a string, as an input parameter to a procedure?

    Hi all,
    I need to solve one scenario. In this the search string and search against columns, both are passed as input parameters to a procedure. till now i didn't face this situation.. can you please help me in this by giving some sample code...
    Thanks in advance.
    Regards,
    Ramu.

    Maybe something like this then?
    SQL> CREATE OR REPLACE PROCEDURE EMP_SEARCH
      2  (
      3          pColumnName     IN VARCHAR2
      4  ,       pSearchParam    IN VARCHAR2
      5  ,       pResult         OUT SYS_REFCURSOR
      6  )
      7  AS
      8  BEGIN
      9          IF UPPER(pColumnName) = 'ENAME' THEN
    10                  OPEN pResult FOR
    11                          SELECT  ENAME
    12                          FROM    SCOTT.EMP
    13                          WHERE   ENAME LIKE '%' || pSearchParam || '%';
    14          ELSIF UPPER(pColumnName) = 'JOB' THEN
    15                  OPEN pResult FOR
    16                          SELECT  ENAME
    17                          FROM    SCOTT.EMP
    18                          WHERE   JOB LIKE '%' || pSearchParam || '%';
    19          ELSIF UPPER(pColumnName) = 'DEPTNO' THEN
    20                  OPEN pResult FOR
    21                          SELECT  ENAME
    22                          FROM    SCOTT.EMP
    23                          WHERE   DEPTNO LIKE '%' || pSearchParam || '%'
    24          END IF;
    25  END;
    26  /
    SP2-0804: Procedure created with compilation warnings
    SQL> VAR C REFCURSOR
    SQL> EXEC EMP_SEARCH('ENAME','SMITH',:c);
    PL/SQL procedure successfully completed.
    SQL> PRINT c;
    ENAME
    SMITH
    SQL> EXEC EMP_SEARCH('JOB','MANAGER',:c);
    PL/SQL procedure successfully completed.
    SQL> print c;
    ENAME
    JONES
    BLAKE
    CLARK
    SQL> EXEC EMP_SEARCH('DEPTNO','30',:c);
    PL/SQL procedure successfully completed.
    SQL> print c
    ENAME
    ALLEN
    WARD
    MARTIN
    BLAKE
    TURNER
    JAMES
    6 rows selected.Be careful though. If you have a large amount of data this search could take a long time because Oracle will not choose an indexed path. If that's an issue you should investigate using Oracle Text.
    HTH!
    Edited by: Centinul on Apr 26, 2010 7:36 AM

  • Problem in mapping BIGBINARY input parameter

    Hi All,
    I am trying to create an operation of 'OTHER' type in SUP 2.2. The input parameter structure is having an 'BIGBINARY' attribute. This attribute is used to send photos. But the input structure is not coming under client parameters and unable to map it. While generating code for iOS the particular input structure is abandoned.
    So, kindly help me how to handle this...
    Thanks,
    Saju KS

    Hi Neha,
    Please create the custom context node/attribute same structure as RFC model node. then populate the data using below following code :
    - get the size of the RFC model node which you want to populate in the costom node like
    int xxx =  wdContext.node<XXX node>().size;
    - Create onject for custom node like
      I<Custyom Name>Element element = null;
    -  then use for loop for fetching data from Model node and populate in custom node
    for(int i =0; i<xxx; i++)
             element = wdContext.create<Custyom Name>();
             element.set<Attribute Name>(wdContext.node<XXX>().get<XXX>ElementAt(i).get<>Attribute name for model())
             wdContext.<Custyom Name>().addElement(element);
    It will populate in your custom node from model node.
    Hope it will helps you.
    Regards
    Arun

  • How to convert string to an integer in SQL Server 2008

    Hi All,
    How to convert string to an integer in sql server,
    Input : string str="1,2,3,5"
    Output would be : 1,2,3,5
    Thanks in advance.
    Regards,
    Sunil

    No, you cannot convert to INT and get 1,2,3 BUT you can get
    1
    2
    3
    Is it ok?
    CREATE FUNCTION [dbo].[SplitString]
             @str VARCHAR(MAX)
        RETURNS @ret TABLE (token VARCHAR(MAX))
         AS
         BEGIN
        DECLARE @x XML 
        SET @x = '<t>' + REPLACE(@str, ',', '</t><t>') + '</t>'
        INSERT INTO @ret
            SELECT x.i.value('.', 'VARCHAR(MAX)') AS token
            FROM @x.nodes('//t') x(i)
        RETURN
       END
    ----Usage
    SELECT * FROM SplitString ('1,2,3')
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to invoke PL/SQL Table parameter in the query string?

    Hello,
    I've met a problem invoking PL/SQL Table parameter in the query string, in OWS 3.0.
    What I'm going to do is, to invoke a stored procedure to generate a web page using PL/SQL Web Toolkit 2.0, like: "http://.../owa/test_proc".
    But there is a IN parameter for this procedure, and it's a PL/SQL Table variable. So I can't invoke the procedure sucessfully just using "http://.../owa/test_proc?v_plsql=i_plsql".
    Did someone have met this kind of problem or have the answer to it? Thanks so much for your help.

    When using procedures with pl/sql-tables as parameter they should be overloaded, e.g.:
    procedure my_procedure (my_var in varchar2)...
    and
    procedure my_procedure (my_var in owa_util.ident_arr)
    the procedure then can be called with:
    http://..../my_procedure?my_var=Scott, which invokes the version with the varchar2 parameter, or
    http://..../my_procedure?my_var=Scott&my_var=Miller......
    which invokes the version with the pl/sql-Table
    Another solution might be the use of flexible parameters, passing pairs of parameter_name, parameter_value to your procedure. Your procedure looks like:
    procedure my_procedure (name_array IN owa.vc_arr, value_array IN owa.vc_arr)..
    and is invoked (note the ! )
    http://..../!my_procedure?ename=Scott&sal=200&job=clerk.....
    looping through the pl/sql tables will retrieve values of ename, sal and job for name_array and Scott, 200 and clerk for value_array
    Hth
    null

  • Problem displaying checkbox in searchhelp + default fixed input-parameter

    Hello,
    At a CRM 7 project we are facing the following 2 problems with a 'customer'-searchhelp
    I have created the searchhelp in SE11, the data is fetched via a search-help exit, and I call the search-help via the GET_V method of my attribute
    This is working fine ...
    But one of the input-parameters of my search-help should be displayed as a checkbox iso a 1 char field.
    How can I influence this ?
    Normally I would use the GET_I method but this time I do not have the component-name/view ... and even when I did, I assume this is a generic component/view attribute used for every searchhelp
    Second problem is that one input parameter should be defaulted. Normally I can use the INPUT-MAPPING table.
    However this time this is not possible since the value I need to pass is not available as an attribute in my component.
    I tried to use the 'PRESEL' step in my search-help exit, this is working fine when I test in SAP-gui but in the Web-UI the system apparently does not go thru this step.
    Why ?
    Does anyone have an alternative ?
    Best regards,
    Erwin

    Hi,
         If not already done, try using the XFELD data element for the check box field.
    Regards,
    Arun Prakash

  • Problems getting a resultset out of a stored procedure

    We're having a problem getting a resultset out of a stored procedure with JDBC. The third parameter for the procedure is an out REF CURSOR. Connection to the database is fine, we just keep getting the following error when we do the GetCursor(3) statement:
    ORA-00942: table or view does not exist
    We know for definate that something is coming out of the database as we can call it from ODBC without any errors. If anyone's got any ideas as to what's going wrong please let me know!
    The cut-down code follows:
    public class JSMatt extends HttpServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    PrintWriter out = resp.getWriter();
    // Load the Oracle JDBC driver
    out.println("Registering driver...");
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // Connect to the DB
    out.println("Connecting to database...");
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@computer:db",
    "username", "password");
    // Create a statement using a stored procedure
    out.println("Creating query...");
    OracleCallableStatement st = (OracleCallableStatement)conn.prepareCall ("BEGIN archive.spSrchLanguage (?, ?, ?); END;");
    st.registerOutParameter(3, OracleTypes.CURSOR);
    st.setInt(1, 0);
    st.setInt(2, 12);
    st.execute();
    ResultSet rs = ((OracleCallableStatement)st).getCursor(3);
    null

    Further study of my colleagues issue reveals that the problem only occurs where we are using a synonym for our package even though the user has permissions to run it (and indeed does when using ODBC or OLEDB).
    If we call a procedure in our package which does not return a ref cursor then the procedure is getting called fine (as can be evidenced by the database inserts etc within the procedures).
    Ideally we would like to use a synonym (I like to keep nice clean tidy schemas!) so if anyone knows how to get around it please let us know.
    Regards
    Jason.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Matthew Butt ([email protected]):
    We're having a problem getting a resultset out of a stored procedure with JDBC. The third parameter for the procedure is an out REF CURSOR. Connection to the database is fine, we just keep getting the following error when we do the GetCursor(3) statement:
    ORA-00942: table or view does not exist
    We know for definate that something is coming out of the database as we can call it from ODBC without any errors. If anyone's got any ideas as to what's going wrong please let me know!
    The cut-down code follows:
    public class JSMatt extends HttpServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    PrintWriter out = resp.getWriter();
    // Load the Oracle JDBC driver
    out.println("Registering driver...");
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // Connect to the DB
    out.println("Connecting to database...");
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@computer:db",
    "username", "password");
    // Create a statement using a stored procedure
    out.println("Creating query...");
    OracleCallableStatement st = (OracleCallableStatement)conn.prepareCall ("BEGIN archive.spSrchLanguage (?, ?, ?); END;");
    st.registerOutParameter(3, OracleTypes.CURSOR);
    st.setInt(1, 0);
    st.setInt(2, 12);
    st.execute();
    ResultSet rs = ((OracleCallableStatement)st).getCursor(3);
    <HR></BLOCKQUOTE>
    null

  • QL "In Expression" with Collection|String[] input parameter

    Hello,
    I would like to use the 'IN expression' in EJB-QL, with an input parameter, containing the values of the input list.
    Scheme Order with fields:
    id
    name
    status I Would like to get all records with certain status-values, for example 'open' or 'closed'
    The final sql code executed for the example at runtime will be:
    select * from order where status in('open', 'closed')I would like to do this parameter-based in EJB-QL.
    The signature of the finder it should be:
    java.util.Collection findByStatus(java.util.Collection aStatusList)The Query would be:
    query="SELECT OBJECT(t) FROM Order as t WHERE t.status in(?1)"However, this way doesn't work, even when I change the parameter type to java.lang.String[]. A dirty way to check multiple statusses, is to add a parameter for each status:
    * @ejb.finder
    *           signature="java.util.Collection findByStatus(java.lang.String aStatus, java.lang.String anotherStatus)"
    *           query="SELECT OBJECT(t) FROM Order as t WHERE t.status IN (?1, ?2)"
    */This is not a generic solution. Is it possible to send a Collection or array input parameter, as items in the list of "in expressions"?

    Ok, I wondered if it was possible. I just thought that
    another solution might work: by defining my own
    Collection datatype, with a tostring method that
    returns data in format "'value1', 'valu2', '...'" . I
    will try that at last, if I find the time.I didn't quite follow what you meant. But from whatever I understand, just binding your own defined datatype wouldn't cause toString to be invoked on it, right?
    You are going to have to know upfront how many parameters are going to be there. I faced a similar situation once. I was just using SQL though and not EJB-QL. But couldn't use PreparedStatement with the IN clause because of this. I guess this limitation of PreparedStatement is well-known.

  • How to convert String into Clob in Java?

    Hi all,
    from a form i have a
    String body = request.getParameter("body_name");
    i want to insert the string body to a clob field in oracle.
    string is from a textarea where the user enter html contents and i want to storeit as a clob in the database.
    can anybody help ?
    I have done with setCharaceteStream(), but it will take only 4000 characters. which suppose to take upto 4GB limit.
    So I want to set it as stmt.setClob(" some form by using String")
    Pls. help me if you can?
    thanks in advance
    Srikanth

    Have you tried using setString?
    null

  • CLOB problem in 9.0.4

    hi all,
    I recently converted two LONG columns to a CLOBs. there is no default value on either of these columns.
    The forms properties for the CLOBs are data type: LONG, max length : 32000, data length semantics: NULL
    During testing, I found that any data entered in the form field, would not be saved to the DB, even though all indications were a good save/commit. the data seemed to disappear.
    a direct update statment via sql*plus updates the CLOB without any problems.
    Luckily, i received in oracle insert error. the HELP menu, display errors showed me why the data was disappearing. forms was sending an EMPTY_LOB no matter what is typed into the field. please see below. the save is working, however forms insert is not using the data from the form, it is submitting EMPTY_CLOB()!!
    i have searched everywhere to find the EMPTY_CLOB() statment. it does not exist in the form or attached libraries ( or on the database fo that matter).
    does anyone have any ideas for me, on finding it, or preventing it.
    INSERT INTO bg_bug(LOGGED_BY,BUG_SEQ_NUM,BUG_DESCRIP,STATUS_CODE,STATUS_CHANGE_DATE,PROJ_CODE,MODULE_NAME,SEVERITY_CODE,ASSIGNED_TO,LOGGED_DATE,tech_liaison,REQUESTOR,DUE_DATE,LOCK_BUG,LOCKED_BY,PRIVATE_BUG,PRIVATE_BY,MOO,moo_history,developer_comment) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,:17,:18,EMPTY_CLOB(),EMPTY_CLOB()) RETURNING ROWID,LOGGED_BY,BUG_SEQ_NUM,BUG_DESCRIP,STATUS_CODE,STATUS_CHANGE_DATE,PROJ_CODE,MODULE_NAME,SEVERITY_CODE,ASSIGNED_TO,LOGGED_DATE,tech_liaison,REQUESTOR,DUE_DATE,LOCK_BUG,LOCKED_BY,PRIVATE_BUG,PRIVATE_BY,MOO,moo_history,developer_comment INTO :21,:22,:23,:24,:25,:26,:27,:28,:29,:30,:31,:32,:33,:34,:35,:36,:37,:38,:39,:40,:41

    I have a problem when passing a CLOB value from FORMS to a backend procedure.
    I have coded a back-end proc to accept CLOB data and update a table. In the Forms, I have code in the POST-INSERT (since I have made CLOB column as non-database item) trigger to get the CLOB item of the block and invoke the backend procedure passing the clob as a parameter.
    On testing, I found that the data updated in the table by the proc is[b] JUNK.
    To narrow the problem, I have used dbms_lob.read in back-end proc to read the clob value in to another varchar variable and this varchar variable contains the correct data. So, the data passed from the front-end to back-end seems to be okay. But, instead of varchar, if I copy data into another CLOB variable using dbms_lob.copy in back-end proc, and display this variable, I find junk value. Similarly, the clob data getting into the clob field of the table is junk.
    So, there seems to be some charset(??) conversion problem between client CLOB and Server CLOB. Not sure how to resolve this.
    Could someone please advise?
    Code Snipplet
    POST-INSERT on forms
    ==================
    declare
    vCmttext CLOB;
    msgendtag VARCHAR2(100) CHARACTER SET vCmttext%CHARSET:= '</ichicsr>';
    begin
    dbms_lob.createtemporary (vCmttext,TRUE,10);
    dbms_lob.open (vCmttext,1);
    dbms_lob.write(vCmttext,length (msgendtag),1, msgendtag);
    AS_TEST_LOG_UPD(id,seq_nbr,vCmttext);
    end;
    BackEnd Proc
    ==========
    CREATE OR REPLACE PROCEDURE AS_TEST_LOG_UPD(vid varchar2, vSEQ_NBR number,
    vCommenttext TEST_LOG.CMNT%type)
    AS
    l_text_buffer varchar2(100);
    l_text_amount BINARY_INTEGER := 100;
    vComment1 clob CHARACTER SET vCommenttext%CHARSET;
    amt INTEGER := 3000;
    BEGIN
    dbms_lob.read(vCommenttext, l_text_amount, 1, l_text_buffer );
    DebugProcFunc('clob.txt',l_text_buffer); --- This Prints the correct data
    dbms_lob.createtemporary (vComment1,TRUE,10);
    dbms_lob.open (vComment1,1);
    dbms_lob.copy (vComment1,vCommenttext, amt, 1, 1); -- Copy the Client CLOB to server CLOB
    dbms_lob.read(vComment1, l_text_amount, 1, l_text_buffer ); --- This Prints the JUNK data
    DebugProcFunc('clob.txt',l_text_buffer);
    Update TEST_LOG Set
    CMNT = vComment1 -- Updating the Junk data
    Where ID = vid and SEQ_NBR = vSEQ_NBR;
    END;
    Thank you,
    Beena

  • 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

  • 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

  • Can I convert existing column BLOB to CLOB?

    Hi ,
    I need conversion of existing column from BLOB to CLOB. Kindly sueggest workaround. Table structure is as
    { desc tab1;
    Name Null? Type
    Name Null? Type
    RECID NOT NULL VARCHAR2(255)
    XMLRECORD BLOB}
    I need to convert it from blob to clob. Kindly provide workaround.
    Regards

    Hi,
    How can i use this function for my scenario
    1. Table name is "test" and XMLRECORD column should be in CLOB without drop table. Kindly update this fuction as per my scenario and also provide all the steps
    CREATE OR REPLACE FUNCTION blob_to_clob (blob_in IN BLOB)
    RETURN CLOB
    AS
    v_clob CLOB;
    v_varchar VARCHAR2(32767);
    v_start PLS_INTEGER := 1;
    v_buffer PLS_INTEGER := 32767;
    BEGIN
    DBMS_LOB.CREATETEMPORARY(v_clob, TRUE);
    FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(blob_in) / v_buffer)
    LOOP
    v_varchar := UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(blob_in, v_buffer, v_start));
    DBMS_LOB.WRITEAPPEND(v_clob, LENGTH(v_varchar), v_varchar);
    v_start := v_start + v_buffer;
    END LOOP;
    RETURN v_clob;
    END blob_to_clob;
    ]

  • How do I convert ClobDomain to java.sql.Clob?

    I have an instance of oracle.jbo.domain.ClobDomain and i need
    to convert it to oracle.sql.CLOB. How do I do this?

    Sascha, I tried your solution:
    clobData = (CLOB) content.getData();
    Alas, it does not work. Although content has a value, clobData becomes null
    Also, if I take a look in the source ClobDomain.data, the method getData has the following
    comment:
    * Internal:Applications should not use this method.
    Does anybody know a way out?
    lebbol

  • Facing problem in converting string to date using getOANLSServices()

    I am trying to set a value for date field in my vo and trying to insert into the table.
    In controller I am getting the String which has a date:
    ex: String date="01-NOV-2007";
    while setting into the row I need to convert into Date but it is returning null.
    The below code I used
    to convert into date :
    Date dt = new Date(getOADBTransaction().getOANLSServices().stringToDate(date));
    But this dt is returning a null value is there any solution please advise me.
    Regards!
    Smarajeet

    Smarajeet ,
    See this thread, in one of my replies i have mentioned how to convert string to java.sql.date.You can use the same for oracle.jbo.domain.Date.
    urgent!How to set the default selected date for an OAMessageDateFieldBean
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Shared review problems with Acrobat X Pro

    I have used Acrobat X Pro many times to create a shared review without any problems. Yesterday I went to share a few files for review and kept getting the error "could not save the shared review enabled pdf file." I googled this problem and have trie

  • How to change the initial value of the list.

    Hi, I have to change the initial value of the list.In the 'When-new-block instance' trigger, i wrote the following: set_item_property(list_id,initial_value, '2000'); But when I run the form, it says this property is not recognised. I need to change t

  • URGENT :Account Group changes ?

    Dear Guru's, Do we have any report in SAP for veiwing the Customers whose account group has been changed. Through XD07 transactions : or can you please give me which table feilds  are updated (if indicator feilds ) when we change the account group of

  • SSL termination and URL redirection

    Hi All, I have configured application in cisco ACE module for which i got more requirement for URL redirection. Application setup is as below. VIP : 10.232.92.x/24 which is pointing to 2 Web server 10.232.94.x/24 range. In addition to that app team w

  • Structured framemaker window does not maximize and other issues

    Dear All, My questions concerns the use of FM11 & FM12 in Structured FrameMaker mode under Windows 8.1. When FM is started in Structured mode I find that the FrameMaker window is a fraction of the size that it was when operating in Unstructured mode.