我想从单引号内的参数传递一个值。实际上是针对RedShift的。
基本上,我想在下面的查询中生成这个。
unload ('select * from bhuvi')
to 's3://bhuvi-bucket/folder//user-data.csv'
iam_role 'arn:aws:iam::1111111:role/myredshiftrole'
delimiter '|' GZIP";
CREATE OR REPLACE PROCEDURE test_variable()
LANGUAGE plpgsql AS
$$
DECLARE
sql text;
s3_loc text;
role text;
deli text;
query text
BEGIN
sql:='select * from bhuvi';
s3_loc:='s3://bhuvi-bucket/folder/'
role:='arn:aws:iam::1111111:role/myredshiftrole'
deli:='|'
query := "unload (sql) to 's3_loc/user-data.csv' iam_role 'role' delimiter deli GZIP";
execute query;
END
$$;
答案 0 :(得分:0)
您可以像这样使用||
连接字符串:
f2 := f2 || '+' || f2;
(来自Overview of Stored Procedures in Amazon Redshift - Amazon Redshift)