From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | vpmm2007 <vaishalim2007(at)gmail(dot)com> |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: postgresql referencing and creating types as record |
Date: | 2014-08-12 13:42:55 |
Message-ID: | CAHyXU0wcXXwj=ny=hS09GaVS8Q4PVJCH28C9X+9muYRt5b3M8Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Aug 7, 2014 at 11:50 PM, vpmm2007 <vaishalim2007(at)gmail(dot)com> wrote:
> create or replace package CUM_A_TYPES
> as
> type LT_PAYMENT is record
> (BASIC number,
> DP number,
> GRADE_PAY number
> );
> TYPE TYPE_CALC_TAX is record
> (
> FIN_ROLE_ID number(8),
> CALC_FOR_ROLE_CODE number(4));
Looks like something like:
CREATE TYPE LT_PAYMENT AS
(
BASIC numeric,
DP numeric,
GRADE_PAY numeric
);
CREATE TYPE TYPE_CALC_TAX AS
(
FIN_ROLE_ID numeric(8),
CALC_FOR_ROLE_CODE numeric(8)
);
CREATE OR REPLACE FUNCTION some_function() RETURNS LT_PAYMENT AS
$$
...
$$ LANGAUGE PLPGSQL;
I'd be studying the pl/pgsql documentation and the data type
differences (for number, you'd want to use int, numeric, or float8
depending on circumstances).
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Ramesh T | 2014-08-12 13:57:39 | Re: pgcluu |
Previous Message | Adrian Klaver | 2014-08-12 13:29:06 | Re: Inserting large binary data into lo type table |