how many quotes?

From: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
To: pgsql-general(at)postgresql(dot)org
Subject: how many quotes?
Date: 2003-12-02 16:12:01
Message-ID: 1070381520.3788.12.camel@taz.oficina
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I need a function to fetch the nextval of a sequence (it should do other
things, but my problem is the nextval() call), like this:

CREATE OR REPLACE FUNCTION test() RETURNS INTEGER AS '
DECLARE
val INTEGER;
BEGIN
val:=SELECT nextval(''''''''''usuarios_seq'''''''''');

--do other things
END;
' LANGUAGE 'plpgsql';

SELECT test();
ERROR: syntax error at or near "SELECT" at character 8
CONTEXT: PL/pgSQL function "test" line 4 at assignment

I can't figure out how many quotes I should use to call nextval. I've
read an article at the techdocs about this, but didn't help me. If
anyone knows the *magic* number, please tell me :)

thanks in advance.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jay O'Connor 2003-12-02 16:21:33 Re: language war
Previous Message Tom Lane 2003-12-02 15:46:29 Re: Invalid page header in block