简体   繁体   中英

Converting sql to sql of h2 database

How to convert sql to accepter by h2 database?

alter table examination_order_details
    add column is_duplicated boolean default false;

alter table medical_certificate
    add column is_reissued boolean default false;

alter table medical_certificate
    add column correction boolean default false;


alter table medical_certificate
    add column harmful_factors character varying[];

alter table examination_order_details
    add column sd_position_id integer;

alter table examination_order_details_history
    add column sd_position_id integer;

alter table examination_order_details
    add constraint examination_order_details_sd_position_id_fkey
        foreign key (sd_position_id) references positions (id);

UPDATE public.examinations
    SET is_valid = false
    WHERE name_examination LIKE '%-23%'

create table dictionary_harmful_factors
(
    id                       integer primary key generated always as identity,
    name                     varchar not null,
    printable_on_certificate boolean default false
);


insert into dictionary_harmful_factors (name, printable_on_certificate)
VALUES ('praca na wysokości', true),
       ('praca w torach czynnych', true),
       ('praca przy monitorze ekranowym powyżej 4h', false),
       ('kierowanie sam. osobowym do 3,5 t', true),
       ('kierowanie sam. osobowym do 3,5 t z przewozem osób', true),
       ('akcja zima', false);
  1. character varying[] needs to be replaced with more compliant with the SQL Standard character varying array (it isn't fully compliant, but H2 also doesn't require length for varchar data type).
  2. integer primary key generated always as identity needs to be replaced with standard-compliant integer generated always as identity primary key .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM