Skip site navigation (1) Skip section navigation (2)

PostgreSQL Errors...

From: Chari Clark <cclark(at)nationalbackgrounddata(dot)com>
To: pgsql-admin(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: PostgreSQL Errors...
Date: 2005-02-17 20:25:58
Message-ID: 4214FDD6.3070609@nationalbackgrounddata.com (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-novice
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(at)nationalbackgrounddata(dot)com
www.nationalbackgrounddata.com


Responses

pgsql-novice by date

Next:From: Dan QuaroniDate: 2005-02-18 15:05:09
Subject: Copy can't parse a float?
Previous:From: A KDate: 2005-02-17 17:05:22
Subject: Bad Boolean external represenation *HELP*!

pgsql-admin by date

Next:From: Joel FradkinDate: 2005-02-17 23:28:50
Subject: Is there a link or recomendation on what tools work best for admin?
Previous:From: InsydeDate: 2005-02-17 19:39:24
Subject: ODBC driver version

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group