Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

using where clausule with Pervasive stored procedure in SQL

Posted on 2009-07-16
4
Medium Priority
?
347 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 375 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

610 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