If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > How to copy record type into %row type.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-13-04, 09:43
C_BHANDARY C_BHANDARY is offline
Registered User
 
Join Date: Apr 2004
Posts: 49
Question How to copy record type into %row type.

hi,

I have a function as :-

create type cas as (o int,c int);

drop function f_c();

create or replace function f_chetan() returns cas as
'declare c record;
rec cas%rowtype;
begin
select contactid,telno into c from contact limit 1;
select c.contactid,c.telno into rec ;
return rec;
end;'language plpgsql;


select * from f_c();


If i give it this way, it gives this way the ip properly :-

o c
122 23



But,

if i change the statement in function from :-

select c.contactid,c.telno into rec ;

as :-

select c.* into rec ;

then it gives :-

ERROR: Relation "c" does not exist


AND,


if i change the statement in function from :-

select c.contactid,c.telno into rec ;

as :-

select c into rec ;

then it gives :-

ERROR: Attribute "c" not found


is there any way around this .

pls help.Thanks for any help in advance.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On