[Openroad-users] Ingres and Stored Procedures

233 views
Skip to first unread message

Bloomfield, Martin (PSD)

unread,
Nov 26, 2003, 9:47:41 AM11/26/03
to Openroad-Users, Park, Andy (PSD), Merry, Tracey (PSD)

We are investigating the use of Crystal Enterprise Reports to deliver database information to our users via our intranet.

Some of our existing reports have numerous complex select loop queries which call sub procedures for each row retrieved.  The consultant we had visit us did not know of any way to handle these select loops within Crystal.  He has asked us if Ingres can use "stored procedures" to perform the calculations required for the report. [I'm not sure if he is wanting Ingres to do the calculations as the data is retrieved, or will get Crystal to call the procedure for each record]

I am only aware of Ingres having database procedures triggered by database rules on tables.  Does anyone know if Ingres can use "stored procedures" and how we would create them?  Alternatively, can anyone who has used Crystal Reports (from a web front-end) to call this type of complex report provide any assistance?

Many thanks for assistance,

Martin Bloomfield.
_______________________
Application Developer & Database Administrator
IT Branch,
Pesticides Safety Directorate,
YORK

Email: martin.b...@psd.defra.gsi.gov.uk
Tel: (01904) 455783     GTN: 5138 5783
Fax: (01904) 455711
Website: www.pesticides.gov.uk



"Department for Environment, Food and Rural Affairs (Defra)

This email and any attachments is intended for the named recipient only. Its unauthorised
use, disclosure, storage or copying is not permitted. If you have received it in error, please
destroy all copies and inform the sender. Whilst this email and associated attachments will
have been checked for known viruses whilst within Defra systems we can accept no
responsibility once it has left our systems. Communications on Defra's computer systems
may be monitored and/or recorded to secure the effective operation of the system and for
other lawful purposes."
ATT02057.txt

Bloomfield, Martin (PSD)

unread,
Dec 1, 2003, 9:34:00 AM12/1/03
to ksm...@ipsoinc.com, Openroad-Users
Kent & others
 
Thanks for the reply.  I am in the process of trying to create a database procedure to return a set of data, but am struggling with the syntax.  Does anyone have any sample code they could send me showing how to create, & call, a database procedure which returns a set of data.
 
I have found a document on the CA site that does this via a global temporary table, but ideally want a method that does not require using a temporary table.  We are currently using Ingres 2.5, but are looking at upgrading our production system to 2.6 in the near future if this makes any difference.
 
Many thanks for your assistance,

Martin Bloomfield. 
 

 -----Original Message-----
From: Kent Smith [mailto:ksm...@ipsoinc.com]
Sent: 26 November 2003 15:11
To: Bloomfield, Martin (PSD); 'Openroad-Users'
Cc: Park, Andy (PSD); Merry, Tracey (PSD)
Subject: RE: [Openroad-users] Ingres and Stored Procedures

Ingres definitely supports stored procedures.  I haven't worked with Crystal enough to know how Crystal would call them, but I expect that it is possible.  There are limitations with stored procedures compared with Sybase or Oracle, and depending on the version of Ingres that you are running on your server.  Ingres has only recently been able to return an array - it used to be limited to a non-array list of values.  This made it difficult to have a SP run all the logic and just return a result set.  I believe with Ingres II, this restriction is lifted.
 
You create a procedure the same way you would create on to be fired off by a rule.  To execute it, use the sql statement:  "execute procedure_name".
 
--Kent
 

==================
Kent Smith
IPSO Incorporated
http://www.ipsoinc.com
Phone: +1-508-877-1401
AIMchat: ipsokent

ATT03249.txt

Gerner, Allen

unread,
Dec 1, 2003, 9:57:48 AM12/1/03
to Openroad-Users
Hi Martin,
              I noticed that you said you wanted to make a stored procedure.  I wanted to ask if it was possible to make this an extended stored procedure that you could put in a dynamic link library.  It would be cool if you could put a trigger in a DLL as well, but I may be way off with that. 
 
Allen Gerner
ITT Avionics
973.284.2434
allen....@itt.com
************************************
This email and any files transmitted with it are proprietary and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email
in error please notify the sender. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of ITT Industries, Inc.
The recipient should check this email and any attachments for the presence of viruses. ITT Industries accepts no liability for any damage caused by any virus transmitted by this
email.
************************************
ATT03254.txt

Kent Smith

unread,
Dec 1, 2003, 10:25:35 AM12/1/03
to Openroad-Users
Martin:
 
All the docs are available online:
 
 
is the best place to start.  See:
 
 Chapter 7: SQL Features / Database Procedures
 Chapter 8: SQL Statements / Create Procedure
 
for what you are looking for.  They include examples.
 
If these do NOT answer your question, feel free to come back for more....
ATT03268.txt

Kent Smith

unread,
Dec 1, 2003, 10:29:21 AM12/1/03
to Openroad-Users
Allen:
 
I don't know why you couldn't - you would just create a 3gl C procedure and embed whatever logic in it you wanted, including an execute procedure statement if you wanted.
 
You would NOT be able to get the server to call your DLL procedure as the RESULT of a trigger firing.  The DBMS server is not set up to do that.  It would be possible to have the trigger fire a procedure that raised a DBEVENT, though.  And you could have a daemon process waiting for the DBEVENT and triggering your DLL Procedure at that time.  But that's a lot of moving parts....
 
--Kent

==================
Kent Smith
IPSO Incorporated
http://www.ipsoinc.com
Phone: +1-508-877-1401
AIMchat: ipsokent

-----Original Message-----
From: openroad-us...@peerlessit.com [mailto:openroad-us...@peerlessit.com]On Behalf Of Gerner, Allen
Sent: Monday, December 01, 2003 9:58 AM
To: Openroad-Users
Subject: [Openroad-users] RE: Ingres and Stored Procedures

Hi Martin,
              I noticed that you said you wanted to make a stored procedure.  I wanted to ask if it was possible to make this an extended stored procedure that you could put in a dynamic link library.  It would be cool if you could put a trigger in a DLL as well, but I may be way off with that. 
 
Allen Gerner
ITT Avionics
973.284.2434
allen....@itt.com
-----Original Message-----
************************************
This email and any files transmitted with it are proprietary and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email
in error please notify the sender. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of ITT Industries, Inc.
The recipient should check this email and any attachments for the presence of viruses. ITT Industries accepts no liability for any damage caused by any virus transmitted by this
email.
************************************
ATT03272.txt
Reply all
Reply to author
Forward
0 new messages