0

I'm trying to create simple user-defined function in BigQuery using sql query like this:

CREATE OR REPLACE FUNCTION
  distance_traveled_between_time(id STRING,
    starttime TIMESTAMP,
    endtime TIMESTAMP)
RETURNS FLOAT64 AS (
  (
    SELECT SUM(fueltanklevel) FROM `eva-boa-inf2.evaboa.gpsapi`
  )
)

Note: this is not the real function, it's just dummy function that return float value

I think, this is a valid SQL statement, but I have this error:

Routine name "distance_traveled_between_time" missing dataset while no default dataset is set in the request.

And I don't know what to fix at this point. Anyone knows?

0

1 Answer 1

1

Add the dataset to the name of the routine:

CREATE OR REPLACE FUNCTION
   dataset.distance_traveled_between_time

look here-^

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.