From: | anushasrivastava03 <anushasrivastava03(at)yahoo(dot)co(dot)in> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: passing schema name and table name as parameter functions in postgresql 9.2 |
Date: | 2013-06-07 06:58:35 |
Message-ID: | 1370588315101-5758259.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
hi my requirement is to create a table as a result of sub-query and the table
and schema name should be passed as parameters of a function
i also tried like this;
CREATE OR REPLACE FUNCTION secc_master.chkschema(schemaname text, tableis
text)
RETURNS void AS
$BODY$
DECLARE
ione boolean;
BEGIN
EXECUTE 'create table '||quote_literal($1)||'.'||quote_literal($2)||' as
select * from master.master_state where state_code not in ( select
distinct(statecode)from master.population_2 )';
end;
$BODY$
LANGUAGE plpgsql
select * from secc_master.chkschema('secc_master', 'chktbl')
ERROR: syntax error at or near "'secc_master'"
LINE 1: create table 'secc_master'.'chktbl' as select * from master...
--
View this message in context: http://postgresql.1045698.n5.nabble.com/passing-schema-name-and-table-name-as-parameter-functions-in-postgresql-9-2-tp5758130p5758259.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | anushasrivastava03 | 2013-06-07 07:03:49 | Re: passing schema name and table name as parameter functions in postgresql 9.2 |
Previous Message | c k | 2013-06-07 06:05:47 | compiling postgresql 9.2.4 on fedora 17 64 bit takes very long time |