Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help me with the procedure

Status
Not open for further replies.

kolla123

Programmer
Nov 20, 2002
5
US
I have a stored proceduer in SQL Server 2000. It does the following things,

1) Get All the withdrawl Dates on some business Logic.
2) Get all the clients with the the withdrawl dates in step1.

This procedures uses temp tables. I have to write the same procedure in oracle without using the temp tables. I am new to oracle. Please help me how to write the procedure.

Thanks,
Kolla123
 
You have to provide a bit more information. Do you want to read all clients for each date at a time so you can process them, or do you want to read all clients at once for all dates from step 1?

If the former then you can use PL/SQL and cursor loops:

[tt]FOR c1 IN (SELECT dates FROM table1) LOOP
FOR c2 IN (SELECT clients FROM table2 WHERE date = c1.date) LOOP
Do_Something;
.....
END LOOP;
END LOOP;[/tt]

If the latter, try a subquery:

[tt]SELECT client
FROM table2
WHERE date IN (SELECT date
FROM table1);[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top