Sarfaraz Makandar
Sarfaraz Makandar

Reputation: 6733

Error: operator does not exist: bit = integer

I need to assign value 1 to variable which is of type bit.

Example:

create or replace function test()
returns void as
$Body$
Declare
       var1 bit :=0;
Begin
       ....
       ....
       var1 := 1;
       ....
       ....
end;
$Body$
language plpgsql;

Error:

ERROR:  operator does not exist: bit = integer

Upvotes: 5

Views: 4604

Answers (1)

Konstantin V. Salikhov
Konstantin V. Salikhov

Reputation: 4653

You need to use bit string literal like this: var1 := B'1'. Here some more examples on bit type.

Upvotes: 6

Related Questions