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
Solved

using where clausule with Pervasive stored procedure in SQL

Posted on 2009-07-16
4
324 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
  • 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

839 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