How to pass multiple arguments in spi_prepare? - Mailing list pgsql-novice

From paresh masani
Subject How to pass multiple arguments in spi_prepare?
Date
Msg-id a9d94e070910050617p40e93c06o95dacb0b2dc7077b@mail.gmail.com
Whole thread Raw
List pgsql-novice
Hi,

Could anyone please help with my simple question? I understood below
spi_prepare and spi_exec_prepared example given in PostgreSQL
documentation.

CREATE OR REPLACE FUNCTION init() RETURNS INTEGER AS $$
    $_SHARED{my_plan} = spi_prepare( ’SELECT (now() + $1)::date AS now’,
’INTERVAL’);
$$ LANGUAGE plperl;

CREATE OR REPLACE FUNCTION add_time( INTERVAL ) RETURNS TEXT AS $$
    return spi_exec_prepared(
        $_SHARED{my_plan},
        $_[0],
    )->{rows}->[0]->{now};
$$ LANGUAGE plperl;

CREATE OR REPLACE FUNCTION done() RETURNS INTEGER AS $$
    spi_freeplan( $_SHARED{my_plan});
    undef $_SHARED{my_plan};
$$ LANGUAGE plperl;

Could you tell me what could what could be the spi_prepare command and
argument for below query?

INSERT INTO myschema.mytable ("col1", "col2") VALUES (100,200);

Thanks,
Paresh

pgsql-novice by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Installation on Windows 2003 fails
Next
From: Tom Holderness
Date:
Subject: psql in bash - how to clear screen?