Solved

using where clausule with Pervasive stored procedure in SQL

Posted on 2009-07-16
4
337 Views
Last Modified: 2012-05-07
I've been trying to implement a where function in my iReport using SQL

i call a procedure (pTest), but i am unable to add a where clausule! It is no option to change the procedure unfortunately.
Do i need to make temp tables? how do i insert the return of a procedure in a table?
0
Comment
Question by:pr0fier
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 18

Expert Comment

by:mirtheil
ID: 24870089
You have to drop and recreate the stored procedure in order to edit it.  
You return records from a stored procedure using the RETURNS clause or an OUT parameter.  I would suggest using the RETURNS clause as it returns the result as a resultset.  An example of a Stored Procedure with a RETURNS clause:
CREATE PROCEDURE DATERETURNPROC(IN :PDATE DATE)
RETURNS(
ID INTEGER,
Name CHAR(7),
Section CHAR(3),
Max_Size USMALLINT,
Start_Date DATE,
Start_Time TIME,
Finish_Time TIME,
Building_Name CHAR(25),
Room_Number UINTEGER,
Faculty_ID UBIGINT
);
BEGIN
SELECT ID, Name, Section, Max_Size, Start_Date, Start_Time, Finish_Time, Building_Name, Room_Number, Faculty_ID FROM CLASS WHERE START_DATE = :PDATE;
END;
 
And the calling for the stored procedure: 
CALL DATERETURNPROC('1995-06-05')

Open in new window

0
 

Author Comment

by:pr0fier
ID: 24876492
as i stated above (perhaps unclear) i cannot change the current procedure because it is used for a lot of other applications.
 
Might it be a sollution to call the pTest procedure inside a (newly, temporary) procedure and run a new SELECT statement with the WHERE clausule over the returned (first, pTest) data?
 
0
 
LVL 18

Accepted Solution

by:
mirtheil earned 125 total points
ID: 24886137
I don't think there's any way to do what you are thinking.  
What I would suggest would be to extract the actual SQL statement being issued in the Stored Procedure, modify it with the WHERE clause you are wanting and either execute it directly or create a secondary stored procedure that executes the SQL you want.  That would maintain the original Stored Procedure and allow you to restrict with the WHERE clause.
0
 

Author Comment

by:pr0fier
ID: 24893073
agree with Mirtheil - this cannot be done with pervasive and ireport, i will try to make a resultset with this stored procedure and query that one :(
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question