在PostgreSQL中使用COPY创建过程,FROM关键字既不识别外部变量也不识别内部变量。
CREATE OR REPLACE PROCEDURE YYY (
external_variable varchar
)
language plpgsql
AS $$
declare
internal_variable varchar;
begin
COPY TEMP_ALL_ROWS_BKMVDATA FROM external_variable DELIMITER ',' CSV HEADER;
end;
$$
回复:
ERROR: syntax error at or near "external_variable"
LINE 9: COPY TEMP_ALL_ROWS_BKMVDATA FROM external_variable DELIMITER...
^
SQL state: 42601
Character: 162
与internal_variable相同。
我已经试着忽略变量部分,以确保它周围的一切工作,确实。
CREATE OR REPLACE PROCEDURE YYY (
external_variable varchar
)
language plpgsql
AS $$
declare
internal_variable varchar;
begin
COPY TEMP_ALL_ROWS_BKMVDATA FROM '' DELIMITER ',' CSV HEADER;
end;
$$
CREATE PROCEDURE
Query returned successfully in 322 msec.
1条答案
按热度按时间sy5wg1nm1#
复制命令在创建或替换中不起作用,请使用执行命令