Re: [GENERAL] PL/PGSQL help for getting number of rows matched.

2003-11-10 Thread Nigel J. Andrews
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

Re: [GENERAL] PL/PGSQL help for getting number of rows matched.

2003-11-10 Thread Jaime Casanova
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

[GENERAL] PL/PGSQL help for getting number of rows matched.

2003-11-10 Thread Rajesh Kumar Mallah
Hi, We need to implement following logic efficiently. SELECT * from some_table where [ Query 1 ] IF rows_matched = 1 THEN use the single row that matched. ELSIF loop thru the results of [Query 1] END IF; Currently i am doing select count(*) for getting rows_matched in

Re: [GENERAL] PL/PGSQL help for getting number of rows matched.

2003-11-10 Thread Pavel Stehule
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