0

I am new to Ibatis and still learning it. I encountered this SQL query which needs to be converted in to an Ibatis query.

I tried putting in CDATA tag and tried some iterator tag also, but it didn't work out for me. Here's my query:

SELECT comp_small_name
FROM table_company
WHERE companyid IN (
        SELECT agentid
        FROM (
            SELECT *
            FROM table_comp_price
            WHERE companyid = #compid#
            ORDER BY companyid DESC
            WHERE ROWNUM <= 2
            )
        )

This is intended for an Oracle database.

1 Answer 1

1

Method 1

SELECT comp_small_name
    FROM table_company
    WHERE companyid IN (
            SELECT agentid
            FROM (
                SELECT *
                FROM table_comp_price
                WHERE companyid = #compid
                ORDER BY companyid DESC
                WHERE <![CDATA[ ROWNUM <= 2 ]]>
                )
            )

or you can also use as below Method 2:

 SELECT comp_small_name
    FROM table_company
    WHERE companyid IN (
            SELECT agentid
            FROM (
                SELECT *
                FROM table_comp_price
                WHERE companyid = #compid
                ORDER BY companyid DESC
                WHERE ROWNUM &lt;= 2
                )
            )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.