Search
Write a publication
Pull to refresh
0
0

junior java developer

Send message
Последнее время часто использую composite types

create type my_type as (
id integer,
can_be_updated boolean
);

использовать можно, например, в функциях:
CREATE OR REPLACE FUNCTION find_pattern(… )
RETURNS my_type AS
$body$
declare
my_record my_type;
begin

SELECT id, case when state = 0 then 'Y' else 'N' end
INTO my_record
FROM my_table
WHERE type = 'my_type'

if not found then
my_record.id = null;
end if;

return my_record;

end;

Еще недавно оказалась полезна функция split_part(string text, delimiter text, field int) — делает сплит строки по разделителю и возвращает указанный элемент массива(индекс от 1).

Information

Rating
Does not participate
Registered
Activity