Creating a function in BigQuery

  • date 29th May, 2021 |
  • by Prwatech |
  • 0 Comments

Prerequisites

GCP account

Paste the below code in query editor.

CREATE TEMP FUNCTION multiplyput(x FLOAT64, y FLOAT64)

RETURNS FLOAT64

LANGUAGE js AS “””

     return x*y;

“””;

WITH numbers AS

     (SELECT 1 AS x,5 AS y

     UNION ALL

     SELECT 2 AS x, 10 AS y)

SELECT x, y, multiplyput(x,y) AS product

FROM numbers;

Click Run.

It will give the output.

Quick Support

image image