aboutsummaryrefslogtreecommitdiff
path: root/challenge-140/luca-ferrari/postgresql/ch-1.sql
blob: 05b9953179dd58a74fc55a7f3338218473d65bbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
* Example
testdb=> select f_sum_bits( 10::bit( 10 ), 20::bit( 10 ) );
f_sum_bits
------------
0000011110
(1 row)

*/
CREATE OR REPLACE FUNCTION f_sum_bits( a bit(10), b bit(10) )
RETURNS text
AS $CODE$
   SELECT   ( a::int
            + b::int )::bit( 10 );

$CODE$
LANGUAGE sql;