Solved

using where clausule with Pervasive stored procedure in SQL

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Read about achieving the basic levels of HRIS security in the workplace.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

773 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