SELECT
  instcode,
  country_iso3,
  valid_instcode,
  name,
  acronym,
  parent_instcode,
  parent_name,
  address,
  country,
  zip_code AS Postal_Code,
  telephone,
  email,
  website,
  status,
  longitude AS lat,
  latitude AS lon,
  role_f646 AS Genebank_long_term_collections,
  role_f874 AS Genebank_medium_term_collections,
  role_f875 AS Genebank_short_term_collections,
  role_f647 AS Botanical_garden,
  role_f648 AS Breeder,
  role_f649 AS Network,
  role_f650 AS Community,
  role_f651 AS Educational,
  role_f652 AS Seed_producer,
  role_f653 AS Seed_supplier,
  role_f654 AS Farmer_community,
  role_f655 AS Research,
  role_f656 AS Extensionist,
  role_f657 AS Laboratory,
  role_f658 AS Publisher,
  role_f869 AS Administration_or_Policy,
FROM
  `fao-wiews-review.wiews.organizations`
WHERE
  CASE
    WHEN NOT @instcode="" THEN instcode=UPPER(@instcode)
  ELSE
  country_iso3=UPPER(@country_iso)
  AND (REGEXP_CONTAINS(name, CONCAT("(?i)", @name))
    OR @name="")
END
LIMIT
  30