开发者

Oracle stored procedure multiple resultsets

开发者 https://www.devze.com 2023-03-15 10:21 出处:网络
I have one oracle stored proc that will select customers based on a condition and also select all orders for customers that fulfill the requirements of the first select.

I have one oracle stored proc that will select customers based on a condition and also select all orders for customers that fulfill the requirements of the first select.

I have tried code like:

OPEN customer_cur FOR
SELECT * FROM Customer
WH开发者_如何转开发ERE Country = 'UK';

OPEN orders_cur FOR
SELECT * FROM Orders
WHERE CustomreNo in (select CustomerNo from customer_cur);

This doesn't work as you can't select from a cursor but I need a means to implement the desired behavior.

I want to return two table so that I can display a hierarchical grid to the user.

Thanks Alan.


OPEN customer_cur FOR
SELECT * FROM Customer
WHERE Country = 'UK';

OPEN orders_cur FOR
SELECT * FROM Orders, Customer
WHERE Orders.CustomreNo=Customer.CustomerNo
and Customer.Country = 'UK';
0

精彩评论

暂无评论...
验证码 换一张
取 消