I'm looking for a way to have a function or procedure in Postgresql 12, which can be called with a single line for usage in commandline.
1) Perform a query that takes a parameter as input
For example:
select id from table1 where name = $PARAMETER
2) Based on the ids returned, execute multiple deletes
For example:
delete from table2 where id = $id
delete from table3 where id = $id
In SQL Server I would use a stored procedure for this, but I'm lost on how how to do this in PostgreSQL.