How To Define a selectBooleanCheckbox for VARCHAR2(1) or NUMBER(1) Database Colu (Doc ID 402542.1)

Last updated on AUGUST 04, 2016

Applies to:

Oracle JDeveloper - Version: 10.1.3.0.4 and later   [Release: and later ]
Information in this document applies to any platform.

Goal

The Oracle Database doesn't have the type "Boolean".
Representing the boolean values is often done through a VARCHAR2(1) (Y/N, T/F, ...) or NUMBER(1) (0/1) column.

See the following example, with columns IS_STARTED (with allowed values "Y" and "N") and IS_COMPLETED (with allowed value 1 representing TRUE, and NULL representing FALSE):

CREATE TABLE "JOBS"
( "ID" NUMBER NOT NULL ENABLE,
"DESCRIPTION" VARCHAR2(20 BYTE) NOT NULL ENABLE,
"IS_STARTED" VARCHAR2(1 BYTE) NOT NULL ENABLE,
"IS_COMPLETED" NUMBER,
CONSTRAINT "JOBS_PK" PRIMARY KEY ("ID") ENABLE,
CONSTRAINT "JOBS_CHK_IS_STARTED" CHECK (IS_STARTED IN ('Y','N')) ENABLE,
CONSTRAINT "JOBS_CHK_IS_COMPLETED" CHECK ( IS_COMPLETED IS NULL OR IS_COMPLETED = 1 ) ENABLE
/

How can you associate these columns to boolean elements in ADF, f.ex. a selectBooleanCheckbox ?

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms