我想在java中调用一个存储过程,就是一个查询而已,但不知怎么写,似乎有点麻烦,要用到游标啊。查询是这样的:
create or replace procedure query_city_by_id(p_id in number ) is
begin
select * from system.city where cid=p_id;
end;
create or replace procedure query_city_by_id(p_id in number ) is
begin
select * from system.city where cid=p_id;
end;
http://blog.csdn.net/sparadise1003/archive/2009/01/12/3758331.aspx
这个sp,没有问题,不过没有意义。 没有out参数,在plsql block里又没有dml语句。
create or replace procedure query_city_by_id(p_id in number,p_cursor in out types.cursorType ) is
begin
open p_cursor for select * from system.city where cid=p_id;
end;
3楼的p_cursor in out types.cursorType -->p_cursor out sys_refcursorsystem.city 。。怎么把表建到system用户下去了
p_id in number ,
p_cursor out sys_refcursor
)
is begin
open p_cursor for
select * from system.city where cid=p_id;
end;
p_id in number ,
p_cursor out sys_refcursor
)
is begin
open p_cursor for
select * from system.city where cid=p_id;
end;
p_id in number ,
p_cursor out sys_refcursor
)
is
begin
open p_cursor for
select *
from system.city
where cid=p_id;
end;
或换成函数:
create or replace function f_city_query_byid(
p_id in number
)
return sys_refcursor
is
p_cursor sys_refcursor;
begin
open p_cursor for
select *
from system.city
where cid=p_id;
return p_cursor;
end;