user156862
user156862

Reputation:

Oracle stored procedure multiple resultsets

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
WHERE 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.

Upvotes: 1

Views: 397

Answers (1)

Tony BenBrahim
Tony BenBrahim

Reputation: 7290

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';

Upvotes: 2

Related Questions