Jstl sql  limit offset param???

there is an syntax error in this code
can you help me?
<sql:query var="studentList" scope="request">
SELECT * FROM student
WHERE fName LIKE ? AND
name LIKE ? AND
surname LIKE ? AND
lang LIKE ?
ORDER BY surname, name
LIMIT ? , 20
<sql:param value="%${param.firmname}%" />
<sql:param value="%${param.sName}%" />
<sql:param value="%${param.sSurname}%" />
<sql:param value="%${param.sLang}%" />
<sql:param value="${start}" />
</sql:query>

The problem is that you are telling the PreparedStatement that is being made using the
sql:update tag that there is only one parameter. Both by adding just one ? and
by using just one sql:param tag (which I believe has to be 1:1 with the ?s).
Anyway, in order for the PreparedStatement to know that there is going to be multiple
parameters, you have to pass the correct amount of ?s. If it will always be three, you
would use:
  <sql:update>
    update my set t=1 where id in(?,?,?)
    <c:forEach var="a" items="${paramValues.a}">
      <sql:param>${a}</sql:param>
    </c:forEach>
  </sql:update>But for the more likely case where you do not know how many ?s there will be, you would use
  <c:set var="aCount">
    ${fn:count(paramValues.a)}
  </c:set>
  <c:set var="sqlString">
    update my set t=1 where id in(
    <c:forEach begin="0" end="aCount">
    </c:forEach>
  </c:set>
  <sql:update>
    ${sqlString}
    <c:forEach var="a" items="${paramValues.a}">
      <sql:param>${a}</sql:param>
    </c:forEach>
  </sql:update>You might want to check out that c:forEach ... ?, It is untested, and I am not sure how the DB will handle the extra comma.
However, unless this same update, with the same number of parameters, is likely to occur multiple
times, you are gaining no benefit from using the PreparedStatement, and you are probably better off
going with the simpler Stament syntax you already used.
  <c:set var="a">
    ${fn:join(paramValues.a,",")}
  </c:set>
  <sql:update>
    update my set t=1 where id in(${a})
  </sql:update>

Similar Messages

  • Class not found javax.servlet.jsp.jstl.sql.Result in Richfaces

    When I try to run the richfaces application using Weblogic 10.3 AS and Netbean IDE 6.9.1, I found ClassNotFoundException on javax.servlet.jsp.jstl.sql.Result class.
    I class path the following libs.
    commons-beanutils-core-1.8.0.jar
    commons-digester-1.8.jar
    commons-fileupload-1.2.1.jar
    commons-io-1.2.jar
    commons-logging-1.1.1.jar
    glassfish.el_2.1.1.jar
    glassfish.jsf_1.2.9.0.jar
    javassist-3.8.0.GA.jar
    jhighlight-1.0.jar
    jsf-facelets.jar
    jsf-api.jar
    log4j-1.2.14.jar
    richfaces-api-3.3.0.GA.jar
    richfaces-impl-3.3.0.GA.jar
    richfaces-ui-3.3.0.GA.jar
    glassfish.jstl_1.2.0.1.jar
    Also I try to deploy without using some jar files already exists in application server.
    My web.xml configuration is-
    <context-param>
    <param-name>org.richfaces.SKIN</param-name>
    <param-value>#{skinSelector.skin}</param-value>
    </context-param>
    <context-param>
    <param-name>org.richfaces.CONTROL_SKINNING</param-name>
    <param-value>enable</param-value>
    </context-param>
    <context-param>
    <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
    </context-param>
    <context-param>
    <param-name>org.ajax4jsf.SKIN</param-name>
    <param-value>skin_name</param-value>
    </context-param>
    <filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <login-config>
    <auth-method>BASIC</auth-method>
    </login-config>
    <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    I also try to configure <library-ref>....</libray-ref> configuration in weblogic.xml and weblogic-application.xml and I also deploy JSF-2.0.war as library in application.
    Please
    h5.MUTU

    So why didn't you think that the JSP forum here wasn't a good place to ask JSP questions like this one?
    You can use <c:for-each> with a List. That's how it's designed. I don't understand why you say you can't. Perhaps you were confused by the SQL tags in JSTL. But anyway, you should just return a List from your EJB and forget about using obscure internal JSP classes.

  • Help on JSTL sql:query / tag

    Hi.....
    Currently i am trying to query a date from MSSQL using <sql> tag. I had tested in MSSQL on this SQL statement which is:-
    SELECT * FROM hr_leave WHERE startDate LIKE 'Apr 20 2006%'
    It can query my MSSQL datetime.
    Then , I apply this query inside my JSP/JSTL page which is :-
    <%@ include file="/common/header.jsp" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <jsp:useBean id="now" class="java.text.SimpleDateFormat"/> <!-- get current date -->
    <c:set var="userid" value="${sessionScope.currentUser.id}"/> <!-- get current user id -->
    <c:set var="dates"><fmt:formatDate value="${now}" type="DATE" pattern="MMM dd yyyy"/></c:set>
    <sql:setDataSource var="ds" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://192.168.250.86:1223;DatabaseName=eleavedb;SelectMethod=cursor" user="sa" password="sapassword"/>
    <sql:query var="countLeave" dataSource="${ds}">
    SELECT * FROM hr_leave_entry WHERE startDate LIKE (?, '%')
    <sql:param value="${dates}"/>
    </sql:query>
    From the code above it displayed an an error for me. I am worried whether my select statement and my way of using the '%' symbol is it not correct.
    Can anyone guide me? Thank You!

    And the error was?
    No, that sql does not look valid the way that you have written it.
    Parameters are NOT copied/pasted into sql strings. They replace the value directly. So the correct sql would be
    SELECT * FROM hr_leave_entry WHERE startDate LIKE ?
    You would need to actually pass the parameter as 'Apr 20 2006%'

  • JSTL sql tags with jndi datasource

              Im trying to use JSTL sql tags but get "no suitable driver" when trying to connect
              to a jndi datasource. the jakarta dbtags works fine but jstl does not
              

              I figured it out but I'll leave it up to BEA to tell everyone how to doit.
              "Fred Forester" <[email protected]> wrote:
              >
              >
              >Im trying to use JSTL sql tags but get "no suitable driver" when trying
              >to connect
              >to a jndi datasource. the jakarta dbtags works fine but jstl does not
              

  • Pass jstl sql query result to jsp

    Hi I have the following code which works perfectly
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <sql:setDataSource dataSource="jdbc/dbtest"/>
    <sql:query var="items" sql="SELECT * FROM homepagesubscriptions">
    </sql:query>
    <table border="0" align="center" valign="top">
    <c:forEach var="row" items="${items.rows}" begin = "0" end="10" >
                   <tr>
                   <td>
                        <img src="${row.imgurl}" width="100" height = "100"></a>
                   </td>
                   <tr>
    </c:forEach>
    </table>   Now what I want is to perform the query in one page and then display the data in another, as such
    index.jsp
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <sql:setDataSource dataSource="jdbc/dbtest"/>
    <sql:query var="items" sql="SELECT * FROM homepagesubscriptions">
    </sql:query>
    <!-- NOT SURE WHAT TO DO HERE
    <jsp:useBean id="resultBean" scope="request"
         class="javax.servlet.jsp.jstl.sql.ResultSupport" />
    <jsp:setProperty name="rs" property="rs" />
    <jsp:forward page="test.jsp" />
    -->
        test.jsp
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <c:set var="items" value="${resultBean}" />
    <table border="0" align="center" valign="top">
    <c:forEach var="row" items="${items.rows}" begin = "0" end="10" >
                   <tr>
                   <td>
                        <img src="${row.imgurl}" width="100" height = "100"></a>
                   </td>
                   <tr>
    </c:forEach>
    </table>   I know in index.jsp I can use jsp forward and usebean but am not sure how to? What type is the result from the query? thanks

    Take a look at the "scope" attribute of the <sql:query> tag.
    query.jsp:
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <sql:setDataSource dataSource="jdbc/dbtest"/>
    <sql:query var="items" scope="request" sql="SELECT * FROM homepagesubscriptions"/>
    <jsp:forward page="test.jsp" />and then test.jsp:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
    <table border="0" align="center" valign="top">
    <c:forEach var="row" items="${items.rows}" begin = "0" end="10" >
                   <tr>
                   <td>
                        <img src="${row.imgurl}" width="100" height = "100"></a>
                   </td>
                   <tr>
    </c:forEach>
    </table>  

  • JSTL - SQL Server Database Connectivity problem

    Hi All
    I am trying to implement DB connection using JSTL sql tag using the following code :-
    <c:set value="jdbc:sqlserver://localhost;databaseName=Studentreg;user=sa;password=pass" var="URL"/>
    <sql:setDataSource driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="${URL}" user="sa" password="pass" var="stc"/>
    But I am getting the error :-
    exception
    javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
    root cause
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
    But when I am trying to implement the same using the jdbc-odbc driver It work fine. This is the code:-
    <sql:setDataSource driver="sun.jdbc.odbc.JdbcOdbcDriver" url="jdbc:odbc:dsn_name" user="sa" password="pass" var="stc"/>
    Please help me in this regards
    Thanks in Advance
    Sulfikkar

    java.sql.SQLException: No suitable driverMeans that it can not find the JDBC driver in the classpath.
    Make sure your Database driver is in your WEB-INF/lib directory, or [TOMCAT]/common/lib directory (or equivalent)
    Cheers,
    evnafets

  • Javax.servlet.jsp.jstl.sql.Result and arraylist

    Hi,
    I try to explain my problem, I have posted in another section of forum, but perhaps this is a better place:
    I'm trying to use MVC model, so I call an EJB from a servlet which returns me a javax.servlet.jsp.jstl.sql.Result object (this derive from a resultset of a query) and then I make this available to a jsp page.
    I've choosen to return an javax.servlet.jsp.jstl.sql.Result object because I'd like to use this syntax:
    <c:forEach var="profiloString" items="${listaProfili}" >
              ${profiloString.anything}
    </c:forEach>Now I need to put my listaProfili object in session and permit users of my application to add and delete items from it. Finally I will update my database with the new data from listaProfili object.
    If listaProfili is an arraylist I can easily add or delete item from it, but if it is a javax.servlet.jsp.jstl.sql.Result I don't know how I can do this.
    If I return an arraylist object instead of an javax.servlet.jsp.jstl.sql.Result object, I can't use "<c:forEach ..." syntax.
    Can anyone help me?
    Thanks.

    So why didn't you think that the JSP forum here wasn't a good place to ask JSP questions like this one?
    You can use <c:for-each> with a List. That's how it's designed. I don't understand why you say you can't. Perhaps you were confused by the SQL tags in JSTL. But anyway, you should just return a List from your EJB and forget about using obscure internal JSP classes.

  • JSTL sql:param has problems

    a.jsp?id=1&id=2&id=3
    <c:set var="a">
    ${fn:join(paramValues.a,",")}
    </c:set>
    when print out the value of a
    ${a}
    is:
    1,2,3
    <sql:update>
    update my set t=1 where id in(?)
    <sql:param>${a}</sql:param>
    </sql:update>
    when this happens,hope have 3 datas was update
    but in fact only the data whose id is 1 is update,
    but if i use
    <sql:update>update my set t=1 where id in(${a})
    </sql:update>
    all of them are updated succeed,how does it ?
    Am i have some errors ?

    The problem is that you are telling the PreparedStatement that is being made using the
    sql:update tag that there is only one parameter. Both by adding just one ? and
    by using just one sql:param tag (which I believe has to be 1:1 with the ?s).
    Anyway, in order for the PreparedStatement to know that there is going to be multiple
    parameters, you have to pass the correct amount of ?s. If it will always be three, you
    would use:
      <sql:update>
        update my set t=1 where id in(?,?,?)
        <c:forEach var="a" items="${paramValues.a}">
          <sql:param>${a}</sql:param>
        </c:forEach>
      </sql:update>But for the more likely case where you do not know how many ?s there will be, you would use
      <c:set var="aCount">
        ${fn:count(paramValues.a)}
      </c:set>
      <c:set var="sqlString">
        update my set t=1 where id in(
        <c:forEach begin="0" end="aCount">
        </c:forEach>
      </c:set>
      <sql:update>
        ${sqlString}
        <c:forEach var="a" items="${paramValues.a}">
          <sql:param>${a}</sql:param>
        </c:forEach>
      </sql:update>You might want to check out that c:forEach ... ?, It is untested, and I am not sure how the DB will handle the extra comma.
    However, unless this same update, with the same number of parameters, is likely to occur multiple
    times, you are gaining no benefit from using the PreparedStatement, and you are probably better off
    going with the simpler Stament syntax you already used.
      <c:set var="a">
        ${fn:join(paramValues.a,",")}
      </c:set>
      <sql:update>
        update my set t=1 where id in(${a})
      </sql:update>

  • Help with JSTL sql query

    i have a query that i want to pass a paramater to the query goes like this
    <sql:query var = "user" >
    SELECT AMOUNT,flag FROM SAVINGS_ACTIVITY_DETAILS WHERE ACCOUNT_ID =? AND AMOUNT >200000 AND Flag =1 AND ACCOUNT_ACTION_ID =6 AND Treated =0 ORDER BY created_date DESC
    <sql:param value="${test.accountId}"/>
    </sql:query>
    this will give an error on TLD attribute.................and i tested the value with the following code and it worked
    <c:set value="${test.accountId}" var="u"/>
    <c:out value="${u}"/>
    this will print out the value nicely now i need a way to be able to pass this value to the sql query
    Thanks

    Which version of jstl are you using? == JSTL1.1
    However the other two questions remain unanswered.
    What server are you using? Version?
    How are you importing the tag library?
    You can find out the server info with this snippet of a JSP:
    Working with server: <%= application.getServerInfo() %><br>
    Servlet Specification: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %> <br>
    JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %><br>
    Java Version: <%= System.getProperty("java.version") %><br>

  • PL/SQL Limit When Dealing with a CLOB?

    Greetings,
    I am constructing HTML into a CLOB in a PL/SQL routine which I later display in an APEX application. The HTML can get large, because I am constructing a grid over an image, and the grid can have a lot of columns and rows which means there can be a lot of <area shape="rect" HTML lines. I did a search and found that another person had the same problem, because there is a 32K limit with HTML contents. That was very helpful.
    Thing is - I have another (maybe similar) issue. The procedure that constructs the HTML gets a numeric error when the number of cells in the grid reach a certain point. I checked and this happens when the CLOB in the procedure gets close to 32K. Sorry, it difficult to know exactly when it fails, but the most I have been able to put into the CLOB is 32,852 characters. Therefore my question - is there in internal limit in PL/SQL (or some other Oracle aspect) that is limited to 32K? The coluimn in the table that contains the HTML is a CLOB and the variable in the PL/SQL that the HTML is parsed into is a CLOB, so I thought I was good to go since the CLOB limit is 4GB. But, it looks like I may be missing something.
    We are running Oracle 11i and APEX 4.0.2.00.07. If other system info is needed let me know and I will get that for you.
    Also, if it helps. The code from the procedure is copied below. v_html is the variable that holds the HTML. The table column for the HTML is imagemap_html. Both v_html and imagemap_html are defined as CLOB's.
    Thanks, Tony
    = = = = = = =
    create or replace
    procedure create_grid (p_action IN VARCHAR2) as
        v_wcount integer := 0;   
        v_wmax integer := 20;
        v_width integer := 720;
        v_w1 integer := 0;
        v_w2 integer := 0;
        v_winc integer := 0;
        v_wstart integer := 0;
        v_wend integer := 0;   
        v_hcount integer := 0;
        v_hmax integer := 10;
        v_height integer := 520;
        v_h1 integer := 0;
        v_h2 integer := 0;
        v_hinc integer := 0;
        v_hstart integer := 0;
        v_hend integer := 0;   
        v_cell_row integer := 0;
        v_cell_col integer := 0;
        v_cell_title varchar2(10) := NULL;
        v_whitespace varchar2(10) := NULL;
        v_url_1 varchar2(100) := NULL;
        v_url_2 varchar2(100) := NULL;
        v_url_3 varchar2(100) := NULL;
        v_brand_id integer := 0;
        v_division_id integer := 0;
        v_plant_id integer := 0;
        v_model_id integer := 0;
        v_acc_group integer := 0;
        v_accessory integer := 0;
        v_acc_grp integer := 0;
        v_acc integer := 0;
        v_station_id integer := 0;
        v_substation_id integer := 0;     
        v_image_id integer := 0;
        v_id integer := 0;  
        v_html clob;
      begin
      v_brand_id := v('P4_BRAND_ID');
      v_division_id :=v('P4_DIVISION_ID');
      v_plant_id := v('P4_PLANT_ID');
      v_model_id := v('P4_MODEL_ID');
      v_acc_group := v('P4_ACC_GROUP');
      v_accessory := v('P4_ACCESSORY');
      v_station_id := v('P4_STATION_ID');
      v_substation_id := v('P4_SUBSTATION_ID');
      v_image_id := v('P4_IMAGES_ID');
      v_wmax := v('P4_COLUMNS');
      v_hmax := v('P4_ROWS');
      v_wstart := v('P4_XSTART');
      v_hstart := v('P4_YSTART');
      v_wend := v('P4_XEND');
      v_hend := v('P4_YEND'); 
      v_whitespace := v('P4_WHITESPACE');
    if p_action = 'INSERT' then
    -- insert the row now, so that the cell table rows can be inserted with the correct FK 
    insert into IM_TEMPLATE_DRAFT
    (plant_id, brand_id, division_id, model_id, acc_group, accessory, station_id,
    substation_id, image_id)
    values
    (v_plant_id,v_brand_id,v_division_id,v_model_id,v_acc_group,v_accessory,v_station_id,v_substation_id,v_image_id);
    commit;
    end if;
    -- get the id of the row that was just inserted
    select header_id into v_id from  IM_TEMPLATE_DRAFT where
    plant_id=v_plant_id and brand_id=v_brand_id and division_id=v_division_id and
    model_id=v_model_id and acc_group=v_acc_group and accessory=v_accessory and
    station_id=v_station_id and substation_id=v_substation_id and image_id=v_image_id;
    -- remove all the cell rows for the draft, they will be created anew
    delete from qcis_draft_cells where draft_id = v_id;
      BEGIN
      select pixel_width, pixel_height into v_width, v_height from images
      where images_id = v_image_id;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
        v_height := 720;
        v_width := 520;
      END;
    -- the first part of the href for the image is stored in the keyword table and put into v_url_1 for use later
      BEGIN
      select keyword_value into v_url_1 from qcis_keywords
      where keyword_type = 'Control' and keyword_code = 'URL_PATH';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
        v_url_1 := 'http://xxx.xxx.com:8000/apex40/f?p=';
      END; 
    -- construct the first three lines of the div tag 
      v_html := '<div style="text-align:center; width:'||v_width||'px; margin-left:auto; margin-right:auto;">';
      v_html := v_html || chr(10) || '<img id="ImageMap" src="download_image?p_id='||v_image_id||'" usemap="#ImageMap" border="0" width="'||v_width||'" height="'||v_height||'" alt="" />';
      v_html := v_html || chr(10) || '<map id="_ImageMap" name="ImageMap">';
    -- subtract the ending inset amounts from the image dimensions
      v_width := v_width - v_wend;
      v_height := v_height - v_hend;
    -- calculate the increment for each cell and subtract the starting inset amounts
      v_winc := floor((v_width - v_wstart) / v_wmax);
      v_hinc := floor((v_height - v_hstart) / v_hmax);
    -- there are two main loops, one for the columns, one for the rows
    -- one loop is inside the other, which helps to build the cells in logical order and helps with the naming of the cells 
      loop
    -- if this is the first row (count = 0) and they have inset values we need to adust the first x y values to something other than zero 
    if ((v_wstart != 0) and (v_wcount = 0)) then v_w1 := v_wstart; end if;
    if ((v_hstart != 0) and (v_hcount = 0)) then v_h1 := v_hstart; end if;
    if ((v_wstart != 0) and (v_wcount = 0)) then v_w2 := v_wstart; end if;
    if ((v_hstart != 0) and (v_hcount = 0)) then v_h2 := v_hstart; end if;
    v_wcount := v_wcount + 1;
    v_w2 := v_w2 + v_winc;
    -- checking to see if this is the last row and whether they want the grid to go to the end or have all cells the same size which may leave whitespace
             if (v_wcount = v_wmax) and (v_whitespace = 'Y') then v_w2 := v_width - 2; end if;
      v_cell_row := 0;
      v_cell_col := v_cell_col +1;
             loop
             v_hcount := v_hcount + 1;           
             v_h2 := v_h2 + v_hinc;
    -- checking to see if this is the last row and whether they want the grid to go to the end or have all cells the same size which may leave whitespace
                    if (v_hcount = v_hmax) and (v_whitespace = 'Y') then v_h2 := v_height - 2; end if;
             v_cell_row := v_cell_row + 1;
             -- put it all together and construct the line for the area shape tag
             v_html := v_html || chr(10) || '<area shape="rect" coords="'
             ||v_w1||','||v_h1||','||v_w2||','||v_h2||
             '" href="'||v_url_1|| '" alt="'||v_cell_col||'-'||v_cell_row||'" title="'||v_cell_col||'-'||v_cell_row||'"    />';
             v_cell_title := v_cell_col||'-'||v_cell_row;
                insert into DRAFT_CELLS (DRAFT_ID, CELL_TITLE) values(v_id, v_cell_title);          
             v_h1 := v_h1 + v_hinc;
                exit when v_hcount = v_hmax;
            end loop;
      v_hcount := 0;
      v_h1 := 0;
      v_h2 := 0;
      v_w1 := v_w1 + v_winc;
         exit when v_wcount = v_wmax;     
      end loop;
      v_html := v_html || chr(10) || '</div>';
    update IM_TEMPLATE_DRAFT set imagemap_html = v_html
    where header_id = v_id;  
    END create_grid;Edited by: cloaked on Nov 7, 2011 4:45 AM

    For "Application Express 4.2.1.00.08" i created such good solution.
    I downloaded freeware plugin "Enkitec Clob Load Plug-in Version: 1.0.0 - APEX Version: 4.2.0" from there:
    http://www.enkitec.com/products/plugins/clob-load/help
    Then i followed plugin installation steps and created a APEX page where i added an item of type "Rich Text Editor".
    I found the plugin crashes when my database CLOB field is empty, also crashed when i tried to save down empty value to database.
    I changed Plugin code a little, and now everything works as needed, i can save down larga data, and also empty data.
    1. In Apex open plugin "Enkitec CLOB Load".
    2. Navigate to "Source-->PL/SQL Code" where is text area with plugin source code.
    3. there you have such code:
    FUNCTION enkitec_clob_load_render (
       p_dynamic_action IN APEX_PLUGIN.T_DYNAMIC_ACTION,
       p_plugin         IN APEX_PLUGIN.T_PLUGIN
       RETURN APEX_PLUGIN.T_DYNAMIC_ACTION_RENDER_RESULT
    IS
       l_retval           APEX_PLUGIN.T_DYNAMIC_ACTION_RENDER_RESULT;
       l_show_modal       VARCHAR2(1) := p_plugin.attribute_01;
       l_dialog_title     VARCHAR2(4000) := NVL(p_plugin.attribute_02, 'Please wait...');
       l_loading_img_type VARCHAR2(30) := p_plugin.attribute_03;
       l_loading_img_c    VARCHAR2(4000) := p_plugin.attribute_04;
       l_action           VARCHAR2(10) := NVL(p_dynamic_action.attribute_01, 'RENDER');
       l_change_only      VARCHAR2(1) := NVL(p_dynamic_action.attribute_06, 'Y');
       l_make_blocking    VARCHAR2(1) := NVL(p_dynamic_action.attribute_07, 'Y');
       l_loading_img_src  VARCHAR2(32767);
       l_crlf             VARCHAR2(2) := CHR(13)||CHR(10);
       l_js_function      VARCHAR2(32767);
       l_onload_code      VARCHAR2(32767);
    BEGIN
       IF apex_application.g_debug
       THEN
          apex_plugin_util.debug_dynamic_action(
             p_plugin         => p_plugin,
             p_dynamic_action => p_dynamic_action
       END IF;
       IF l_loading_img_type = 'DEFAULT'
       THEN
          l_loading_img_src := p_plugin.file_prefix || 'enkitec-loading.gif';
       ELSE
          l_loading_img_src := REPLACE(l_loading_img_c, '#IMAGE_PREFIX#', apex_application.g_image_prefix);
          l_loading_img_src := REPLACE(l_loading_img_src, '#PLUGIN_PREFIX#', p_plugin.file_prefix);
       END IF;
       apex_css.add(
          p_css => '.clob-load-dialog .ui-dialog-titlebar-close {display: none;}',
          p_key => 'clob-load-hide-modal-close'
       apex_javascript.add_library(
          p_name      => 'enkitec-clob-load.min',
          p_directory => p_plugin.file_prefix,
          p_version   => NULL
       l_onload_code :=
          'apex.jQuery(document).clob_load({'|| l_crlf ||
          '   showModal: "' || l_show_modal ||'",'|| l_crlf ||
          '   dialogTitle: "' || l_dialog_title ||'",'|| l_crlf ||
          '   loadingImageSrc: "' || l_loading_img_src ||'",'|| l_crlf ||
          '   pluginFilePrefix: "' || p_plugin.file_prefix || '",' || l_crlf ||
          '   apexImagePrefix: "' || apex_application.g_image_prefix || ',"' || l_crlf ||
       apex_javascript.add_onload_code(
          p_code => l_onload_code
       IF l_action = 'RENDER'
       THEN
          l_js_function :=
             'function(){'|| l_crlf ||
             '   apex.jQuery(document).clob_load("renderClob", {' || l_crlf ||
             '      $elmt: this.affectedElements.eq(0),' || l_crlf ||
             '      ajaxIdentifier: "' || apex_plugin.get_ajax_identifier() || '"' || l_crlf ||
             '   });'|| l_crlf ||
       ELSE
          l_js_function :=
             'function(){'|| l_crlf ||
             '   apex.jQuery(document).clob_load("submitClob", {' || l_crlf ||
             '      $elmt: this.affectedElements.eq(0),' || l_crlf ||
             '      ajaxIdentifier: "' || apex_plugin.get_ajax_identifier() || '",' || l_crlf ||
             '      changeOnly: "' || l_change_only || '",' || l_crlf ||
             '      makeBlocking: "' || l_make_blocking || '"' || l_crlf ||
             '   });'|| l_crlf ||
       END IF;
       l_retval.javascript_function := l_js_function;
       RETURN l_retval;
    END enkitec_clob_load_render;
    FUNCTION enkitec_clob_load_ajax (
       p_dynamic_action IN APEX_PLUGIN.T_DYNAMIC_ACTION,
       p_plugin         IN APEX_PLUGIN.T_PLUGIN
        RETURN APEX_PLUGIN.T_DYNAMIC_ACTION_AJAX_RESULT
    IS
       l_retval                   APEX_PLUGIN.T_DYNAMIC_ACTION_AJAX_RESULT;
       l_ajax_function            VARCHAR2(32767) := apex_application.g_x01;
       l_source                   VARCHAR2(20) := NVL(p_dynamic_action.attribute_02, 'COLLECTION');
       l_render_collection_name   VARCHAR2(255) := p_dynamic_action.attribute_03;
       l_query                    VARCHAR2(32767) := p_dynamic_action.attribute_04;
       l_submit_collection_name   VARCHAR2(255) := p_dynamic_action.attribute_05;
       l_column_value_list        APEX_PLUGIN_UTIL.T_COLUMN_VALUE_LIST2;    
       l_clob_text                CLOB := EMPTY_CLOB();
       l_token                    VARCHAR2(32000);
       l_chunk_size               NUMBER := 4000;
    BEGIN
       IF l_ajax_function = 'RENDER_CLOB'
       THEN
          IF l_source = 'COLLECTION'
          THEN
             IF apex_collection.collection_exists(l_render_collection_name)
             THEN
                SELECT clob001
                INTO l_clob_text
                FROM apex_collections
                WHERE collection_name = l_render_collection_name
                   AND seq_id = 1;
             END IF;
          ELSE --must be SQL_QUERY
             BEGIN
                l_column_value_list := apex_plugin_util.get_data2(
                   p_sql_statement  => l_query,
                   p_min_columns    => 1,
                   p_max_columns    => 1,
                   p_component_name => p_dynamic_action.action,
                   p_first_row      => 1,
                   p_max_rows       => 1
             EXCEPTION
                WHEN NO_DATA_FOUND
                THEN
                   NULL;
             END;
             IF l_column_value_list.exists(1)
                AND l_column_value_list(1).value_list.exists(1)
             THEN
                l_clob_text := l_column_value_list(1).value_list(1).clob_value;
             END IF;
          END IF;
          FOR i IN 0 .. FLOOR(LENGTH(l_clob_text)/l_chunk_size)
          LOOP 
             sys.htp.prn(substr(l_clob_text, i * l_chunk_size + 1, l_chunk_size)); 
          END LOOP;
       ELSE --must be SUBMIT_CLOB
          dbms_lob.createtemporary(l_clob_text, false, dbms_lob.session);
          FOR i IN 1..apex_application.g_f01.count
          LOOP
             l_token := wwv_flow.g_f01(i);
             dbms_lob.writeappend(l_clob_text, length(l_token), l_token);
          END LOOP;
          apex_collection.create_or_truncate_collection(
             p_collection_name => l_submit_collection_name
          apex_collection.add_member(
             p_collection_name => l_submit_collection_name,
             p_clob001         => l_clob_text
       END IF;
       RETURN l_retval;
    END enkitec_clob_load_ajax;4. Change this code to this code:
    FUNCTION enkitec_clob_load_render (
       p_dynamic_action IN APEX_PLUGIN.T_DYNAMIC_ACTION,
       p_plugin         IN APEX_PLUGIN.T_PLUGIN
       RETURN APEX_PLUGIN.T_DYNAMIC_ACTION_RENDER_RESULT
    IS
       l_retval           APEX_PLUGIN.T_DYNAMIC_ACTION_RENDER_RESULT;
       l_show_modal       VARCHAR2(1) := p_plugin.attribute_01;
       l_dialog_title     VARCHAR2(4000) := NVL(p_plugin.attribute_02, 'Please wait...');
       l_loading_img_type VARCHAR2(30) := p_plugin.attribute_03;
       l_loading_img_c    VARCHAR2(4000) := p_plugin.attribute_04;
       l_action           VARCHAR2(10) := NVL(p_dynamic_action.attribute_01, 'RENDER');
       l_change_only      VARCHAR2(1) := NVL(p_dynamic_action.attribute_06, 'Y');
       l_make_blocking    VARCHAR2(1) := NVL(p_dynamic_action.attribute_07, 'Y');
       l_loading_img_src  VARCHAR2(32767);
       l_crlf             VARCHAR2(2) := CHR(13)||CHR(10);
       l_js_function      VARCHAR2(32767);
       l_onload_code      VARCHAR2(32767);
    BEGIN
       IF apex_application.g_debug
       THEN
          apex_plugin_util.debug_dynamic_action(
             p_plugin         => p_plugin,
             p_dynamic_action => p_dynamic_action
       END IF;
       IF l_loading_img_type = 'DEFAULT'
       THEN
          l_loading_img_src := p_plugin.file_prefix || 'enkitec-loading.gif';
       ELSE
          l_loading_img_src := REPLACE(l_loading_img_c, '#IMAGE_PREFIX#', apex_application.g_image_prefix);
          l_loading_img_src := REPLACE(l_loading_img_src, '#PLUGIN_PREFIX#', p_plugin.file_prefix);
       END IF;
       apex_css.add(
          p_css => '.clob-load-dialog .ui-dialog-titlebar-close {display: none;}',
          p_key => 'clob-load-hide-modal-close'
       apex_javascript.add_library(
          p_name      => 'enkitec-clob-load.min',
          p_directory => p_plugin.file_prefix,
          p_version   => NULL
       l_onload_code :=
          'apex.jQuery(document).clob_load({'|| l_crlf ||
          '   showModal: "' || l_show_modal ||'",'|| l_crlf ||
          '   dialogTitle: "' || l_dialog_title ||'",'|| l_crlf ||
          '   loadingImageSrc: "' || l_loading_img_src ||'",'|| l_crlf ||
          '   pluginFilePrefix: "' || p_plugin.file_prefix || '",' || l_crlf ||
          '   apexImagePrefix: "' || apex_application.g_image_prefix || ',"' || l_crlf ||
       apex_javascript.add_onload_code(
          p_code => l_onload_code
       IF l_action = 'RENDER'
       THEN
          l_js_function :=
             'function(){'|| l_crlf ||
             '   apex.jQuery(document).clob_load("renderClob", {' || l_crlf ||
             '      $elmt: this.affectedElements.eq(0),' || l_crlf ||
             '      ajaxIdentifier: "' || apex_plugin.get_ajax_identifier() || '"' || l_crlf ||
             '   });'|| l_crlf ||
       ELSE
          l_js_function :=
             'function(){'|| l_crlf ||
             '   apex.jQuery(document).clob_load("submitClob", {' || l_crlf ||
             '      $elmt: this.affectedElements.eq(0),' || l_crlf ||
             '      ajaxIdentifier: "' || apex_plugin.get_ajax_identifier() || '",' || l_crlf ||
             '      changeOnly: "' || l_change_only || '",' || l_crlf ||
             '      makeBlocking: "' || l_make_blocking || '"' || l_crlf ||
             '   });'|| l_crlf ||
       END IF;
       l_retval.javascript_function := l_js_function;
       RETURN l_retval;
    END enkitec_clob_load_render;
    FUNCTION enkitec_clob_load_ajax (
       p_dynamic_action IN APEX_PLUGIN.T_DYNAMIC_ACTION,
       p_plugin         IN APEX_PLUGIN.T_PLUGIN
        RETURN APEX_PLUGIN.T_DYNAMIC_ACTION_AJAX_RESULT
    IS
       l_retval                   APEX_PLUGIN.T_DYNAMIC_ACTION_AJAX_RESULT;
       l_ajax_function            VARCHAR2(32767) := apex_application.g_x01;
       l_source                   VARCHAR2(20) := NVL(p_dynamic_action.attribute_02, 'COLLECTION');
       l_render_collection_name   VARCHAR2(255) := p_dynamic_action.attribute_03;
       l_query                    VARCHAR2(32767) := p_dynamic_action.attribute_04;
       l_submit_collection_name   VARCHAR2(255) := p_dynamic_action.attribute_05;
       l_column_value_list        APEX_PLUGIN_UTIL.T_COLUMN_VALUE_LIST2;    
       l_clob_text                CLOB := EMPTY_CLOB();
       l_token                    VARCHAR2(32000);
       l_chunk_size               NUMBER := 4000;
    BEGIN
       IF l_ajax_function = 'RENDER_CLOB'
       THEN
          IF l_source = 'COLLECTION'
          THEN
             IF apex_collection.collection_exists(l_render_collection_name)
             THEN
                SELECT clob001
                INTO l_clob_text
                FROM apex_collections
                WHERE collection_name = l_render_collection_name
                   AND seq_id = 1;
             END IF;
          ELSE --must be SQL_QUERY
             BEGIN
                l_column_value_list := apex_plugin_util.get_data2(
                   p_sql_statement  => l_query,
                   p_min_columns    => 1,
                   p_max_columns    => 1,
                   p_component_name => p_dynamic_action.action,
                   p_first_row      => 1,
                   p_max_rows       => 1
             EXCEPTION
                WHEN NO_DATA_FOUND
                THEN
                   NULL;
             END;
             IF l_column_value_list.exists(1)
                AND l_column_value_list(1).value_list.exists(1)
             THEN
                l_clob_text := l_column_value_list(1).value_list(1).clob_value;
             END IF;
          END IF;
          FOR i IN 0 .. FLOOR(NVL(LENGTH(l_clob_text)/l_chunk_size,0))
          LOOP 
             sys.htp.prn(substr(l_clob_text, i * l_chunk_size + 1, l_chunk_size)); 
          END LOOP;
       ELSE --must be SUBMIT_CLOB
          dbms_lob.createtemporary(l_clob_text, false, dbms_lob.session);
          FOR i IN 1..apex_application.g_f01.count
          LOOP
             l_token := wwv_flow.g_f01(i);
             if NVL(length(l_token),0) > 0 Then
                dbms_lob.writeappend(l_clob_text, length(l_token), l_token);
             end if;
          END LOOP;
          apex_collection.create_or_truncate_collection(
             p_collection_name => l_submit_collection_name
          apex_collection.add_member(
             p_collection_name => l_submit_collection_name,
             p_clob001         => l_clob_text
       END IF;
       RETURN l_retval;
    END enkitec_clob_load_ajax;5. As you see only 2 places of plugin had to be fixed, when you compare previous 2 steps:
    FOR i IN 0 .. FLOOR(LENGTH(l_clob_text)/l_chunk_size)
          LOOP 
             sys.htp.prn(substr(l_clob_text, i * l_chunk_size + 1, l_chunk_size)); 
          END LOOP;-->
    FOR i IN 0 .. FLOOR(NVL(LENGTH(l_clob_text)/l_chunk_size,0))
          LOOP 
             sys.htp.prn(substr(l_clob_text, i * l_chunk_size + 1, l_chunk_size)); 
          END LOOP;And
    FOR i IN 1..apex_application.g_f01.count
          LOOP
             l_token := wwv_flow.g_f01(i);
             dbms_lob.writeappend(l_clob_text, length(l_token), l_token);
          END LOOP;-->
    FOR i IN 1..apex_application.g_f01.count
          LOOP
             l_token := wwv_flow.g_f01(i);
             if NVL(length(l_token),0) > 0 Then
                dbms_lob.writeappend(l_clob_text, length(l_token), l_token);
             end if;
          END LOOP;This way seems to be best way to handle APEX CLOBS today, using that plugin, and a little fix.

  • Using java.sql.Time: Offset by 1 hour?

    I have a problem understanding the behaviour of the java.sql.Time class. As the following example shows.
    61952000 ms is the Time 17:12:32. If i feed a Time-Object with it and print the time or date I'll get "18:12:32",
    an offset of 1h. But if I use time.getTime(), I get my ms value which equals 17:12:32.
    As my timezone shows, I have a GMT offset of one hour. But why does the getTime() method not calculate
    the timezone offset to the ms?
    Time time = new Time(61952000);
            System.out.println(time.getTime() / 3600 / 1000); // 17 hours
            System.out.println( new Date(time.getTime()) ); // Thu Jan 01 18:12:32 CET 1970
            System.out.println(time.getTime()); // 61952000
            System.out.println(time); // 18:12:32
            System.out.println(Calendar.getInstance().getTimeZone());
             *  sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,
             *  useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,
             *  offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,
             *  startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,
             *  endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]
             */

    Thanks for your reply. But please take a look at the following code snippet. It intends to add a Timestamp representing the
    start of a day (time component 00:00:00) to a time component (having Date to 01-01-1970):
            Time time = new Time(61952000);
            Calendar c = Calendar.getInstance();
            System.out.println("time: " + time); // 18:12:32
            c.set(Calendar.HOUR_OF_DAY, 0);
            c.set(Calendar.SECOND, 0);
            c.set(Calendar.MINUTE, 0);
            c.set(Calendar.MILLISECOND, 0);
            System.out.println("date: " + c.getTime()); // Fri Apr 03 00:00:00 CEST 2009
            Timestamp timestamp = new Timestamp( c.getTimeInMillis() + time.getTime() );
            Date d = new Date(timestamp.getTime() );
            System.out.println("\nresult: " + d); // result: Fri Apr 03 17:12:32 CEST 2009If I assume that getting and setting the milis always deals with timezone independent values, but operating methods
    like toString(), getHour() etc use the timezone, then I can not explain the result (last line): 17:12:32 is the timezone
    independend value. Should'nt d.toString() show the timezone dependend value of 18:12:32?

  • JSTL sql:query date field has zero time part

    I have a little JSP where I am using JSTL to do a query against a table "ph_application" that has a date field "rundate". This field has many different dates and times in it.
    Here is the code snippet:
    <sql:setDataSource url="jdbc:oracle:thin:@oraprd02:1521:ipp4" user="site" password="pmc_site"/>
    <sql:query var="application" sql="select * from ph_application"/>
    <c:forEach items="${application.rows}" var="row">
    <tr>
    <td><c:out value="${row.name}" default=" " escapeXml="false"/></td>
    <td><fmt:formatDate value="${row.rundate}" type="both"/></td>
    </tr>
    </c:forEach>
    The resulting date/time output always has a 12:00:00 AM time regardless of what is actually in the table. I have changed the fmt:formatDate to a c:out of the row.rundate.time value and it appears that the time part of the date is actually zero at this point.
    Is there an inconsistancy between the oracle date type and what JSTL is expecting (somewhere)?
    Any help and/or verification is appreciated.
    Richard

    I'm running this from within JDeveloper 10g.

  • JSTL SQL

    In my jstl page, i am using this query using PostgreSQL db >
    select * from someTable limit 35
    this returns the top 35 rows, but what i want to do is return the top 35 rows, except the first row, so I want to display rows 2 till 35.
    how can i do this?

    answered my own question, just use NOT LIKE

  • Help! problem about jstl sql with "LIKE?" in query

    Hi All,
    I have a problem about getting data by using "LIKE" in my sql statment.
    here is my case:
    <sql:query var="tmp">
    SELECT ...... FROM ...
    WHERE a LIKE ?
    <sql:param value="%${param.a}%"/>
    </sql:query>
    Once I used "LIKE" keyword, the query failed to use this critica.
    and couldn't find any match cases
    thx or help
    Micheal

    besides, i found that:
    this works:
    "AND a.block LIKE '%' + 'a' + '%'"
    but these don't work:
    "AND a.block LIKE '%' + 'a' + '' + '%'"
    or
    "AND a.block LIKE '' + '%' + 'cp' + '%'"
    or
    "AND a.block LIKE '%' + 'cp' + '%' + ''"
    it seems '' is the casue of error... so strange, anyone has idea?
    micheal

  • Parameter form using LOV based on SQL  to pass param to Discoverer portlet

    Hi all
    I have a design issue:-
    I want to create a parameter form in Oracle Portal to allow users to select the department using searchable LOV (like the torch that is there in various oracle products) and pass the selected parameter to the Oracle Discoverer worksheet portlet. The LOV values is required to come from a SQL query which in turn is dependent on User_name varia ble from the session.
    I am looking for any out of the box portlet which can be configured to achieve the same. Any help or pointers in this regard would be greatly appreciated.
    Thanks
    Puneet

    Hi,
    Please refer to the answer in this question Re: OC4J Memory question
    It is similar to your requirement.
    Thanks,
    Sharmila

Maybe you are looking for