|
-
Hi
well you can use a refrence cursor to return the result set directly to the java programme..something like this..
create or replace package demo
as
type cursorType is ref cursor;
end;
create or replace procedure listemp( p_cursor in out demo.cursorType )
as
begin
open p_cursor for select ename, empno from emp order by ename;
end;
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
class javacur
{
public static void main (String args [])
throws SQLException, ClassNotFoundException
{
String driver_class = "oracle.jdbc.driver.OracleDriver";
String connect_string = "jdbc racle:thin:@orcl:1521 racle8";
String query = "begin :1 := listemp; end;";
Connection conn;
Class.forName(driver_class);
conn = DriverManager.getConnection(connect_string, "scott", "tiger");
CallableStatement cstmt = conn.prepareCall(query);
cstmt.registerOutParameter(1,OracleTypes.CURSOR);
cstmt.execute();
ResultSet rset = (ResultSet)cstmt.getObject(1);
while (rset.next ())
System.out.println( rset.getString (1) );
cstmt.close();
}
}
try this..but i did not understand your question rightly why are you using a c1 to insert into a temp table ?
regards
Hrishy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|