Re: converting an oracle procedure to postgres - Mailing list pgsql-sql

From Josh Berkus
Subject Re: converting an oracle procedure to postgres
Date
Msg-id 200310201428.24871.josh@agliodbs.com
Whole thread Raw
In response to converting an oracle procedure to postgres  ("Clint Stotesbery" <cstotes@hotmail.com>)
List pgsql-sql
Clint,

>       v_taxstatus  varchar(1);
>       v_shipping   varchar(12);

Drop the varchar limits, it's not supported inside PL/pgSQL.

> I know I have to relpace the word PROCEDURE with FUNCTION but then it wants
> me to put RETURNS <datatype> but I don't want to return anything. I was
> thinking that I could just have it return integer and then after the last
> update statement put return 0. I'd rather not have it return a junk value
> though. What should I do?

I generally return integer or boolean for such functions.  For example, you
can have it return "TRUE" at the end, and then your client code can interpret
any non-true result (Error message, null) as an error.

--
-Josh BerkusAglio Database SolutionsSan Francisco



pgsql-sql by date:

Previous
From: "Clint Stotesbery"
Date:
Subject: converting an oracle procedure to postgres
Next
From: Tom Lane
Date:
Subject: Re: converting an oracle procedure to postgres