Error passing parameter to functions

From: "Jose Luis LG" <jlopezgonz(at)terra(dot)es>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: Error passing parameter to functions
Date: 2002-03-05 09:33:50
Message-ID: 014d01c1c428$dc2e43c0$424d4d7d@Servidor2K.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

HI,

Could someone tell me what I am doing wrong please (Postgresql 7.2).
Thanks


The functions I am creating is:


CREATE OR REPLACE FUNCTION getthemedescription (text) RETURNS text AS
'
DECLARE
themeid ALIAS FOR $1;
metaid metadata.meta_id%TYPE;
generalid general.general_id%TYPE;
descriptionidcursor CURSOR FOR SELECT description_id FROM
general_description WHERE general_id = generalid;

BEGIN
SELECT INTO metaid meta_id FROM themehasmetadata WHERE theme_id =
themeid;
SELECT INTO generalid general_id FROM meta_general WHERE meta_id =
metaid;
OPEN descriptionidcursor;

RETURN "descriptionidcursor"
END;
' LANGUAGE 'plpgsql';


I call this function in the following way:


String themeID = "mathematics";
String queryString = "SELECT getthemedescription(" + themeID +
")");

Statement stmt = conn.createStatement();

ResultSet l_cursorRSet = stmt.executeQuery(queryString);

.......

If I send the themeID as above I get: ERROR: Attribute 'mathematics' not
found.

If I send the themeID = "'mathematics'" I get: fmgr_info: function
24907: cache lookup failed.

I think it has something to do with the quotes, but what?


Best regards


Jose Luis

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Ashley Clark 2002-03-05 15:49:28 Re: PL/pgSQL Syntax Problem
Previous Message Jeroen T. Vermeulen 2002-03-04 23:55:09 libpqxx "robust" transactions