Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to know if oracle style object oriented programming is possible in postgresql 8.4. I have installed orafce. When I tried to create a object like so:

CREATE TYPE addr_obj_typ AS OBJECT (
    street          VARCHAR2(30),
    city            VARCHAR2(20),
    state           CHAR(2),
    zip             NUMBER(5));

And I got this error:

ERROR:  syntax error at or near "object"
LINE 1: create type addr_obj_typ as object
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Something like this?

CREATE DOMAIN zipcode AS 
    INT CHECK(VALUE < 99999)
;

CREATE TYPE addr_obj_typ AS  (
    street  VARCHAR(30),
    city    VARCHAR(20),
    state   CHAR(2),
    zip     zipcode
);

SELECT
    CAST(('a','b','c','90210') AS addr_obj_typ);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.