error in insert record in oracle whose primary key is autonumber

Good day!

i having a problem in inserting new record in yii with oracle as my DB…

CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 1741 OCIStmtPrepare: ORA-01741: illegal zero-length identifier

(ext\pdo_oci\oci_driver.c:279)

the primary key of my table is based on trigger.

CREATE TABLE "ADMIN"."BK_R_BOOK_103"

( "BOOK_UID" NUMBER(18,0) primary key,

"DESCRIPTION" VARCHAR2(100 BYTE),

"PURPOSE" VARCHAR2(200 BYTE)

);

CREATE OR REPLACE TRIGGER "ADMIN"."BK_R_BOOK_103_TRIG"

before insert on "ADMIN"."BK_R_BOOK_103"

for each row

begin

if inserting then

if :NEW."BOOK_UID" is null then

select BK_R_BOOK_103_SEQ.nextval into :NEW."BOOK_UID" from dual;

end if;

end if;

end;

hope you can help me with this…

god bless

thanks.

NOTE: I never used oracle…

It would help if you post your code… One thing you can try is to set the $model->book_uid to null…

Have you solved this problem?

I’m having the same issue.

Hi, i’m having the same issue.

I do this trick :

  • Edit file COciCommandBuilder.php at line 113



$sql.=' RETURNING "'.$column->rawName.'" INTO :RETURN_ID';



  • Remove the double quote



$sql.=' RETURNING '.$column->rawName.' INTO :RETURN_ID';