Hi all,

I'm having an issue with <sql:param> that I can solve with a lot of conditional
code, but I'm hoping that someone out there has a better idea, or knows
something I don't (VERY likely).  Essentially, I have a Web application
in which an entry for most of the form fields is not required.  Of course,
I don't know in advance if an entry will be made or not.  But, in the absence
of an entry, I must write a NULL value to the database -- an empty string
will not do because of the requirements of a reporting engine running against
the same database.  This is not the actual code (I've stripped this down
to the essentials of my question), but what I'd like to do is something
like the following:

<sql:update dataSource="jdbc/datasource">

UPDATE project_tbl

SET prj_est_start_dt = ?

WHERE prj_id = 6

<c:choose>

<c:when test="${empty param.projEstStartDate}">
<sql:param value="NULL" />
</c:when>

<c:otherwise>
<sql:param value="${param.projEstStartDate}" />
</c:otherwise>

</c:choose>

</sql:update>

Obviously, when I try anything like this when projEstStartDate is empty,
<sql:param value="NULL" /> is replacing the ? with the string 'NULL' rather
than the value NULL.  I've tried any number of permutations to get this
to behave like I envision, but to no avail.  Ideally, if param.projEstStartDate
were really an empty string, I'd like <sql:param> to replace the ? with
NULL rather than the emtpy string, which would allow me to avoid the conditional
test entirely.  Basically, is there a way for me to use <sql:param> and
have it literally write NULL instead of the string 'NULL'?

I did search the archives and found a general reference to this back in
June, but no solution.

Much thanks in advance!!!

Buck Bell


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>

Reply via email to