You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "VIJAISENTHIL, P. K." <vi...@kumaran.com> on 2006/02/08 18:55:08 UTC

pass a result (a String) of a query to another SQL

Hi,

    I have a situation like, I need to pass a result (a String) of a query to another SQL as parameter.

    E.g. like this.

        SELECT SCORING_LEVEL FROM ASSESSMENTS WHERE ID = 12;

        IF SCORING_LEVEL="THIS"
            SELECT SUBJECT, MARK FROM SCORES WHERE SUBJECT_ID = 13;
        ELSE 
            SELECT SUBJECT, MARK FROM SCORES WHERE PARENT_SUBJECT_ID = 13;

    Is it possible to configure or achieve this withthe XML file itslef without coding it in JAVA?


Thanks and Regards
Vijai Senthil, P. K.

Re: pass a result (a String) of a query to another SQL

Posted by "VIJAISENTHIL, P. K." <vi...@kumaran.com>.
I have done it with SQL itself using DECODE function in oracle, but curious 
of whether this can be done through iBATIS

Thanks
Vijai
----- Original Message ----- 
From: "VIJAISENTHIL, P. K." <vi...@kumaran.com>
To: <us...@ibatis.apache.org>
Sent: Wednesday, February 08, 2006 1:51 PM
Subject: Re: pass a result (a String) of a query to another SQL


> Yea, that would different as in my example, bcos the assessment would be 
> associated with a subject.
>
> The constraint is, based on the scoring level of the assessment
>        either i need to score a subject directly
>        or the outcomes of the subject.
>
> Hope you got me.
>
> Thanks
> -Vijai
>
> ----- Original Message ----- 
> From: "Ted Schrader" <ts...@gmail.com>
> To: <us...@ibatis.apache.org>
> Sent: Wednesday, February 08, 2006 1:25 PM
> Subject: Re: pass a result (a String) of a query to another SQL
>
>
>> Hi Vijai,
>>
>> I have a question about your question:  Will Assessments.ID be the
>> same as Scores.subject_id and Subject.parent_subject_id?
>>
>> They are different in your example (12 and 13), but I was wondering if
>> that was a typo.
>>
>> Thanks,
>>
>> Ted
>>
>> On 08/02/06, VIJAISENTHIL, P. K. <vi...@kumaran.com> 
>> wrote:
>>>
>>> Hi,
>>>
>>>     I have a situation like, I need to pass a result (a String) of a 
>>> query
>>> to another SQL as parameter.
>>>
>>>     E.g. like this.
>>>
>>>         SELECT SCORING_LEVEL FROM ASSESSMENTS WHERE ID = 12;
>>>
>>>         IF SCORING_LEVEL="THIS"
>>>             SELECT SUBJECT, MARK FROM SCORES WHERE SUBJECT_ID = 13;
>>>         ELSE
>>>             SELECT SUBJECT, MARK FROM SCORES WHERE PARENT_SUBJECT_ID = 
>>> 13;
>>>
>>>     Is it possible to configure or achieve this withthe XML file itslef
>>> without coding it in JAVA?
>>>
>>>
>>> Thanks and Regards
>>> Vijai Senthil, P. K.
>>> 


Re: pass a result (a String) of a query to another SQL

Posted by "VIJAISENTHIL, P. K." <vi...@kumaran.com>.
Yea, that would different as in my example, bcos the assessment would be 
associated with a subject.

The constraint is, based on the scoring level of the assessment
        either i need to score a subject directly
        or the outcomes of the subject.

Hope you got me.

Thanks
-Vijai

----- Original Message ----- 
From: "Ted Schrader" <ts...@gmail.com>
To: <us...@ibatis.apache.org>
Sent: Wednesday, February 08, 2006 1:25 PM
Subject: Re: pass a result (a String) of a query to another SQL


> Hi Vijai,
>
> I have a question about your question:  Will Assessments.ID be the
> same as Scores.subject_id and Subject.parent_subject_id?
>
> They are different in your example (12 and 13), but I was wondering if
> that was a typo.
>
> Thanks,
>
> Ted
>
> On 08/02/06, VIJAISENTHIL, P. K. <vi...@kumaran.com> 
> wrote:
>>
>> Hi,
>>
>>     I have a situation like, I need to pass a result (a String) of a 
>> query
>> to another SQL as parameter.
>>
>>     E.g. like this.
>>
>>         SELECT SCORING_LEVEL FROM ASSESSMENTS WHERE ID = 12;
>>
>>         IF SCORING_LEVEL="THIS"
>>             SELECT SUBJECT, MARK FROM SCORES WHERE SUBJECT_ID = 13;
>>         ELSE
>>             SELECT SUBJECT, MARK FROM SCORES WHERE PARENT_SUBJECT_ID = 
>> 13;
>>
>>     Is it possible to configure or achieve this withthe XML file itslef
>> without coding it in JAVA?
>>
>>
>> Thanks and Regards
>> Vijai Senthil, P. K.
>> 


Re: pass a result (a String) of a query to another SQL

Posted by Ted Schrader <ts...@gmail.com>.
Hi Vijai,

I have a question about your question:  Will Assessments.ID be the
same as Scores.subject_id and Subject.parent_subject_id?

They are different in your example (12 and 13), but I was wondering if
that was a typo.

Thanks,

Ted

On 08/02/06, VIJAISENTHIL, P. K. <vi...@kumaran.com> wrote:
>
> Hi,
>
>     I have a situation like, I need to pass a result (a String) of a query
> to another SQL as parameter.
>
>     E.g. like this.
>
>         SELECT SCORING_LEVEL FROM ASSESSMENTS WHERE ID = 12;
>
>         IF SCORING_LEVEL="THIS"
>             SELECT SUBJECT, MARK FROM SCORES WHERE SUBJECT_ID = 13;
>         ELSE
>             SELECT SUBJECT, MARK FROM SCORES WHERE PARENT_SUBJECT_ID = 13;
>
>     Is it possible to configure or achieve this withthe XML file itslef
> without coding it in JAVA?
>
>
> Thanks and Regards
> Vijai Senthil, P. K.
>