Re: [GENERAL] 88, CREATE FUNCTION ON TABLE
От | Clark Evans |
---|---|
Тема | Re: [GENERAL] 88, CREATE FUNCTION ON TABLE |
Дата | |
Msg-id | 369161B4.3FE8DB5A@manhattanproject.com обсуждение исходный текст |
Ответ на | 88, CREATE FUNCTION ON TABLE (Clark Evans <clark.evans@manhattanproject.com>) |
Список | pgsql-general |
Jose', Thank you for your response. > --COBOL level 88 using functions----------------------------------------------- > > drop function current_client(text); > create function current_client(text) returns bool as ' > DECLARE > status ALIAS for $1; > BEGIN > RETURN status IN (''A'',''a'',''P'',''p''); > END; > ' language 'plpgsql'; > > drop function active_client(text); > create function active_client(text) returns bool as ' > DECLARE > status ALIAS for $1; > BEGIN > RETURN status IN (''A'',''a''); > END; > ' language 'plpgsql'; > > select * from customer > where active_client(customer_status); > > select * from customer > where not active_client(customer_status); I guess what I was wondering... perhaps plpgsql could have an "automatic" local variable, say "current_row" so that the "text" would not have to be passed in... Thus create function current_client returns bool as ' BEGIN RETURN current_row.status IN (''A'',''a'',''P'',''p''); END; ' language 'plpgsql'; Then the select could look like this: select * from customer where active_client; Thoughts? :) Clark
В списке pgsql-general по дате отправления: