Subject | Nested query in stored procedure |
---|---|
Author | Raigo |
Post date | 2004-11-11T12:26:42Z |
In Emplyee database there is a table DEPARTMENT and a procedure
ORG_CHART to demonstrate nested select.
My question: with this sort of table, how is it possible to get all
master DEPARTMENTS of certain department?
For example to get hierarchy for department "marketing".
180 Marketing, has head 100 Sales & Marketing, and it has top 000
Headquarters.
With input value dept_no 180, how to return something like this:
180 Marketing
100 Sales & Marketing
000 Headquarters
I understand I shoud create some loop to go until dept_no is null.
thanks.
ORG_CHART to demonstrate nested select.
My question: with this sort of table, how is it possible to get all
master DEPARTMENTS of certain department?
For example to get hierarchy for department "marketing".
180 Marketing, has head 100 Sales & Marketing, and it has top 000
Headquarters.
With input value dept_no 180, how to return something like this:
180 Marketing
100 Sales & Marketing
000 Headquarters
I understand I shoud create some loop to go until dept_no is null.
thanks.