EXECUTE query INTO problem - Mailing list pgsql-sql

From Tk421
Subject EXECUTE query INTO problem
Date
Msg-id 492C66EA.4050008@gmail.com
Whole thread Raw
Responses Re: EXECUTE query INTO problem
Re: EXECUTE query INTO problem
List pgsql-sql
    I've got a problem with a function: It receives two parameters, the 
first, the table name, and the second, a where condition. The function 
looks like this:
   DECLARE      cod bigint;      query TEXT;
   BEGIN      query = 'SELECT codigo FROM ' || $1 || ' WHERE ' || $2;
      EXECUTE query INTO cod;      ·      ·      ·   END;
   I've alwais get the same error, in the EXECUTE sentence: it says: 
Error at or near NULL at character X
   I've also tried declaring cod as row, but the error is the same.
   Anybody can help me?
   Thank you very much


pgsql-sql by date:

Previous
From: "John Lister"
Date:
Subject: Re: Full text search ordering question
Next
From: Andreas Kretschmer
Date:
Subject: Re: EXECUTE query INTO problem