Menu

Problem calling stored procedure

2006-05-08
2013-04-25
  • Sathi Chowdhury

    Sathi Chowdhury - 2006-05-08

    Hi ,
    I am testing a simple stored proc that returns a single varchar2 value and has no input parameters .My sql unit testcase file looks like this:
    <sqlunit> 
    <connection connection-id="1"> 
    <driver>oracle.jdbc.driver.OracleDriver</driver> 
    other info I can't print here
    </connection> 

    <test name="Find Document Types through a procedure">
    <call connection-id="1">
    <stmt>{call IDE_ROOT.GET_DOCTYPES(?)}</stmt>
    <param id="1" name="p_result" type="VARCHAR" inout="out">${p_result}</param>
    </call>
    <result>
    <outparam id="1" name="p_result" type="VARCHAR" >XLS</outparam> 
    </result>
    </test>
    </sqlunit> 
    -----------------

    when I run this

    I get the fiollowing output
    C:\sqlunit-4.9>ant run-second-test
    Buildfile: build.xml

    def:

    run-second-test:
    [sqlunit] WARN [main] (SQLUnit.java:168) - log4j.properties not found (using
    defaults)
    [sqlunit] *** Running SQLUnit file: test/oracle/secondtest.xml
    [sqlunit] Getting connection(1)
    [sqlunit] Setting up test...
    [sqlunit] (0ms)
    [sqlunit] Assertion "exception-matches" failed (result != exception)
    [sqlunit] *** expected:
    [sqlunit] <result>
    [sqlunit] <outparam id="1" name="p_result" type="VARCHAR">XLS</outparam>
    [sqlunit] </result>
    [sqlunit] *** but got:
    [sqlunit] <result>
    [sqlunit] <outparam id="1" name="p_result" type="VARCHAR">NULL</outparam>
    [sqlunit] <exception>
    [sqlunit] <code>6550</code>
    [sqlunit] <message>ORA-06550: line 1, column 7: PLS-00201: identifier 'IDE
    _ROOT.GET_DOCTYPES' must be declared ORA-06550: line 1, column 7: PL/SQL: Statem
    ent ignored</message>
    [sqlunit] </exception>
    [sqlunit] </result>

    [sqlunit] Tearing down test...
    [sqlunit] sqlunit-ant: SQLUnit Tests Failed: In file: test/oracle/secondtest.x
    ml, tests: 1, failures: 1, errors = 0
    [sqlunit] One or more SQLUnit Tests failed, see the console for details

    -----------------------------------

    Can you tell me what's wrong here ?why is it not able to find the procedure ?

     
    • Sujit Pal

      Sujit Pal - 2006-05-13

      Hi Sathi,

      I dont have access to an oracle database and its been a while since I last used PL/SQL that the error message does not make too much sense to me anymore, so I may be wrong in my diagnosis.

      Did you try running the code from the sqlplus client or from another Java program? This looks like a problem with the stored procedure not being found by the database. If not, you should try to run it and fix any problems with the stored procedure before running it through SQLUnit.

      -sujit

       
    • Sathi Chowdhury

      Sathi Chowdhury - 2006-05-16

      Thanks Sujit,
        I had some problem in the connection.

      Sathi

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.