Search Postgresql Archives

Re: postgresql referencing and creating types as record

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 7, 2014 at 11:50 PM, vpmm2007 <vaishalim2007@xxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux