Minor systax error but not able to resolve it... - Mailing list pgsql-general

From dipti shah
Subject Minor systax error but not able to resolve it...
Date
Msg-id d5b05a951002230325u73a483c9j677d6d0a701ffae2@mail.gmail.com
Whole thread Raw
Responses Re: Minor systax error but not able to resolve it...  (Richard Huxton <dev@archonet.com>)
List pgsql-general
Hi, could anyone please help me to sort out below error. I have spent lot of time but couldn't resolved it.
 
mydb=> CREATE OR REPLACE FUNCTION test_create()
  RETURNS void AS
$BODY$
$cmd = "CREATE TABLE test-table(col varchar not null);";
spi_exec_query("CREATE OR REPLACE FUNCTION my_tmp_func() RETURNS void AS $cmd LANGUAGE sql;");
$BODY$
  LANGUAGE 'plperl';
CREATE FUNCTION
mydb=> SELECT test_create();
ERROR:  error from Perl function "test_create": syntax error at or near "CREATE" at line 3.
mydb=>
 
I want to create function from my stored procedure in any language.
 
Thanks,
Dipti

pgsql-general by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: pg_dump: aborting because of version mismatch
Next
From: Stefan Schwarzer
Date:
Subject: Subqueries or Joins? Problems with multiple table query