SQLize
Online
/
PHPize Online
/
SQLtest Online
A
A
A
Share
Donate
Blog
Popular
Donate
A
A
A
Share
Blog
Popular
SQLize.online is a free online SQL environment for quickly running, experimenting with and sharing code.
You can run your SQL code on top of the most popular RDBMS including MySQL, MariaDB, SQLite, PostgreSQL, Oracle and Microsoft SQL Server.
SQL code:
Upload
Copy
Format
Clear
do $$ begin if not exists (select * from pg_type where typname = 'duplicate_strategy') THEN create type duplicate_strategy as enum ('UPDATE', 'SKIP', 'ROLLBACK'); end if; if not exists (select * from pg_type where typname = 'operation_type') THEN create type operation_type as enum ('INSERT', 'UPDATE', 'UPSERT', 'DELETE'); end if; if not exists (select * from pg_type where typname = 'processed_state') THEN create type processed_state as enum ('SUCCESS', 'ERROR'); end if; end $$; create table if not exists trans_entity_request ( id uuid primary key not null default uuid_generate_v4(), trans_id uuid not null, oper_type_code operation_type not null, duplicate_strategy_code duplicate_strategy, request_body jsonb not null, processed_entity_cnt integer not null default 0, insert_entity_cnt integer not null default 0, update_entity_cnt integer not null default 0, delete_entity_cnt integer not null default 0, error_entity_cnt integer not null default 0, processed_state_code processed_state ); create or replace function trans_entity_request_ins( p_trans_id uuid, p_oper_type_code varchar, p_duplicate_strategy_code varchar, p_request_body jsonb) returns uuid language sql volatile security definer parallel unsafe as $body$ insert into trans_entity_request ( id, trans_id, oper_type_code, duplicate_strategy_code, request_body ) values ( uuid_generate_v4(), $1, --p_trans_id cast ($2 as operation_type), --p_oper_type_code cast ($3 as duplicate_strategy), --p_duplicate_strategy_code $4 --p_request_body ) returning id; $body$; select * from trans_entity_request_ins( p_trans_id => '4f025e68-39fb-4414-81e6-bfaeb5566c1e', p_oper_type_code => 'INSERT', p_duplicate_strategy_code => null, p_request_body => '[]'::jsonb)
SQL
Server:
MariaDB 11.4
MariaDB 11.5
MariaDB 10
MariaDB 10 Sakila (ReadOnly)
MySQL 5.7
MySQL 5.7 Sakila (ReadOnly)
MySQL 8.0
MySQL 8.0 Sakila (ReadOnly)
SQLite 3
SQLite 3 Preloaded
PostgreSQL 10 Bookings (ReadOnly)
PostgreSQL 11
PostgreSQL 12
PostgreSQL 13
PostgreSQL 14
PostgreSQL 15
MS SQL Server 2017
MS SQL Server 2019
MS SQL Server 2022
MS SQL Server 2022 AdventureWorks (ReadOnly)
Firebird 4.0
Firebird 4.0 (Employee)
Oracle Database 19c (HR)
Oracle Database 21c
Oracle Database 23c Free
SOQOL
Version
ER Diagram
Preserve result
Stuck with a problem?
Got Error?
Ask ChatGPT!
Result:
Copy
Clear