开发者

TYPE type_name IS TABLE OF NUMBER INDEX BY VARCHAR2(64) from Oracle in PostgreSQL

开发者 https://www.devze.com 2023-02-22 06:33 出处:网络
Is there an equivalent type declaration in PostgreSQL to this one in Oracle: 开发者_如何学PythonTYPE type_name IS TABLE OF OBJECT

Is there an equivalent type declaration in PostgreSQL to this one in Oracle:

开发者_如何学PythonTYPE type_name IS TABLE OF OBJECT

I have a type:

CREATE TYPE t_pick AS
(
    bet_no  integer,
    result  smallint
);

And now I want to create table using this type. In Oracle I did this with a declaration like above. But how to do this in PostgreSQL?

Or is there another way?


You cannot define array types or collection types in PostgreSQL.
But you can create a composite type and then use it in an array:

CREATE TYPE t_pick AS
( 
  bet_no integer;
  result smallint;
);

CREATE OR REPLACE FUNCTION foo ..

DECLARE 
  var t_pick[];
BEGIN
 ...
0

精彩评论

暂无评论...
验证码 换一张
取 消