I am creating a procedure that receives as a parameter the license plate of a vehicle, inserts it in a temporary variable and returns this variable.
`CREATE OR REPLACE PROCEDURE public.”GuardarPorPlca”(IN “Placa” character varying)
LANGUAGE ‘plpgsql’
AS $BODY$
BEGIN
CREATE TYPE tempInforme AS (
radicado nchar(10),
fecha date,
codMarca nchar(20),
codLinea int,
numMotor varchar(20),
numChasis varchar(20),
codVehi nchar(20),
codColor int
);
INSERT INTO tempInforme SELECT radicado, fecha,
codMarca, codLinea, numMotor, numChasis, codVehi,
codColor from Informe where placa LIKE $1;
RETURN;
END;
$BODY$;`
But when I go to test the procedure.
CALL public."GuardarPorPlca"( 'XYZ-23A' )
I get the following error:
`ERROR: cannot open relation “tempinforme”.
SQL state: 42809
Detail: This operation is not supported on compound types.
Context: PL/pgSQL function “SaveByPlca”(character varying) on line 12 in SQL statement.
`
I apologize if some variables do not correspond, it’s just that I speak Spanish. Thank you.
I also attach an image of the report table in case it is needed:
Juan Pablo Montoya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.