pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chari Clark <cclark@nationalbackgrounddata.com>
To: pgsql-admin@postgresql.org
To: pgsql-novice@postgresql.org
Subject: PostgreSQL Errors...
Date: Thu, 17 Feb 2005 15:25:58 -0500
Message-ID: <4214FDD6.3070609@nationalbackgrounddata.com> (raw)

I created the following statement:

CREATE TYPE get_item_info_type AS (full_name varchar(300),dob 
varchar(300));

CREATE OR REPLACE FUNCTION sp_items(int8) RETURNS get_item_info_type AS
'
    DECLARE
        in_id      items.item_no%TYPE;
    BEGIN
        select
            coalesce(full_name, '') as fullname,
            coalesce(dob, '') as dob
        from
            items
        where
            item_no = in_id
        ;
    RETURN;
    END;
'
 LANGUAGE 'plpgsql';

This statement compiles fine, but when calling the funtion from a SELECT 
statement for a specific item, I get the following error message:

select * FROM sp_items('85000000000001');

ERROR:  return type mismatch in function returning tuple at or near ";"
CONTEXT:  compile of PL/pgSQL function "sp_aliases" near line 14

In order to return fullname and dob, I'm not sure if the data type for 
sp_items needs to match the get_item_info_type or what.

I think this is my last hurdle, so any help would be over-greatly 
appreciated.

Thanks,

-- 
Chari Clark
Database Administrator
National Background Data, LLC
A First Advantage Company (NASDAQ:  FADV)

352.629.9913
cclark@nationalbackgrounddata.com
www.nationalbackgrounddata.com




view thread (2+ messages)  latest in thread

Message-ID: <4214FDD6.3070609@nationalbackgrounddata.com>
Permalink:  ../4214FDD6.3070609@nationalbackgrounddata.com/
Also on:    postgresql.org/message-id/4214FDD6.3070609@nationalbackgrounddata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: cclark@nationalbackgrounddata.com, pgsql-novice@postgresql.org
  Subject: Re: PostgreSQL Errors...
  In-Reply-To: <4214FDD6.3070609@nationalbackgrounddata.com>
  References: <4214FDD6.3070609@nationalbackgrounddata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox