SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE test ( id serial, name varchar ); INSERT INTO test (name) values ('one'),('two'),('three'),('four'),('five'); CREATE FUNCTION welcome() RETURNS TEXT AS $$ DECLARE str TEXT := 'Hello, world!'; BEGIN RETURN str; END; $$ LANGUAGE plpgsql; SELECT welcome(); CREATE FUNCTION fact(n int) RETURNS int AS $$ DECLARE res int = 1; i int; BEGIN FOR i in 1..n LOOP res = res * i; END LOOP; RETURN res; END; $$ LANGUAGE plpgsql; SELECT fact(5);

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear