Search Postgresql Archives

Re: postgresql varchar[] data type equivalent in Oracle

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

 



Murali Doss wrote:
> 
> I like to know about postgresql varchar[ ] data type 
> equivalent in Oracle.

The best I can think of is a VARRAY, though you cannot access
it by index in SQL (you need a stored procedure or client API
for that). Quite clumsy.

Example:

SQL> CREATE TYPE VARCHAR_A AS VARRAY(100) OF VARCHAR2(10);
  2  /

Type created.

SQL> CREATE TABLE N(ID NUMBER(10,0) PRIMARY KEY, A VARCHAR_A);

Table created.

SQL> INSERT INTO N VALUES (1, VARCHAR_A('one', 'two', 'three'));

1 row created.

SQL> SELECT A FROM N WHERE ID=1;

A
------------------------------------------------------------------------
--------
VARCHAR_A('one', 'two', 'three')

SQL> SELECT X.* FROM N, TABLE(N.A) X WHERE ID=1;

COLUMN_VALUE
----------------------------------------
one
two
three


Yours,
Laurenz Albe


[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