I want to query this...
--> SELECT * FROM bbs ORDER BY ref desc, step ASC LIMIT 12;
this query doesn't refer the index that made by this query.
--> CREATE INDEX idx_bbs ON bbs (ref, step);
but, i change the query that "ref desc" to "ref asc".
then query refer the index, and i can see a result v
Hi all, I am not sure If it is allowed to use cursor inside pgsql functions.
If it is possible, please someone could send exact synatx how it is used. If
it is not allowed is there a way arround it? I need to do some calculations
and then return this value as text.
Thanks in advance for all your
Hi all,
Here is a plpgsql function:
flipr'#create function test_cur() returns text as'
flipr'# declare
flipr'# mycur cursor for select title from songs where song_id=10;
flipr'# usrrecord;
flipr'# resultstext;
flipr'# begin
flipr'# open mycur;
flipr'# fetch next from mycur into
I just know you can use implict cursor inside the plpgsql
e.g
declare
rec record;
begin
FOR rec IN select_clause LOOP
statements
END LOOP;
end;
Jie LIANG
St. Bernard Software
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
[EMAIL PRO
I just know you can use implict cursor inside the plpgsql
e.g
declare
rec record;
begin
FOR rec IN select_clause LOOP
statements
END LOOP;
end;
Jie LIANG
St Bernard Software
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
[EMAIL PRO
I've just spent the last day or two trying to get to grips with plpgsql and can't
believe how abysmal the documetentation and examples are.
I've been trawling through the mailist lists and I notice there was talk back in 1999
abouta PLPGSQL Cook Book - did anything come of this?
If no one is ma
Are recursive functions allowed in in 7.0.3 as I seem to be unable to get them to work
in plpgsql, it just freezes and I have to do ctrl-alt-c.
ie calling the same function name from within some form of loop, possible to 4 or 5
levels?
Also is it possible to output any debugging info, all I rea
Jie Liang wrote:
> I just know you can use implict cursor inside the plpgsql
> e.g
> declare
result text;
tcount int4;
>
> rec record;
> begin
> FOR rec IN select_clause LOOP
> statements
> END LOOP;
> end;
>
Thank you Jie for your help. I am bit confused about how it works. I want for
ea
Hi,
How can I concatnate two varialbles, seperated by a |, that are type text
together?
v, v1 text;
some work
then
res:= v ||''|''|| v1;
this syntex does not work in plpgsql??
Any ideas how to do it ???
Thanks.
Najm
the select query returns the first row to rec. You can then access its values with:
rec.field_name
at END LOOP it jumps back to FOR checks to see if there any more rows and if so moves
to the next row and repeats the loop.
It also looks like your missing a LOOP keyword at the end of the FOR line
On Sat, 10 Feb 2001, Najm Hashmi wrote:
> How can I concatnate two varialbles, seperated by a |, that are type text
> together?
> v, v1 text;
> some work
> then
> res:= v ||''|''|| v1;
What error is it giving? Do you need to be using two single quotes in the
statement?
-- Brett
I was able to do a function that took two arguments and did
that under 7.1beta3 with no trouble.
What message are you getting?
On Sat, 10 Feb 2001, Najm Hashmi wrote:
> Hi,
> How can I concatnate two varialbles, seperated by a |, that are type text
> together?
> v, v1 text;
> some work
> th
Najm Hashmi <[EMAIL PROTECTED]> writes:
> Hi all, I am not sure If it is allowed to use cursor inside pgsql functions.
> If it is possible, please someone could send exact synatx how it is used. If
> it is not allowed is there a way arround it? I need to do some calculations
> and then return t
Try:
create function foo(text) returns int4 as '
delcare
tcount int4:=0;
begin
for rec IN select title, dcount from songs where artist=$1 LOOP
tcount:= tcount+rec.dcount;
END LOOP;
return tcount;
end;
' language 'plpgsql';
call it by:
db> select foo('Najm Hashmi');
it will return how
Hi,
You can use every sql function and operator in plpgsql, so
v||''|''||v2 is OK.
however, you cannot do:
declare
v,v2 text;
you should do:
v text;
v2 text;
also you initialize like:
v text:=;
Jie LIANG
St. Bernard Software
Internet Products Inc.
10350 Science Center Drive
Suite 100, San
On Friday 09 February 2001 12:23, [EMAIL PROTECTED] wrote:
> I've just spent the last day or two trying to get to grips with plpgsql and
> can't believe how abysmal the documetentation and examples are. I've been
> trawling through the mailist lists and I notice there was talk back in 1999
> about
[ Charset ISO-8859-1 unsupported, converting... ]
> On Friday 09 February 2001 12:23, [EMAIL PROTECTED] wrote:
> > I've just spent the last day or two trying to get to grips with plpgsql and
> > can't believe how abysmal the documetentation and examples are. I've been
> > trawling through the mail
thanks
<[EMAIL PROTECTED]> writes:
> Are recursive functions allowed in in 7.0.3
Sure.
play=> create function myfactorial(int) returns int as '
play'> begin
play'> if $1 > 1 then
play'> return $1 * myfactorial($1 - 1);
play'> end if;
play'> return $1;
play'> end;' language 'plpgsql';
CREATE
p
19 matches
Mail list logo