Here I need to call a function with some parameters.
Example:
Function:
create or replace function testfunction(ids int,pcname varchar)
returns void as
$$
declare
sql varchar;
qu varchar := 'tabletemp_';
begin
qu := qu ||ids ||'_'|| pcname;
sql := 'Drop view if exists '||qu;
raise info '%',sql;
execute sql;
end;
$$
language plpgsql;
Calling Function:
select testfunction(1,'abc-pc');
Error:
ERROR: syntax error at or near "-"
Drop view if exists tabletemp_1_abc-pc
^
Question: How can I pass such parameter while calling function?
select from testfunction(1,'abc-pc');is correct? correct it