Search Postgresql Archives

Using composite types within PLPGSQL Function

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

 



Hi,

                I am trying to use a composite type within a function, I have tried SELECT INTO and direct assignment to set the value of a single element within the composite variable with no joy.  I hope this is simply a case of my not knowing the correct syntax?

 

My example code is :

 

CREATE TYPE testtype AS (

a INTEGER,

b INTEGER

);

 

CREATE OR REPLACE FUNCTION test() RETURNS INTEGER AS $$

DECLARE

  x testtype;

BEGIN

(x).a:=1;

RETURN 1;

END

$$ LANGUAGE plpgsql;

 

This throws up syntax errors for the (x).a:=1; line.. I have also tried SELECT INTO (x).a 1;

 

Any help much appreciated, version of PostgreSQL is 8.4 under Debian.

 

Thanks

 

Graeme

--
Graeme Hinchliffe
Senior Systems Designer, Zen Internet
T: 0845 058 9000
F: 0845 058 9005
W: zen.co.uk

BT have increased their monthly phone line rental to £15.45 per month. Our remains at £11.22. Switch now : http://www.zen.co.uk/home-office/voice/phone-services.aspx

This message is private and confidential. If you have received this message in error, please notify us and remove it from your system.

Zen Internet Limited may monitor email traffic data to manage billing, to handle customer enquiries and for the prevention and detection of fraud. We may also monitor the content of emails sent to and/or from Zen Internet Limited for the purposes of security, staff training and to monitor quality of service.

Zen Internet Limited is registered in England and Wales, Sandbrook Park, Sandbrook Way, Rochdale, OL11 1RY Company No. 03101568 VAT Reg No. 686 0495 01

[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