Thread: Re: postgresql referencing and creating types as record

Re: postgresql referencing and creating types as record

From
vpmm2007
Date:
In reply to this post by vpmm2007
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));

NEED TO CONVERT THIS TO POSTGRES , ANYBODY PLS HELP ME I M NEW TO POSTGRES
THX&RGDS
VPMM



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/postgresql-referencing-and-creating-types-as-record-tp5813901p5814176.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: postgresql referencing and creating types as record

From
Adrian Klaver
Date:
On 08/07/2014 10:23 PM, vpmm2007 wrote:
>   In reply to this post by vpmm2007
> 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));
>
> NEED TO CONVERT THIS TO POSTGRES , ANYBODY PLS HELP ME I M NEW TO POSTGRES

Well you have not provided context for where and how you are using this,
so I will wing it.

 From here:

http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/record_definition.htm

I suspect it is being used in a pl/sql function. In that case Davids
previous pots holds. Look in:

CREATE TYPE
http://www.postgresql.org/docs/9.3/interactive/sql-createtype.html

CREATE FUNCTION
http://www.postgresql.org/docs/9.3/interactive/sql-createfunction.html

pl/pgsql
http://www.postgresql.org/docs/9.3/interactive/plpgsql.html

In particular:

http://www.postgresql.org/docs/9.3/interactive/plpgsql-declarations.html


If you want a more specific answer, we will need more specific information.


> THX&RGDS
> VPMM
>
>
>
> --
> View this message in context:
http://postgresql.1045698.n5.nabble.com/postgresql-referencing-and-creating-types-as-record-tp5813901p5814176.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: postgresql referencing and creating types as record

From
Adrian Klaver
Date:
On 08/10/2014 09:50 PM, Vaishali Maheshkar wrote:
>
> SIR,
>
> THANKS FOR YOUR REPLY ,

CCing list.
>
>
> actually i m trying to create record type data in postgres , but i cant
> declare it directly as in oracle my purpose is to create types of record
> type in oracle it was done by creating a package and declaring all the
> types inside it.
> Then used it with
> other packages as :
> create or replace function IT_R_A_get_se_CE_without_org
> (
>     in_LT_PAYMENT    in    CUM_A_TYPES. LT_PAYMENT
>      out_se_ce_hashmap        out
> IT_CUSTOM_RECORD_TYPES.LT_NUMBER_HASHMAP
> )
> as..
>
>
> i want to convert this package to postgres.
>
> it would be great if i get the solution.

The solution(s) have already been presented. Either get EDB Advanced
Server Plus and its Oracle compatibility features or use the links below
to craft your own solution. The basic issue is the community version of
Postgres does not have packages, so you will need to go another route if
you stick with it. That route would most likely revolve around using
CREATE TYPE to create the types you had in the package. Another way
would be to use IN and OUT parameters to a function which is shown in
the links below. The method you choose is dependent on the bigger
picture of what you are doing with the database/application/middleware.
Only you have that full picture, so there is only so much we can do from
this end.

>
> thx a lot
>
>
> On Fri, Aug 8, 2014 at 7:15 PM, Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
>     On 08/07/2014 10:23 PM, vpmm2007 wrote:
>
>            In reply to this post by vpmm2007
>         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));
>
>         NEED TO CONVERT THIS TO POSTGRES , ANYBODY PLS HELP ME I M NEW
>         TO POSTGRES
>
>
>     Well you have not provided context for where and how you are using
>     this, so I will wing it.
>
>      From here:
>
>     http://docs.oracle.com/cd/__B19306_01/appdev.102/b14261/__record_definition.htm
>     <http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/record_definition.htm>
>
>     I suspect it is being used in a pl/sql function. In that case Davids
>     previous pots holds. Look in:
>
>     CREATE TYPE
>     http://www.postgresql.org/__docs/9.3/interactive/sql-__createtype.html
>     <http://www.postgresql.org/docs/9.3/interactive/sql-createtype.html>
>
>     CREATE FUNCTION
>     http://www.postgresql.org/__docs/9.3/interactive/sql-__createfunction.html
>     <http://www.postgresql.org/docs/9.3/interactive/sql-createfunction.html>
>
>     pl/pgsql
>     http://www.postgresql.org/__docs/9.3/interactive/plpgsql.__html
>     <http://www.postgresql.org/docs/9.3/interactive/plpgsql.html>
>
>     In particular:
>
>     http://www.postgresql.org/__docs/9.3/interactive/plpgsql-__declarations.html
>     <http://www.postgresql.org/docs/9.3/interactive/plpgsql-declarations.html>
>
>
>     If you want a more specific answer, we will need more specific
>     information.
>
>
>         THX&RGDS
>         VPMM
>
>
>
>         --
>         View this message in context:
>
http://postgresql.1045698.n5.__nabble.com/postgresql-__referencing-and-creating-__types-as-record-__tp5813901p5814176.html
>
<http://postgresql.1045698.n5.nabble.com/postgresql-referencing-and-creating-types-as-record-tp5813901p5814176.html>
>         Sent from the PostgreSQL - general mailing list archive at
>         Nabble.com.
>
>
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>
>
>
> --
> Regards
> Vaishali Maheshkar
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com