What is stored procedure and how to create and call stored procedures?

21 0 0
                                    

a group of SQL statements that forms a logical unit and performs a particular task.
are used to encapsulate a set of operations or queries to execute on database.
can be compiled and executed with different parameters and results and may have any       combination of input/output parameters

Create procedure

Create procedure procedurename (specify in, out and in out parameters)

BEGIN Any multiple SQL statement; END;

Call procedure in java application using CallableStatement

CallableStatement csmt = con. prepareCall(”{call procedure name(?,?)}”);

 csmt. registerOutParameter(column no. , data type);

csmt. setInt(column no. , column name) csmt.execute();

See the following video on collection interface in Java API.  

http://www.youtube.com/watch?v=bBxfjR7c4wY  

Also visit our site from more such Java / J2EE/ Core Java interview question with answers videos.

What is stored procedure and how to create and call stored procedures?Where stories live. Discover now