0

psql代码:

CREATE TABLE ref_lab_cohort_level
    AS
SELECT cohort,initcap (TRIM (result_flag)) AS result_flag,
       TRIM (cohort_level) AS cohort_level
FROM temp_labs_levels;

在上面的代码中,trim 是 PostgreSQL 的修剪功能,但它给出了如下错误:

 function pg_catalog.btrim(numeric, unknown) does not exist
4

1 回答 1

0

这是您的问题的解决方法,查看可能对您有用:

create table temp_labs_levels(c varchar(200));
insert into temp_labs_levels values ('   ABC    ');
insert into temp_labs_levels values ('IJK    ');
insert into temp_labs_levels values ('    XYZ');
insert into temp_labs_levels values ('Normal TEXT');

create table ref_lab_cohort_level
as
select c,
       trim(c) c_trimmed,
       initcap(trim(c)) c_trim_initcap 
from temp_labs_levels;

输出:

select * from ref_lab_cohort_level;

演示

于 2018-05-25T10:39:03.040 回答