Ok good example.
Here is how I would acomplish this.
<select parameterClass="parameterClass"> select * from table_name <dynamic prepend="where"> <isNotNull property="A" prepend="and"> A = #A# </isNotNull> <isNull property="A" prepend="and"> A is null </isNull> <isNotNull property="B" prepend="and"> B = #B# </isNotNull> <isNull property="B" prepend="and"> B is null </isNull> </dynamic> </select>
This statement will give you 4 different select statements including the 2 you are looking for. Just make sure that you parameterClass initializes A and B to null and not "".
Nathan
On May 20, 2005, at 2:19 AM, [EMAIL PROTECTED] wrote:
I want that:
#1 if ParameterClass: object.setA(""); object.setB("VALUE B");
then Statement: SELECT * FROM TABLE WHERE A="" AND B="VALUE B"
#2
if ParameterClass: //object.setA(""); /** Commmented **/ object.setB("VALUE B");
then Statement: SELECT * FROM TABLE WHERE A IS NULL AND B="VALUE B"
Not this statement. if I use the tag <isnotempty> iBatis put "" instead IS NULL SELECT * FROM TABLE WHERE A="" AND B="VALUE B"
Re: How to obtain results looking for a NULL Brandon Goodin Fri, 06 May 2005 13:34:00 -0700 Then i'm not completely sure what you are asking for. Write out your SQL statement in it's most complex form without tags. Just write straight SQL. If you do that i think i'll understand what you are wanting.
Brandon
On 5/5/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
To Brandon Goodin
The prepend="OR" doesn't works; and I don't want the next: Example: A='2' B=null SELECT A, B FROM ME WHERE A='2' OR B IS NULL I want AND, and then B='3' (for example) or B IS NULL.
Thanks for the answer.
To Brice Ruth
I don't try that, but I supose yes. How can that case be connected
with my
problem?
Thanks for your answer too.
This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you have
received it in error, please notify the sender immediately and delete
the
original. Any other use of the email by you is prohibited.
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.