File: LOB.out

package info (click to toggle)
derby 10.14.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 79,056 kB
  • sloc: java: 691,961; sql: 42,686; xml: 20,512; sh: 3,373; sed: 96; makefile: 60
file content (840 lines) | stat: -rw-r--r-- 63,616 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
ij> --
--   Licensed to the Apache Software Foundation (ASF) under one or more
--   contributor license agreements.  See the NOTICE file distributed with
--   this work for additional information regarding copyright ownership.
--   The ASF licenses this file to You under the Apache License, Version 2.0
--   (the "License"); you may not use this file except in compliance with
--   the License.  You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
--   Unless required by applicable law or agreed to in writing, software
--   distributed under the License is distributed on an "AS IS" BASIS,
--   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--   See the License for the specific language governing permissions and
--   limitations under the License.
--
-- This test lang/LOB.sql still includes tests for 
-- DB2 UDB incompatible datatype NCLOB.
-- Still waiting for DB2 UDB compatible functionality for NCLOB to be implemented
-- Also note that in DB2 UDB, to create BLOB and CLOB strings greater than 1 gigabyte,
-- the NOT LOGGED option must be specified (SQLSTATE 42993).
-- test that BLOB/CLOB are not reserved words
create table blob(a int);
0 rows inserted/updated/deleted
ij> insert into blob values(3);
1 row inserted/updated/deleted
ij> select blob.a from blob;
A          
-----------
3          
ij> create table clob(a int);
0 rows inserted/updated/deleted
ij> insert into clob values(3);
1 row inserted/updated/deleted
ij> select clob.a from clob;
A          
-----------
3          
ij> create table nclob(a int);
0 rows inserted/updated/deleted
ij> insert into nclob values(3);
1 row inserted/updated/deleted
ij> select nclob.a from nclob;
A          
-----------
3          
ij> create table a(blob int, clob int, nclob int);
0 rows inserted/updated/deleted
ij> insert into a values(1,2,3);
1 row inserted/updated/deleted
ij> insert into a(blob, clob, nclob) values(1,2,3);
1 row inserted/updated/deleted
ij> select a.blob, a.clob, a.nclob from a;
BLOB       |CLOB       |NCLOB      
-----------------------------------
1          |2          |3          
1          |2          |3          
ij> select a.blob, a.clob, a.nclob from a where a.blob = 1;
BLOB       |CLOB       |NCLOB      
-----------------------------------
1          |2          |3          
1          |2          |3          
ij> select a.blob, a.clob, a.nclob from a where a.clob = 2;
BLOB       |CLOB       |NCLOB      
-----------------------------------
1          |2          |3          
1          |2          |3          
ij> select a.blob, a.clob, a.nclob from a where a.nclob = 3;
BLOB       |CLOB       |NCLOB      
-----------------------------------
1          |2          |3          
1          |2          |3          
ij> select a.blob, a.clob, a.nclob from a where a.blob = 1 and a.clob = 2 and a.nclob = 3;
BLOB       |CLOB       |NCLOB      
-----------------------------------
1          |2          |3          
1          |2          |3          
ij> create table b(blob blob(3K), clob clob(2M));
0 rows inserted/updated/deleted
ij> insert into b values(cast(X'0031' as blob(3K)),cast('2' as clob(2M)));
1 row inserted/updated/deleted
ij> insert into b(blob, clob, nclob) values(cast(X'0031' as blob(3K)),cast('2' as clob(2M)));
ERROR 42X14: 'NCLOB' is not a column in table or VTI 'APP.B'.
ij> select b.blob, b.clob, b.nclob from b;
ERROR 42X04: Column 'B.NCLOB' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then 'B.NCLOB' is not a column in the target table.
ij> -- equal tests are not allowed
select 1 from b where cast(X'e0' as blob(5))=cast(X'e0' as blob(5));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'e0' as blob(5))=cast(X'e0' as blob(7));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'e0' as blob(5))=cast(X'e0' as blob(7));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'e0' as blob(5))=cast(X'e0' as blob(7));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'e0' as blob(5))=cast(X'e000' as blob(7));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where X'80' = cast(X'80' as blob(1));
ERROR 42818: Comparisons between 'CHAR () FOR BIT DATA' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'80' as blob(1)) = X'80';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR () FOR BIT DATA' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'80' as blob(1)) = cast(X'80' as blob(1));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where '1' = cast('1' as clob(1));
ERROR 42818: Comparisons between 'CHAR (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('1' as clob(1)) = '1';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('1' as clob(1)) = cast('1' as clob(1));
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where '1' = cast('1' as nclob(1));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('1' as nclob(1)) = '1';
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('1' as nclob(1)) = cast('1' as nclob(1));
ERROR 0A000: Feature not implemented: NCLOB.
ij> -- NCLOB is comparable with CLOB

select 1 from b where cast('1' as nclob(10)) = cast('1' as clob(10));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('1' as clob(10)) = cast('1' as nclob(10));
ERROR 0A000: Feature not implemented: NCLOB.
ij> -- comparsion using tables
select * from b as b1, b as b2 where b1.blob=b2.blob;
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from b as b1, b as b2 where b1.blob!=b2.blob;
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from b as b1, b as b2 where b1.blob=X'20';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR () FOR BIT DATA' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from b as b1, b as b2 where X'20'=b1.blob;
ERROR 42818: Comparisons between 'CHAR () FOR BIT DATA' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from b as b1, b as b2 where X'20'!=b1.blob;
ERROR 42818: Comparisons between 'CHAR () FOR BIT DATA' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from b as b1, b as b2 where b1.blob=X'7575';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR () FOR BIT DATA' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from b as b1, b as b2 where X'7575'=b1.blob;
ERROR 42818: Comparisons between 'CHAR () FOR BIT DATA' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select b.blob, b.clob, b.nclob from b where b.blob = '1' and b.clob = '2' and b.nclob = '3';
ERROR 42X04: Column 'B.NCLOB' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then 'B.NCLOB' is not a column in the target table.
ij> select b.blob from b where b.blob = '1';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> -- however it works for types which cloudscape autocasts to char
select b.clob from b where b.clob = '2';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select b.nclob from b where b.nclob = '3';
ERROR 42X04: Column 'B.NCLOB' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then 'B.NCLOB' is not a column in the target table.
ij> -- test insert of NULL
insert into b values(null, null, null);
ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.
ij> select * from b;
BLOB                                                                                                                            |CLOB                                                                                                                            
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0031                                                                                                                            |2                                                                                                                               
ij> -- cleanup
drop table blob;
0 rows inserted/updated/deleted
ij> drop table clob;
0 rows inserted/updated/deleted
ij> drop table nclob;
0 rows inserted/updated/deleted
ij> drop table a;
0 rows inserted/updated/deleted
ij> drop table b;
0 rows inserted/updated/deleted
ij> -- test insert limitations
create table b(b blob(5));
0 rows inserted/updated/deleted
ij> create table c(c clob(5));
0 rows inserted/updated/deleted
ij> create table n(n nclob(5));
ERROR 0A000: Feature not implemented: NCLOB.
ij> insert into b values(cast(X'01020304' as blob(10)));
1 row inserted/updated/deleted
ij> insert into b values(cast(X'0102030405' as blob(10)));
1 row inserted/updated/deleted
ij> insert into b values(cast(X'010203040506' as blob(10)));
ERROR 22001: A truncation error was encountered trying to shrink BLOB 'XXXX' to length 5.
ij> -- truncate before insert, no errors
insert into b values(cast(X'01020304' as blob(5)));
1 row inserted/updated/deleted
ij> insert into b values(cast(X'0102030405' as blob(5)));
1 row inserted/updated/deleted
ij> insert into b values(cast(X'010203040506' as blob(5)));
1 row inserted/updated/deleted
WARNING 01004: Data truncation
ij> -- clob/nclob
--   ok in spite of not being cast
insert into c values('1234');
1 row inserted/updated/deleted
ij> insert into c values('12345');
1 row inserted/updated/deleted
ij> insert into c values('123456');
ERROR 22001: A truncation error was encountered trying to shrink CLOB '123456' to length 5.
ij> insert into n values('1234');
ERROR 42X05: Table/View 'N' does not exist.
ij> insert into n values('12345');
ERROR 42X05: Table/View 'N' does not exist.
ij> insert into n values('123456');
ERROR 42X05: Table/View 'N' does not exist.
ij> --   ok
insert into c values(cast('1234' as clob(5)));
1 row inserted/updated/deleted
ij> insert into c values(cast('12345' as clob(5)));
1 row inserted/updated/deleted
ij> insert into c values(cast('123456' as clob(5)));
1 row inserted/updated/deleted
WARNING 01004: Data truncation
ij> insert into n values(cast('1234' as nclob(5)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> insert into n values(cast('12345' as nclob(5)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> insert into n values(cast('123456' as nclob(5)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select * from b;
B         
----------
01020304  
0102030405
01020304  
0102030405
0102030405
ij> select * from c;
C    
-----
1234 
12345
1234 
12345
12345
ij> select * from n;
ERROR 42X05: Table/View 'N' does not exist.
ij> -- concatenate
values cast('12' as clob(2)) || cast('34' as clob(2));
1   
----
1234
ij> values cast('12' as nclob(2)) || cast('34' as nclob(2));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('12' as clob(2)) || cast('34' as clob(2)) = '1234';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('12' as nclob(2)) || cast('34' as nclob(2)) = '1234';
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('12' as clob(2)) || cast('34' as clob(2)) = cast('1234' as clob(4));
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('12' as nclob(2)) || cast('34' as nclob(2)) = cast('1234' as clob(4));
ERROR 0A000: Feature not implemented: NCLOB.
ij> -- like
select * from b where b like '0102%';
ERROR 42884: No authorized routine named 'LIKE' of type 'FUNCTION' having compatible arguments was found.
ij> select * from c where c like '12%';
C    
-----
1234 
12345
1234 
12345
12345
ij> select * from n where n like '12%';
ERROR 42X05: Table/View 'N' does not exist.
ij> select * from b where b like cast('0102%' as blob(10));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> select * from c where c like cast('12%' as clob(10));
C    
-----
1234 
12345
1234 
12345
12345
ij> select * from n where n like cast('12%' as nclob(10));
ERROR 0A000: Feature not implemented: NCLOB.
ij> -- cleanup
drop table b;
0 rows inserted/updated/deleted
ij> drop table c;
0 rows inserted/updated/deleted
ij> drop table n;
ERROR 42Y55: 'DROP TABLE' cannot be performed on 'N' because it does not exist.
ij> -- test syntax of using long type names
create table a(a binary large object(3K));
0 rows inserted/updated/deleted
ij> create table b(a character large object(3K));
0 rows inserted/updated/deleted
ij> create table c(a national character large object(3K));
ERROR 0A000: Feature not implemented: NCLOB.
ij> create table d(a char large object(204K));
0 rows inserted/updated/deleted
ij> -- create index (not allowed)
create index ia on a(a);
ERROR X0X67: Columns of type 'BLOB' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
ij> create index ib on b(a);
ERROR X0X67: Columns of type 'CLOB' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
ij> create index ic on c(a);
ERROR 42Y55: 'CREATE INDEX' cannot be performed on 'C' because it does not exist.
ij> create index id on d(a);
ERROR X0X67: Columns of type 'CLOB' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
ij> -- cleanup
drop table a;
0 rows inserted/updated/deleted
ij> drop table c;
ERROR 42Y55: 'DROP TABLE' cannot be performed on 'C' because it does not exist.
ij> drop table d;
0 rows inserted/updated/deleted
ij> -- ORDER tests on LOB types (not allowed)
select 1 from b where cast(X'e0' as blob(5))=cast(X'e0' as blob(5));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'e0' as blob(5))!=cast(X'e0' as blob(5));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'e0' as blob(5))<cast(X'e0' as blob(5));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'e0' as blob(5))>cast(X'e0' as blob(7));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'e0' as blob(5))<=cast(X'e0' as blob(7));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast(X'e0' as blob(5))>=cast(X'e0' as blob(7));
ERROR 42818: Comparisons between 'BLOB' and 'BLOB' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('fish' as clob(5))=cast('fish' as clob(5));
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('fish' as clob(5))!=cast('fish' as clob(5));
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('fish' as clob(5))<cast('fish' as clob(5));
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('fish' as clob(5))>cast('fish' as clob(7));
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('fish' as clob(5))<=cast('fish' as clob(7));
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('fish' as clob(5))>=cast('fish' as clob(7));
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select 1 from b where cast('fish' as nclob(5))=cast('fish' as nclob(5));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('fish' as nclob(5))!=cast('fish' as nclob(5));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('fish' as nclob(5))<cast('fish' as nclob(5));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('fish' as nclob(5))>cast('fish' as nclob(7));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('fish' as nclob(5))<=cast('fish' as nclob(7));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select 1 from b where cast('fish' as nclob(5))>=cast('fish' as nclob(7));
ERROR 0A000: Feature not implemented: NCLOB.
ij> -- test operands on autocast
-- beetle 5282
-- <,> <=, >= operands are not supported in db2 but supported in cloudscape
-- compare w. integer/char types are also not ok

-- CLOB testing
CREATE TABLE testoperatorclob (colone clob(1K));
0 rows inserted/updated/deleted
ij> INSERT INTO testoperatorclob VALUES (CAST('50' AS CLOB(1K)));
1 row inserted/updated/deleted
ij> INSERT INTO testoperatorclob VALUES (CAST(cast('50' as varchar(80)) AS CLOB(1K)));
1 row inserted/updated/deleted
ij> select * from testoperatorclob;
COLONE                                                                                                                          
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
50                                                                                                                              
ij> -- these select statements should raise an error but are successful in cloudscape
select * from testoperatorclob where colone > 10;
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone > 5;
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone < 70;
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone = 50;
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone != 10;
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone <= 70;
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone >= 10;
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone <> 10;
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone > '10';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone > '5';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone < '70';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone = '50';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone != '10';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone <= '70';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone >= '10';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorclob where colone <> '10';
ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> drop table testoperatorclob;
0 rows inserted/updated/deleted
ij> -- BLOB testing
CREATE TABLE testoperatorblob (colone blob(1K));
0 rows inserted/updated/deleted
ij> INSERT INTO testoperatorblob VALUES (CAST('50' AS BLOB(1K)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> INSERT INTO testoperatorblob VALUES (CAST(cast('50' as varchar(80)) AS BLOB(1K)));
ERROR 42846: Cannot convert types 'VARCHAR' to 'BLOB'.
ij> select * from testoperatorblob;
COLONE                                                                                                                          
--------------------------------------------------------------------------------------------------------------------------------
ij> -- these select statements should raise an error but are successful in cloudscape
select * from testoperatorblob where colone > 10;
ERROR 42818: Comparisons between 'BLOB' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone > 5;
ERROR 42818: Comparisons between 'BLOB' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone < 999999;
ERROR 42818: Comparisons between 'BLOB' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone = 00350030;
ERROR 42818: Comparisons between 'BLOB' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone != 10;
ERROR 42818: Comparisons between 'BLOB' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone <= 999999;
ERROR 42818: Comparisons between 'BLOB' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone >= 10;
ERROR 42818: Comparisons between 'BLOB' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone <> 10;
ERROR 42818: Comparisons between 'BLOB' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone > '10';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone > '5';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone < '70';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone = '50';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone != '10';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone <= '70';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone >= '10';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testoperatorblob where colone <> '10';
ERROR 42818: Comparisons between 'BLOB' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> drop table testoperatorblob;
0 rows inserted/updated/deleted
ij> -- NCLOB testing
CREATE TABLE testoperatornclob (colone nclob(1K));
ERROR 0A000: Feature not implemented: NCLOB.
ij> INSERT INTO testoperatornclob VALUES (CAST('50' AS NCLOB(1K)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> INSERT INTO testoperatornclob VALUES (CAST(cast('50' as varchar(80)) AS NCLOB(1K)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> select * from testoperatornclob;
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> -- these select statements should raise an error but are successful in cloudscape
select * from testoperatornclob where colone > 10;
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone > 5;
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone < 70;
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone = 50;
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone != 10;
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone <= 70;
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone >= 10;
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone <> 10;
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone > '10';
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone > '5';
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone < '70';
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone = '50';
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone != '10';
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone <= '70';
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone >= '10';
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> select * from testoperatornclob where colone <> '10';
ERROR 42X05: Table/View 'TESTOPERATORNCLOB' does not exist.
ij> drop table testoperatornclob;
ERROR 42Y55: 'DROP TABLE' cannot be performed on 'TESTOPERATORNCLOB' because it does not exist.
ij> ----- test method invocations on LOB objects (should disallow)
-- setup
drop table b;
0 rows inserted/updated/deleted
ij> create table b(b blob(77));
0 rows inserted/updated/deleted
ij> insert into b values(cast('33' as blob(77)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> create table c(c clob(77));
0 rows inserted/updated/deleted
ij> insert into c values(cast('33' as clob(77)));
1 row inserted/updated/deleted
ij> -- LOB as main object for method invocation not allowed
values (cast('1' as blob(1M)))->toString();
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> values (cast('1' as clob(1M)))->toString();
ERROR XJ082: BLOB/CLOB values are not allowed as method parameters or receiver.
ij> values (cast('1' as nclob(1M)))->toString();
ERROR 0A000: Feature not implemented: NCLOB.
ij> drop table b;
0 rows inserted/updated/deleted
ij> drop table c;
0 rows inserted/updated/deleted
ij> ------ TEST length functions on LOBs
---- BLOB
values length(cast('foo' as blob(10)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> values {fn length(cast('foo' as blob(10)))};
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> ---- CHAR
values length(cast('foo' as char(10)));
1          
-----------
10         
ij> values {fn length(cast('foo' as char(10)))};
1          
-----------
3          
ij> ---- CLOB
values length(cast('foo' as clob(10)));
1          
-----------
3          
ij> values {fn length(cast('foo' as clob(10)))};
1          
-----------
3          
ij> ---- NCLOB
values length(cast('foo' as nclob(10)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> values {fn length(cast('foo' as nclob(10)))};
ERROR 0A000: Feature not implemented: NCLOB.
ij> -- Longvarchar negative tests

create table testPredicate1 (c1 long varchar);
0 rows inserted/updated/deleted
ij> create table testPredicate2 (c1 long varchar);
0 rows inserted/updated/deleted
ij> insert into testPredicate1 (c1) values 'a';
1 row inserted/updated/deleted
ij> insert into testPredicate2 (c1) values 'a';
1 row inserted/updated/deleted
ij> -- UNION
select * from testPredicate1 union select * from testPredicate2;
ERROR X0X67: Columns of type 'LONG VARCHAR' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
ij> -- IN predicate
select c1 from testPredicate1 where c1 IN (select c1 from testPredicate2);
ERROR 42818: Comparisons between 'LONG VARCHAR (UCS_BASIC)' and 'LONG VARCHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> -- NOT IN predicate
select c1 from testPredicate1 where c1 NOT IN (select c1 from testPredicate2);
ERROR 42818: Comparisons between 'LONG VARCHAR (UCS_BASIC)' and 'LONG VARCHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> -- ORDER BY clause
select * from testPredicate1 order by c1;
ERROR X0X67: Columns of type 'LONG VARCHAR' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
ij> -- GROUP BY clause
select substr(c1,1,2) from testPredicate1 group by c1;
ERROR X0X67: Columns of type 'LONG VARCHAR' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
ij> -- JOIN
select * from testPredicate1 t1, testPredicate2 t2 where t1.c1=t2.c1;
ERROR 42818: Comparisons between 'LONG VARCHAR (UCS_BASIC)' and 'LONG VARCHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> select * from testPredicate1 LEFT OUTER JOIN testPredicate2 on testPredicate1.c1=testPredicate2.c1;
ERROR 42818: Comparisons between 'LONG VARCHAR (UCS_BASIC)' and 'LONG VARCHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
ij> -- PRIMARY KEY
create table testConst1(c1 long varchar not null primary key);
ERROR X0X67: Columns of type 'LONG VARCHAR' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
ij> -- UNIQUE KEY constraints
CREATE TABLE testconst2 (col1 long varchar not null, CONSTRAINT uk UNIQUE (col1));
ERROR X0X67: Columns of type 'LONG VARCHAR' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
ij> -- FOREIGN KEY constraints
create table testConst3 (c1 char(10) not null, primary key (c1));
0 rows inserted/updated/deleted
ij> create table testConst4 (c1 long varchar not null, constraint fk foreign key (c1) references testConst3 (c1));
ERROR X0X67: Columns of type 'LONG VARCHAR' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
ij> drop table testConst3;
0 rows inserted/updated/deleted
ij> -- MAX aggregate function
select max(c1) from testPredicate1;
ERROR 42Y22: Aggregate MAX cannot operate on type LONG VARCHAR.
ij> -- MIN aggregate function
select min(c1) from testPredicate1;
ERROR 42Y22: Aggregate MIN cannot operate on type LONG VARCHAR.
ij> drop table testpredicate1;
0 rows inserted/updated/deleted
ij> drop table testpredicate2;
0 rows inserted/updated/deleted
ij> -- CLOB/BLOB limits and sizes

-- FAIL - bigger than 2G or 2Gb with no modifier
create table DB2LIM.FB1(FB1C BLOB(3G));
ERROR 42X44: Invalid length '3G' in column specification.
ij> create table DB2LIM.FB2(FB2C BLOB(2049M));
ERROR 42X44: Invalid length '2049M' in column specification.
ij> create table DB2LIM.FB3(FB3C BLOB(2097153K));
ERROR 42X44: Invalid length '2097153K' in column specification.
ij> create table DB2LIM.FB4(FB4C BLOB(2147483648));
ERROR 42X44: Invalid length '2147483648' in column specification.
ij> -- OK 2G and end up as 2GB - 1 (with modifier)
create table DB2LIM.GB1(GB1C BLOB(2G));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GB2(GB2C BLOB(2048M));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GB3(GB3C BLOB(2097152K));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GB4(GB4C BLOB(2147483647));
0 rows inserted/updated/deleted
ij> -- next lower value
create table DB2LIM.GB5(GB5C BLOB(1G));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GB6(GB6C BLOB(2047M));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GB7(GB7C BLOB(2097151K));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GB8(GB8C BLOB(2147483646));
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GB5;
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GB6;
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GB7;
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GB8;
0 rows inserted/updated/deleted
ij> -- no length (default to 1Mb)
create table DB2LIM.GB9(GB9C BLOB);
0 rows inserted/updated/deleted
ij> create table DB2LIM.GB10(GB10C BINARY LARGE OBJECT);
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GB9;
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GB10;
0 rows inserted/updated/deleted
ij> -- FAIL - bigger than 2G or 2Gb with no modifier
create table DB2LIM.FC1(FC1C CLOB(3G));
ERROR 42X44: Invalid length '3G' in column specification.
ij> create table DB2LIM.FC2(FC2C CLOB(2049M));
ERROR 42X44: Invalid length '2049M' in column specification.
ij> create table DB2LIM.FC3(FC3C CLOB(2097153K));
ERROR 42X44: Invalid length '2097153K' in column specification.
ij> create table DB2LIM.FC4(FC4C CLOB(2147483648));
ERROR 42X44: Invalid length '2147483648' in column specification.
ij> -- OK 2G and end up as 2GC - 1 (with modifier)
create table DB2LIM.GC1(GC1C CLOB(2G));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GC2(GC2C CLOB(2048M));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GC3(GC3C CLOB(2097152K));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GC4(GC4C CLOB(2147483647));
0 rows inserted/updated/deleted
ij> -- next lower value
create table DB2LIM.GC5(GC5C CLOB(1G));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GC6(GC6C CLOB(2047M));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GC7(GC7C CLOB(2097151K));
0 rows inserted/updated/deleted
ij> create table DB2LIM.GC8(GC8C CLOB(2147483646));
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GC5;
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GC6;
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GC7;
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GC8;
0 rows inserted/updated/deleted
ij> -- no length (default to 1Mb)
create table DB2LIM.GC9(GC9C CLOB);
0 rows inserted/updated/deleted
ij> create table DB2LIM.GC10(GC10C CHARACTER LARGE OBJECT);
0 rows inserted/updated/deleted
ij> create table DB2LIM.GC11(GC11C CHAR LARGE OBJECT);
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GC9;
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GC10;
0 rows inserted/updated/deleted
ij> drop table DB2LIM.GC11;
0 rows inserted/updated/deleted
ij> SELECT CAST (TABLENAME AS CHAR(10)) AS T, CAST (COLUMNNAME AS CHAR(10)) AS C, CAST (COLUMNDATATYPE AS CHAR(30)) AS Y
	FROM SYS.SYSTABLES T, SYS.SYSSCHEMAS S, SYS.SYSCOLUMNS C
	WHERE S.SCHEMAID = T.SCHEMAID AND CAST(S.SCHEMANAME AS VARCHAR(128))= 'DB2LIM'
	AND C.REFERENCEID = T.TABLEID
	ORDER BY 1;
T         |C         |Y                             
----------------------------------------------------
GB1       |GB1C      |BLOB(2147483647)              
GB2       |GB2C      |BLOB(2147483647)              
GB3       |GB3C      |BLOB(2147483647)              
GB4       |GB4C      |BLOB(2147483647)              
GC1       |GC1C      |CLOB(2147483647)              
GC2       |GC2C      |CLOB(2147483647)              
GC3       |GC3C      |CLOB(2147483647)              
GC4       |GC4C      |CLOB(2147483647)              
ij> --- CHAR/VARCHAR and LOBs. (beetle 5741)
--- test that we can insert CHAR/VARCHAR directly

CREATE TABLE b (colone blob(1K));
0 rows inserted/updated/deleted
ij> VALUES '50';
1 
--
50
ij> INSERT INTO b VALUES '50';
ERROR 42821: Columns of type 'BLOB' cannot hold values of type 'CHAR'. 
ij> VALUES cast('50' as varchar(80));
1                                                                               
--------------------------------------------------------------------------------
50                                                                              
ij> INSERT INTO b VALUES cast('50' as varchar(80));
ERROR 42821: Columns of type 'BLOB' cannot hold values of type 'VARCHAR'. 
ij> VALUES (CAST('50' AS BLOB(1K)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> INSERT INTO b VALUES (CAST('50' AS BLOB(1K)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> VALUES (CAST(cast('50' as varchar(80)) AS BLOB(1K)));
ERROR 42846: Cannot convert types 'VARCHAR' to 'BLOB'.
ij> INSERT INTO b VALUES (CAST(cast('50' as varchar(80)) AS BLOB(1K)));
ERROR 42846: Cannot convert types 'VARCHAR' to 'BLOB'.
ij> VALUES cast('50' as long varchar);
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO b VALUES cast('50' as long varchar);
ERROR 42821: Columns of type 'BLOB' cannot hold values of type 'LONG VARCHAR'. 
ij> -- test w LOBs
VALUES (CAST('50' AS BLOB(1K)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> INSERT INTO b VALUES (CAST('50' AS BLOB(1K)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> VALUES (CAST('50' AS CLOB(1K)));
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO b VALUES (CAST('50' AS CLOB(1K)));
ERROR 42821: Columns of type 'BLOB' cannot hold values of type 'CLOB'. 
ij> VALUES (CAST('50' AS NCLOB(1K)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> INSERT INTO b VALUES (CAST('50' AS NCLOB(1K)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> DROP TABLE b;
0 rows inserted/updated/deleted
ij> CREATE TABLE c (colone clob(1K));
0 rows inserted/updated/deleted
ij> VALUES '50';
1 
--
50
ij> INSERT INTO c VALUES '50';
1 row inserted/updated/deleted
ij> VALUES cast('50' as varchar(80));
1                                                                               
--------------------------------------------------------------------------------
50                                                                              
ij> INSERT INTO c VALUES cast('50' as varchar(80));
1 row inserted/updated/deleted
ij> VALUES (CAST('50' AS CLOB(1K)));
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO c VALUES (CAST('50' AS CLOB(1K)));
1 row inserted/updated/deleted
ij> VALUES (CAST(cast('50' as varchar(80)) AS CLOB(1K)));
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO c VALUES (CAST(cast('50' as varchar(80)) AS CLOB(1K)));
1 row inserted/updated/deleted
ij> VALUES cast('50' as long varchar);
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO c VALUES cast('50' as long varchar);
1 row inserted/updated/deleted
ij> -- test w LOBs
VALUES (CAST('50' AS BLOB(1K)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> INSERT INTO c VALUES (CAST('50' AS BLOB(1K)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> VALUES (CAST('50' AS CLOB(1K)));
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO c VALUES (CAST('50' AS CLOB(1K)));
1 row inserted/updated/deleted
ij> VALUES (CAST('50' AS NCLOB(1K)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> INSERT INTO c VALUES (CAST('50' AS NCLOB(1K)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> DROP TABLE c;
0 rows inserted/updated/deleted
ij> CREATE TABLE n (colone clob(1K));
0 rows inserted/updated/deleted
ij> VALUES '50';
1 
--
50
ij> INSERT INTO n VALUES '50';
1 row inserted/updated/deleted
ij> VALUES cast('50' as varchar(80));
1                                                                               
--------------------------------------------------------------------------------
50                                                                              
ij> INSERT INTO n VALUES cast('50' as varchar(80));
1 row inserted/updated/deleted
ij> VALUES (CAST('50' AS CLOB(1K)));
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO n VALUES (CAST('50' AS CLOB(1K)));
1 row inserted/updated/deleted
ij> VALUES (CAST(cast('50' as varchar(80)) AS CLOB(1K)));
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO n VALUES (CAST(cast('50' as varchar(80)) AS CLOB(1K)));
1 row inserted/updated/deleted
ij> VALUES cast('50' as long varchar);
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO n VALUES cast('50' as long varchar);
1 row inserted/updated/deleted
ij> -- test w LOBs
VALUES (CAST('50' AS BLOB(1K)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> INSERT INTO n VALUES (CAST('50' AS BLOB(1K)));
ERROR 42846: Cannot convert types 'CHAR' to 'BLOB'.
ij> VALUES (CAST('50' AS CLOB(1K)));
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
50                                                                                                                              
ij> INSERT INTO n VALUES (CAST('50' AS CLOB(1K)));
1 row inserted/updated/deleted
ij> VALUES (CAST('50' AS NCLOB(1K)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> INSERT INTO n VALUES (CAST('50' AS NCLOB(1K)));
ERROR 0A000: Feature not implemented: NCLOB.
ij> DROP TABLE n;
0 rows inserted/updated/deleted
ij>