One example how you can do it (tested with Rev92)
drop schema TST cascade; create schema TST; create column table TST.SHAPES ( id integer, shape ST_Geometry ); INSERT INTO TST.SHAPES VALUES (1, new ST_Point(0.5, 0.5)); INSERT INTO TST.SHAPES VALUES (2, new ST_Point(0, 0)); INSERT INTO TST.SHAPES VALUES (3, new ST_Point(1, 1)); create procedure TST.WithinShape(in myShape String) as begin SELECT * from TST.SHAPES where shape.ST_Within( ST_GeomFromText(:myShape) ) = 1; end; CALL TST.WithinShape( 'Polygon((0 0, 0 1, 1 1, 1 0, 0 0))' );