Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

* On his knees and begging for help *

Status
Not open for further replies.

roberm1

Programmer
Mar 4, 2003
6
GB
Thanks to the people that have allready given me advice, it has been help but I am still very stuck, I cant seem to find examples thats show me howto translate my Procedures into functions.
I have serveral SQL Server Stored Procedures to translate into PostgreSQL functions (the returned values are used by a C++ Builder program called CallLog). I would be very grateful if some wonderful person could show me how to do this, below is a very simplest example of one of my Stored Procedures, could someone show me how this would written in PL/pgSQL, please ?
I know this seems very cheeky, but well im stuck & have lots of other to translate, showing me how this one should look would help me greatly in translating the others.

* On his knees and begging for help *

Here goes:

CREATE PROCEDURE [editcall]
(@locationin [varchar](50),
@typein [varchar](50),
@notesin [varchar](1000),
@equipment [varchar](50),
@idin [int])
AS

Declare @locationid int
Declare @typeid int
Declare @equipid int

Select @locationid = (Select id from location where ward = @locationin)
Select @typeid = (Select id from type where type = @typein)
Select @equipid = (Select id from equipment where equipment = @equipmentin)

UPDATE [CallLog].[dbo].[calls]

SET

[location] = @locationid,
[type] = @typeid,
[notes] = @notesin,
[equipment] = @equipid

WHERE
([id] = @idin)

The End.
I am really, really very stuck, Please, please, please help!
Thanks, Mark.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top