Converting T-SQL to PostgreSQL

Поиск
Список
Период
Сортировка
От maboyz
Тема Converting T-SQL to PostgreSQL
Дата
Msg-id 26221691.post@talk.nabble.com
обсуждение исходный текст
Ответы Re: Converting T-SQL to PostgreSQL  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-sql
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.



В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Learning about WITH RECURSIVE
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Converting T-SQL to PostgreSQL