Search Postgresql Archives

Re: plpgsql and arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Artis Caune wrote:
Thanks a lot!
Normal upper/lower loop works fine:


CREATE OR REPLACE FUNCTION add_user( VARCHAR(128)[] ) RETURNS SMALLINT

I'd rename the function "add_users()"

AS $$
DECLARE
  v_uid SMALLINT;
  v_low SMALLINT;
  v_upp SMALLINT;
  empty BOOLEAN := TRUE;
BEGIN
  SELECT INTO v_low array_lower($1,1);
  SELECT INTO v_upp array_upper($1,1);

You can also write this:
  v_low := array_lower($1,1);

--
  Richard Huxton
  Archonet Ltd


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux