Comments are available to members only. Sign up or Log in to view these comments.
Main Topics
Browse All Topics Hi,
I have seen examples using stored procedures in SQL server for retrieving few records at at time (asp.net custom paging..)..
has anybody done that in Oracle??
I want to convert the following SQL server procedure to Oracle...and i am having difficulty in the creation of temporary tables..global temporary tables is not working as its not retrieving any result set at all!!!!
Here is an example in SQL server
from dotnetjunkies..
CREATE PROCEDURE [Get_Customers_By_Page]
@CurrentPage int,
@PageSize int,
@TotalRecords int output
AS
--Create a temp table to hold the current page of data
--Add and ID column to count the records
CREATE TABLE #TempTable
(
ID int IDENTITY PRIMARY KEY,
CompanyName nvarchar(40),
ContactName nvarchar (30),
ContactTitle nvarchar (30),
Phone nvarchar (24),
Fax nvarchar (24)
)
--Fill the temp table with the Customers data
INSERT INTO #TempTable
(
CompanyName,
ContactName,
ContactTitle,
Phone,
Fax
)
SELECT
CompanyName,
ContactName,
ContactTitle,
Phone,
Fax
FROM
Customers
--Create variable to identify the first and last record that should be selected
DECLARE @FirstRec int, @LastRec int
SELECT @FirstRec = (@CurrentPage - 1) * @PageSize
SELECT @LastRec = (@CurrentPage * @PageSize + 1)
--Select one page of data based on the record numbers above
SELECT
CompanyName,
ContactName,
ContactTitle,
Phone,
Fax
FROM
#TempTable
WHERE
ID > @FirstRec
AND
ID < @LastRec
--Return the total number of records available as an output parameter
SELECT @TotalRecords = COUNT(*) FROM Customers
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: markgeerPosted on 2004-09-02 at 10:29:38ID: 11965929
Comments are available to members only. Sign up or Log in to view these comments.