Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 4ECE2632870 for ; Thu, 5 Nov 2009 16:38:06 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 99929-02 for ; Thu, 5 Nov 2009 20:37:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) by mail.postgresql.org (Postfix) with ESMTP id 71930632381 for ; Thu, 5 Nov 2009 16:37:58 -0400 (AST) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1N695g-0005Z0-C3 for pgsql-sql@postgresql.org; Thu, 05 Nov 2009 12:37:56 -0800 Message-ID: <26221691.post@talk.nabble.com> Date: Thu, 5 Nov 2009 12:37:56 -0800 (PST) From: maboyz To: pgsql-sql@postgresql.org Subject: Converting T-SQL to PostgreSQL MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: thabani.moyo@distributel.ca X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 200911/25 X-Sequence-Number: 33376 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.