From: maboyz <thabani.moyo@distributel.ca>
To: pgsql-sql@postgresql.org
Subject: Converting T-SQL to PostgreSQL
Date: Thu, 5 Nov 2009 12:37:56 -0800 (PST)
Message-ID: <26221691.post@talk.nabble.com> (raw)
I am trying to re write the following stored proc as a postgresql
function......but am new to postgres and it is kind of getting really
confusing trying to learn and let alone understand the syntax:
CREATE PROCEDURE [dbo].[GetAppAvailability]
@AuditAvailable bit output,
@BillingAvailable bit output,
@ReturnValue int output
AS
SET NOCOUNT ON
set @AuditAvailable = (select app_Status from AppAvailability where
app_Functionality = 'Audit')
set @BillingAvailable = (select app_Status from AppAvailability where
app_Functionality = 'Billing')
Set @ReturnValue = @@Error
I have this in postgres but obviously it is not correct:
CREATE OR REPLACE FUNCTION GetAppAvailability(OUT auditAvailable character
varying, OUT billingAvailable character varying)
AS
$BODY$
set $1 = (select "app_Status" from "AppAvailability" where
"app_Functionality" = 'Audit');
set $2 = (select "app_Status" from "AppAvailability" where
"app_Functionality" = 'Billing');
$BODY$
LANGUAGE 'sql' VOLATILE
COST 100;
--
View this message in context: http://old.nabble.com/Converting-T-SQL-to-PostgreSQL-tp26221691p26221691.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: thabani.moyo@distributel.ca
Subject: Re: Converting T-SQL to PostgreSQL
In-Reply-To: <26221691.post@talk.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox