473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help me to create stored procedure for paging Using oracle

Hi Friends,
I have to create paging using oracle stored procedure for a c#.net application.I have to develop this application without using cursor. I tried following procedure but its giving 1 error as subquery returns more than 1 row. please help me to solve this table.

Table name :customers
Fields:CompanyName,ContactName,ContactTitle,Phone, Fax




CREATE OR REPLACE PROCEDURE temp_page1
(CurrentPage in integer,
PageSize in integer,
TotalRecords out integer)
is
FirstRec NUMBER;
LastRec NUMBER;
p_CompanyName nvarchar2(40);
p_ContactName nvarchar2(30);
p_ContactTitle nvarchar2(30);
p_Phone nvarchar2(24);
p_Fax nvarchar2(24);

BEGIN

FirstRec := (CurrentPage - 1) * PageSize;

LastRec := (CurrentPage * PageSize + 1);

select CompanyName,ContactName,ContactTitle,Phone,Fax
into
p_CompanyName,
p_ContactName,
p_ContactTitle,
p_Phone,
p_Fax
from customers
where (select rownum from customers) between FirstRec AND LastRec
group by CompanyName,ContactName,ContactTitle,Phone,Fax;

SELECT count(*) into TotalRecords from Customers;
END;

/
Jul 25 '07 #1
2 6034
debasisdas
8,127 Expert 4TB
i got the problem
what you are getting is as per the code you have written

but can you pass on few more details .

please specify what is the use of the procedure, what are you going to do with this , do you expect only one out put from the query.
Jul 26 '07 #2
i got the problem
what you are getting is as per the code you have written

but can you pass on few more details .

please specify what is the use of the procedure, what are you going to do with this , do you expect only one out put from the query.

Hi,
I am creating an asp.net application. In this application i want to arrange data in multiple pages.User should be able to change number of records per page.For this i am using oracle as the backend and i am going to call this procedure in my frontend i.e. c#.net..

I expect all records means multiple rows should select from the database..
Jul 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sam | last post by:
I'm trying to develop a stored procedure for a Crystal reports. Here's the stored procedure. The SP uses the following package for the REF CURSOR. CREATE OR REPLACE PACKAGE J1R_TYPES AS TYPE...
0
by: aychai | last post by:
Hi all, I am trying to make use Oracle9i db to call an external .Net Web Service from a JAva Stored Procedure. I created the .Net Web Service and use JDeveloper 9.0.3.4Build(1247) to create...
3
by: Jim Garrison | last post by:
I need to create a ResultSet in an Oracle Java Stored Procedure and return it to a PL/SQL caller. I've done quite a bit of research in Oracle's manuals and on the Web, and have found lots of...
1
by: Chandra Mohan | last post by:
Hi, We need help on following things, 1. Inputs on creating comments on the columns & Tables of a SQL Database & generating the sql script of that. 2. Is it possible to call a .exe file in...
10
by: serge | last post by:
I can not create a stored procedure that calls another not yet created stored procedure? In MS SQL I get a warning that the calling procedure does not exist but the new stored Procedure gets...
4
by: Magy | last post by:
What would be the best way to execute a Oracle stored procedure that excepts several input paramters, through a web method in vb.net. What would be a good way to get to the web method, the Oracle...
8
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
3
by: jenipriya | last post by:
Tables ------------ Employee (EmpID, EmpName,DeptID DateOfJoin, Sal, Addr) Finance (EmpID, Sal) Club (Clubname, EmpID, Fee, DateOfJoin) Leave (EmpID, Date) Department (DeptID, DeptName,...
3
by: andrewkl | last post by:
hi, I have the following Perl code that inserts a string to an Oracle DB via a stored procedure: #!/usr/local/bin/perl ## Perl v5.8.6 built for sun4-solaris use strict; BEGIN...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.