﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33339	bulk_create() uses TO_CLOB() for NCLOB fields on Oracle.	Georgi Yanchev	Georgi Yanchev	"Consider the model, containing one TextField


{{{
from django.db import models

class Bar(models.Model):
    baz = models.TextField()
}}}

When you make a bulk_create request, e.g. Bar.objects.bulk_create([b0, b1]) you will get generate a query like below.
{{{
INSERT INTO ""PROJECT_BAR"" (""BAZ"") SELECT * FROM (SELECT TO_CLOB(:arg1) col_0 FROM DUAL UNION ALL SELECT TO_CLOB(:arg0) FROM DUAL)
}}}

This will be accepted by Oracle, but it will create a log file, named something like {{{DBNAME_ora_6613.trc}}}, which contains errors:

{{{
ORA-12704(1): dty=112 typ=1 flg=00220000 xfl=00040000 bfl=4000 bfc=0 csfm=2 csid=2000 csflg=0 collid=16382 cclvl=2
ORA-12704(2): dty=112 typ=2 flg=00230000 xfl=00000000 bfl=4000 bfc=0 csfm=1 csid=873 csflg=0 collid=16382 cclvl=3 op=184 opc=1
ORA-12704(2): dty=1 typ=3 flg=00030081 xfl=00040000 bfl=2000 bfc=2000 csfm=1 csid=873 csflg=0 collid=16382 cclvl=3 styp=1
}}}

The problem is that field {{{PROJECT_BAR.BAZ}}} is of type {{{NCLOB}}}, but Django uses {{{TO_CLOB}}}, instead of {{{TO_NCLOB}}}."	Bug	closed	Database layer (models, ORM)	3.2	Normal	fixed	oracle		Accepted	1	0	0	0	0	0
