Home > database >  How to select out the result of the function of the input parameters
How to select out the result of the function of the input parameters

Time:10-12


For example

 
The select table_name from information_schema. Columns


The results as a function of an array parameter

 
The CREATE OR REPLACE FUNCTION FFF (count integer, table_name_ary text [])
RETURNS void
AS $$
Declare
D_table_name text=null;

The begin
For I in 1.. The count loop
D_table_name=table_name_ary [I];

The ALTER TABLE d_table_name
The ADD test_column text not null default ';
end loop;
End
$$language PLPGSQL;


CodePudding user response:

 select the ARRAY_AGG (distinct table_name) from (select distinct table_name from information_schema. Columns) T; 
  • Related