| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> Re: SP call does not work
"Eugene A" <lorus77_at_mailandnews.com> wrote in message
news:9f8b77f82e987f9e1fba10a652b3211b_at_news.teranews.com...
> Hello.
>
> In this call from a Java prog to a Oracle SP I am trying to pass along
some
> varchars and a cursor, but apperently the syntax of the call to the stor
> proc is incorrect. What am I doing wrong?
>
> Please help.
>
> Thanks,
>
> Eugene.
>
> /****************************** PL\SQL Stored Proc.
> *************************/
> PROCEDURE sp_get_all_descr
> ( PV_dm_c IN VARCHAR2,
> PV_dm_x IN VARCHAR2,
> pv_flag IN VARCHAR2,
> CURR OUT RESULTSETCURSORPKG.RC )
> IS
> BEGIN
> IF pv_flag = 'L' THEN
> V_LIKE_STR := PV_dm_x || '%';
> OPEN CURR FOR
> SELECT dm_c, dm_x
> FROM dm_row_ss
> WHERE dm_c = PV_dm_c
> AND dm_x LIKE V_LIKE_STR;
> ELSIF pv_flag = 'E' THEN
> V_LIKE_STR := PV_dm_x;
> OPEN CURR FOR
> SELECT dm_c, dm_x
> FROM dm_row_ss
> WHERE dm_c = PV_dm_c
> AND dm_x = V_LIKE_STR;
> END IF;
> END sp_get_all_descr;
>
/***************************************************************************
I wouldn't register the first three parameters as output parameters since your sp only defines them as input parameters.
> cs.registerOutParameter(4, OracleTypes.CURSOR);
> cs.execute();
> ResultSet rs = (ResultSet) cs.getResultSet();
> while (rs.next()) {
> String s = rs.getString(1);
> System.out.println(s + " pounds of " + s + " sold to date.");
> }
> }
> catch(Exception e)
> {
> System.out.println(" Exception is "+ e);
> }
> }
> public static void main(String args[])
> {
> getData();
> }
> }
>
/***************************************************************************
This would seem to indicate that the error is in the stored procedure itself. However, I don't see a single " in the sp, so it's hard to say. Have you executed the sp from within oracle itself?
![]() |
![]() |