I figured it out... the problem was calling nextval("seq") with double quotes.
Normally, you would do "select nextval('seq')". From within a function, calling nextval with single quotes around the argument, causes a syntax error.
SOLUTION:
you need to use "backslash escape" sequences around th
Thanks for the help Tony,
But im still having some trouble.
Here is the exact function
---
CREATE OR REPLACE FUNCTION sp_slide_create(int4, bool, bool, bool, varchar, text, varchar, varchar, int4)RETURNS int4 AS'DECLARE aScriptID ALIAS FOR $1; aAllowDGP ALI
ahhh... very nice. Thank you.
On 7/5/05, Tony Caduto <[EMAIL PROTECTED]> wrote:
Or upgrade your server to 8.x and use dollar quoting.with dollar quoting all that is a thing of the past.
CREATE FUNCTION sp_slide_create(int4) RETURNS int4 AS$$DECLAREaScriptID ALIAS FOR $1;seqID int4 := nextval('gense
Or upgrade your server to 8.x and use dollar quoting.
with dollar quoting all that is a thing of the past.
CREATE FUNCTION sp_slide_create(int4) RETURNS int4 AS
$$
DECLARE
aScriptID ALIAS FOR $1;
seqID int4 := nextval('genseq'); -- no magic needed with dollar qouting :-)
BEGIN
INSERT INTO tblsli
Try this version of your function.
I don't think you can assign a value to a variable in the declaration
section with the return value of a function.
CREATE OR REPLACE FUNCTION sp_slide_create(int4, bool, bool, bool,
varchar, text, varchar, varchar, int4)
RETURNS int4 AS'
DECLARE
aScriptID AL
Russ Brown <[EMAIL PROTECTED]> writes:
> This just made me think. If I was writing this function, I would have
> written it as an SQL function like this:
> CREATE or REPLACE FUNCTION getSeq() RETURNS int AS $$
> SELECT nextval('myseq');
> $$ LANGUAGE SQL;
> Does anybody know which version is actu
Tony Caduto wrote:
> All you where really mising was a semi colon afer nextval('myseq') and
> the begin end.
>
> CREATE or REPLACE FUNCTION getSeq()
> RETURNS int AS
> $$
> begin
> RETURN nextval('myseq');
> end;
> $$
> LANGUAGE 'plpgsql';
>
> Clark Allan wrote:
>
This just made me think. If I
All you where really mising was a semi colon afer nextval('myseq') and
the begin end.
CREATE or REPLACE FUNCTION getSeq()
RETURNS int AS
$$
begin
RETURN nextval('myseq');
end;
$$
LANGUAGE 'plpgsql';
Clark Allan wrote:
--
CREATE FUNCTION getSeq()
RET
I am new to Postgre, and am still learning some of the basics...
please bare with me.
I need to know how to access a sequence from within a function. Let me
know whats wrong with the following...
(this is not the exact function, just for examples sake...)
-