I have the next procedure in postgresql
CREATE OR REPLACE FUNCTION suma (INTEGER,INTEGER) RETURNS INTEGER AS $$
DECLARE
RES INTEGER;
BEGIN
RES := $1 + $2;
RETURN RES;
END;
$$ LANGUAGE PLPGSQL;
I want to call in php and show value of the procedure in this case RES, i have this in php but i dont know hot to get that value
$db = new PDO("pgsql:dbname=test003;host=localhost", "postgres", "root" );
$sql = 'CALL suma(?, ?)';
$stmt = $db->prepare($sql);
$x = 1;
$y = 2;
$stmt->bindValue(1, $x, PDO::PARAM_INT);
$stmt->bindValue(2, $y, PDO::PARAM_INT);
$stmt->execute();
echo "PDO connection object created ". $x . " " . $y;
use "select" instead of "call" command