2022-07-28 16:55:21 +02:00
|
|
|
--liquibase formatted sql
|
|
|
|
|
2022-07-29 11:38:51 +02:00
|
|
|
-- ============================================================================
|
|
|
|
-- LAST-ROW-COUNT
|
2022-07-28 16:55:21 +02:00
|
|
|
--changeset last-row-count:1 endDelimiter:--//
|
2022-07-29 11:38:51 +02:00
|
|
|
-- ----------------------------------------------------------------------------
|
2022-07-28 16:55:21 +02:00
|
|
|
/*
|
|
|
|
Returns the row count from the result of the previous query.
|
|
|
|
Other than the native statement it's usable in an expression.
|
|
|
|
*/
|
|
|
|
create or replace function lastRowCount()
|
|
|
|
returns bigint
|
|
|
|
language plpgsql as $$
|
|
|
|
declare
|
|
|
|
lastRowCount bigint;
|
|
|
|
begin
|
|
|
|
get diagnostics lastrowCount = row_count;
|
|
|
|
return lastRowCount;
|
|
|
|
end; $$;
|
|
|
|
--//
|