@@ -65,8 +65,18 @@ public String[] getSqlCreateStrings(
6565 dialect
6666 );
6767 final String valueExpression = determineValueExpression ( "t.value" , elementSqlTypeCode , elementType );
68+ final boolean isBooleanType = elementType .equalsIgnoreCase ( "boolean" );
6869 return new String [] {
6970 "create or replace type " + arrayTypeName + " as varying array(" + arrayLength + ") of " + elementType ,
71+ !isBooleanType ? "" :
72+ "create or replace function " + elementType + "_to_char(bool in boolean) return varchar2 is begin " +
73+ "return " +
74+ "case " +
75+ "when bool is null then 'null' " +
76+ "when bool then 'true' " +
77+ "else 'false' " +
78+ "end; " +
79+ "end;" ,
7080 "create or replace function " + arrayTypeName + "_cmp(a in " + arrayTypeName +
7181 ", b in " + arrayTypeName + ") return number deterministic is begin " +
7282 "if a is null or b is null then return null; end if; " +
@@ -252,7 +262,7 @@ public String[] getSqlCreateStrings(
252262 "for i in 1 .. arr.count loop " +
253263 "if arr(i) is not null then " +
254264 "if length(res)<>0 then res:=res||sep; end if; " +
255- "res:=res||arr(i); " +
265+ (! isBooleanType ? "res:=res||arr(i); " : "res:=res||boolean_to_char(arr(i)); " ) +
256266 "elsif nullVal is not null then " +
257267 "if length(res)<>0 then res:=res||sep; end if; " +
258268 "res:=res||nullVal; " +
@@ -286,8 +296,10 @@ public String[] getSqlDropStrings(UserDefinedArrayType userDefinedType, Metadata
286296 buildDropTypeSqlString (arrayTypeName )
287297 };
288298 }
299+ final boolean isBooleanType = userDefinedType .getElementTypeName ().equalsIgnoreCase ( "boolean" );
289300 return new String [] {
290301 buildDropTypeSqlString (arrayTypeName ),
302+ isBooleanType ? buildDropFunctionSqlString ( userDefinedType .getElementTypeName () + "_to_char" ) : "" ,
291303 buildDropFunctionSqlString (arrayTypeName + "_cmp" ),
292304 buildDropFunctionSqlString (arrayTypeName + "_distinct" ),
293305 buildDropFunctionSqlString (arrayTypeName + "_position" ),
0 commit comments