You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by DIEGO RODRIGO <di...@totalfinaelf.com> on 2000/11/16 17:04:49 UTC

Really Offtopic - Resultsets from Oracle stored proc

Hi,
    I apologise for this offtopic message...

    Does anyone know how to retrieve a RecordSet (using CallableStatement) from
an ORACLE stored procedure ?

    Can you point me to documentation/HOWTOs ?

    Thanks,

diego.


Re: Really Offtopic - Resultsets from Oracle stored proc

Posted by "Michael G. Anderson C.T.O." <RI...@home.com>.
Here is something that I had to write up for a recruiter to test the knowledge of
Web Architect/DBA candidates....
I never got a thank you either :(

Perhaps I made an error in these Q&As...

Begin here:********************

Q: Please write 2 lines of  'java' code that will execute an "Oracle stored
Procedure" called SHOW_SUPPLIERS. <assume the code will be in a servlet.>

A: CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");
     ResultSet rs = cs.executeQuery();

If he/she writes this exactly -- he/she is probably tour 'candidate' Note: they
must have the "curly braces" in the command.
i.e. The part that is enclosed in curly braces is the escape syntax for stored
procedures. and the java code is "case-sensitive"

Q: Ask the candidate what class is "CallableStatement" subclassed from?
A: The class CallableStatement is a subclass of PreparedStatement.

Aside from having a mastery over PL/SQL (I mean he/she really better know PL/SQL)
ask them:

Q: What are the advantages of dynamic SQL?
A:  In practice, static SQL will meet nearly all  programming needs. Use dynamic
SQL only if  its open-ended flexibility is needed. Its use is suggested when one of

the following items is unknown at precompile time:

     1) text of the SQL statement (commands, clauses, and so on)

     2) the number of host variables

     3) the datatypes of host variables

     4) references to database objects such as columns, indexes, sequences, tables,

usernames, and views

End here:********************


regards,

mike anderson
DIEGO RODRIGO wrote:

> Hi,
>     I apologise for this offtopic message...
>
>     Does anyone know how to retrieve a RecordSet (using CallableStatement) from
> an ORACLE stored procedure ?
>
>     Can you point me to documentation/HOWTOs ?
>
>     Thanks,
>
> diego.