Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Informix - Insert a boolean attribute

I have this table definition :

CREATE TABLE Usuarios
 (
  CI  INT PRIMARY KEY,
  primer_nombre   varchar(25) NOT NULL CHECK (primer_nombre MATCHES '^[a-zA-Z]$' ),
  segundo_nombre   varchar(25),
  primer_apellido   varchar(25) NOT NULL,
  segundo_apellido   varchar(25),
  grado INT CHECK ( grado > 0 AND grado < 8),
  fecha_nacimiento DATE NOT NULL,
  nota INT CHECK ( nota > 0 AND nota < 13),
  email varchar(80),
  hace_proyecto boolean,
  tipo varchar(20) CHECK (tipo IN ('Admin', 'Docente', 'Alumno')),
  encriptacion_hash varchar(250),
  encriptacion_sal varchar(250),
  baja boolean 
 );

And this insert statement :

INSERT INTO Usuarios (CI, primer_nombre,segundo_nombre,primer_apellido,segundo_apellido,grado,fecha_nacimiento,nota,email,hace_proyecto,tipo,encriptacion_hash,encriptacion_sal,baja)
VALUES (
        999999,
        "Gabriel"
        "Matias",
        "Barrios",
        "Cabrera",
        NULL,
        "10/28/1986",
        1,
        "[email protected]"
        true,
        "Alumno",
        NULL,
        NULL,
        false
        );

No matter what I do, I always get :

Connected.


  201: A syntax error has occurred.
Error in line 17
Near character position 8

Disconnected.

I think it is related to my boolean fields. Is this true? How can I insert a boolean into my table ?

like image 378
Matias Barrios Avatar asked Sep 20 '25 03:09

Matias Barrios


1 Answers

You are missing a ',' after "Gabriel" and then again after "[email protected]", and lastly the booleans are inserted as 't' or 'f' I believe.

Once I made those changes I just get an error about one of the check constraint's failing.

like image 142
jrenaut Avatar answered Sep 23 '25 12:09

jrenaut