Yep, that fixed it. Many thanks for the pointer.
From a performance point of view, I did look at using MOVE rather than
FETCH before I call UPDATE as I don't actually need to read the data
before applying the update. However in this situation, the ROW_COUNT is
always zero and can't be used whi
Hello
dynamic SQL has not impact on FOUND variable - use GET DIAGNOSTICS
varname = ROW_COUNT instead.
Regards
Pavel Stehule
2012/7/23 Andrew Hastie :
> Hi all,
>
> Apologies if the answer to my question is "obvious", but I'm fairly new to
> writing functions in PG. I think my problem is has a
On Tue, 2005-10-25 at 00:17 +, krishnaa sridharan wrote:
> Hi all
> When I installed postgresql in my computer, I had pl/pgsql language
> selected but still, I dont have any language installed. Can some one
> tell me how to install a language. thanks in advance. i am a beginner
> so any help wo
On Mon, 10 Nov 2003, Pavel Stehule wrote:
> Hello,
>
> it isn't problem. You can write
>
> SELECT INTO
> IF FOUND THEN
> ...
> END IF
>
> or
>
> SELECT INTO ..
> GET DIAGNOSTICS variable = ROW_COUNT;
> IF variable > 0 THEN
> ...
> END IF
>
> You can see on
> http://developer.postgr
Maybe you can use a for if there is only one row it will do the job just
like if there were many rows:
FOR referrer_keys IN SELECT * FROM cs_referrer_keys ORDER BY try_order
LOOP
a_output := a_output || '' IF v_'' || referrer_keys.kind || '' LIKE
''
|| referrer
Hello,
it isn't problem. You can write
SELECT INTO
IF FOUND THEN
...
END IF
or
SELECT INTO ..
GET DIAGNOSTICS variable = ROW_COUNT;
IF variable > 0 THEN
...
END IF
You can see on
http://developer.postgresql.org/docs/postgres/plpgsql-statements.html#PLPGSQL-SELECT-INTO
Regards
Pavel
On 3 Jun 1999, Anatoly K. Lasareff wrote:
# Yes. 'serial' type implements as 'int' type for field and sequence,
# which mane is __seq. So you can do this:
#
# INSERT into Network (parentID, networkName) values (pid, mname); netid
# := Network_networkID_seq.last_value;
That doesn't te
> MH> Question 2:
> MH> is there a way to get the value of the newly assigned primary key
> MH> after an insert? (rather then following the insert with a select)
>
> MH> e.g. (this would be nice if it worked (networkID is the PKey))
> MH> INSERT into Network (parentID, networkName) values (pid,
> "MH" == Mike Haberman <[EMAIL PROTECTED]> writes:
MH> I'm a bit new to plpgsql, so this may be an easy question,
MH> I've got a function (see below) that inserts into 3 different
MH> tables. Each table has a SERIAL type for it's primary key.
MH> Question 1:
MH> I want to group all 3