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=>
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