M
M
Melnik2282021-03-31 11:31:41
PostgreSQL
Melnik228, 2021-03-31 11:31:41

How to return rows received from SELECT in a procedure?

CREATE PROCEDURE author_and_title (book_code integer)
LANGUAGE SQL
AS $$
SELECT author, title FROM books WHERE code = book_code;
$$;

I call as and it is returned simply "CALL" In MS SQL at a call of such procedure selection from procedure returned here it is necessary to use return? or more precisely INOUT parameter? but how to transfer the table to it then?
CALL author_and_title(1);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2021-03-31
@melkij

Maybe you will still read the documentation for postgresql, and not for mssql? Or then stay with mssql.
https://www.postgresql.org/docs/current/xproc.html

A procedure is a database object similar to a function. The difference is that a procedure does not return a value, so there is no return type declaration.

If you do not need transaction control from within a procedure, then you do not need procedures at all, but ordinary functions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question