Search Postgresql Archives

Re: passing schema name and table name as parameter functions in postgresql 9.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux