Have you tried executing the statement within the PL/SQL interpreter directly to ensure that it does not produce an error?
Once you have confirmed that the statement does not produce an error within PL/SQL, try executing the statement as an un-parameter-ized statement within SQLunit and re-run the test. That is, modify the SQLUnit code to be:
<sql>
<stmt>update product set price=6.7 where partid='0834020'</stmt>
</sql>
Finally, you should be checking the updatecount to ensure that a row has been modified. Assuming that your statement will modify exactly one row, then you should use the following as the expected result within the test.
<result>
<updatecount>1</updatecount>
</result>
You will need to reset your price field within the product table database between each test. (This will allow you to visually inspect the database and ensure the value has indeed changed.)
Hope this helps.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I am running the following sql statement to update a table.
<?xml version="1.0"?>
<!DOCTYPE sqlunit SYSTEM "file:D:\sqlunit-4.9\docs\sqlunit.dtd">
<sqlunit>
<connection>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:oracle:thin:@172.16.0.19:1521:vis</url>
<user>tc122sa</user>
<password>tc122sa</password>
</connection>
<test name="Product update">
<sql>
<stmt>update product set price=6.7 where partid=?</stmt>
<param id="1" type="VARCHAR">'0834020'</param>
</sql>
<result\>
</test>
</sqlunit>
But the table is not getting updated with the new values.
Can anyone help me to fix this issue ?
Thanks
Meghanath
Did you try it like this:
<param id="1" type="VARCHAR">0834020</param>
No quotes should be required since we have already specified it is a VARCHAR datatype.
Hi
Firstly we had tried without quotes only.It didnt worked.Then we tried with the quotes , it didnt work.
Are we missing something ?
Thanks
Meghanath
Hi Meghanath,
Have you tried executing the statement within the PL/SQL interpreter directly to ensure that it does not produce an error?
Once you have confirmed that the statement does not produce an error within PL/SQL, try executing the statement as an un-parameter-ized statement within SQLunit and re-run the test. That is, modify the SQLUnit code to be:
<sql>
<stmt>update product set price=6.7 where partid='0834020'</stmt>
</sql>
Finally, you should be checking the updatecount to ensure that a row has been modified. Assuming that your statement will modify exactly one row, then you should use the following as the expected result within the test.
<result>
<updatecount>1</updatecount>
</result>
You will need to reset your price field within the product table database between each test. (This will allow you to visually inspect the database and ensure the value has indeed changed.)
Hope this helps.
Hi Meghanath,
Any reason why you are using < and > all over the place? SQLUnit should be able to read valid XML files with angle brackets.
-sujit