SELECCIONE o REALICE en una función PL / pgSQL
Tengo esta función en mi base de datos:
<code>CREATE OR REPLACE FUNCTION "insertarNuevoArticulo"(nombrearticulo character varying, descripcion text, idtipo integer, idfamilia bigint, artstock integer, minstock integer, maxstock integer, idmarca bigint, precio real, marcastock integer) RETURNS boolean AS $BODY$ DECLARE articulo "Articulo"%ROWTYPE; BEGIN SELECT * INTO articulo FROM "Articulo" WHERE "Nombre" = $1 AND "idTipo"=$3 AND "idFamilia"=$4; IF NOT FOUND THEN INSERT INTO "Articulo" ("Nombre", "Descripcion", "idTipo", "idFamilia", "Stock", "MinStock", "MaxStock") Values ($1, $2, $3, $4, $5, $6, $7); SELECT last_value INTO articulo."idArticulo" FROM "public"."Articulo_idArticulo_seq"; END IF; SELECT * FROM "ArticuloMarca" AS am WHERE am."idArticulo" = articulo."idArticulo" and am."idMarca" = $8; IF NOT FOUND THEN Insert into "ArticuloMarca"("idArticulo", "idMarca", "PrecioReferencial", "Stock") Values (articulo."idArticulo", $8, $9, $10); RETURN TRUE; END IF; RETURN FALSE; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; ALTER FUNCTION "insertarNuevoArticulo"(character varying, text, integer, bigint, integer, integer, integer, bigint, real, integer) OWNER TO postgres; </code>
Pero tan pronto como trato de usarlo, dice que necesito usarPERFORM
Si quiero descartar los resultados! El problema aquí es que no quiero! Los quiero en elarticulo
¡Fila que declaré!
Estoy usando esta declaración:
<code>SELECT "insertarNuevoArticulo"('Acetaminofen', 'caro', '1' , '1', '8', '1', '10', '1', '150.7', '10'); </code>
Y el error que recibo es 42601, un error de sintaxis! ¿Cómo podría ser si estoy usando el IDE para crearlo? ¿Alguna idea sobre el problema?