TBose
TBose

Reputation: 115

SELECT INTO clause in bigquery

I am getting error while running the below code. I did SELECT INTO in PLSQL but not understanding how to do same in bigquery.

 CREATE OR REPLACE PROCEDURE `linear-charmer-344806.2143.Test`(name STRING, OUT id STRING)
    begin 
    set (id) =(select roll from `linear-charmer-344806.2143.Employee` 
    where name = "Triparna");
    end;

Upvotes: 0

Views: 687

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 173210

you should have either scalars on both sides or structs on both sides

for example

scalars

set id =(select roll from `linear-charmer-344806.2143.Employee` 
where name = "Triparna");    

or structs

set (id) =(select as struct roll from `linear-charmer-344806.2143.Employee` 
where name = "Triparna");    

In your case, looks like former option is the way to go

Upvotes: 1

Related Questions