Oracle error with a NUMBER field

Hi,

I am testing Yii with 3 tables and 4 Database Server.

All do work well, except 1 Oracle table that has a NUMBER field:

CREATE TABLE "EXEMPLO"."SERVICO" (

  "CHAVE" VARCHAR2(10 BYTE) NOT NULL ENABLE,

  "DESCRICAO" VARCHAR2(100 BYTE) NOT NULL ENABLE,

  "PRECO" NUMBER(11,2) NOT NULL ENABLE,

  "DATE_TIME" TIMESTAMP (3)

)

When I try to create a record, I get the following error:

CDbException

D:\php\yii\framework\db\CDbCommand.php(221)

00221: throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',

I have included some "echos" in my code:

public function bindValue($name, $value, $dataType=null)

{

  echo $name . "-" . $value . "-" . $dataType . "<br />"; 

  echo '<br />';

and

public function execute()

{

  print_r($this->_params); 

  echo '<br />';

  echo $this->getText() . '<br />';

  echo '<br />';

And got the following results:

:CHAVE-1-

:DESCRICAO-11-

:PRECO-1-

:DATE_TIME-09/07/2009 09:58:31-

Array ( )

INSERT INTO SERVICO (CHAVE, DESCRICAO, PRECO, DATE_TIME) VALUES (:CHAVE, :DESCRICAO, :PRECO, :DATE_TIME) RETURNING CHAVE INTO :RETURN_ID

It seems ok for me: but does not work !

The other 2 tables, with VARCHAR and DATETIME fields do work fine.

Thanks

Please, wait. I am debuging it.

siegmar, CHAVE is the primary key of your table?

Yes, below you find the complete SQL:

CREATE TABLE SERVICO

(

CHAVE VARCHAR2(10) NOT NULL,

DESCRICAO VARCHAR2(100) NOT NULL,

PRECO NUMERIC(11,2) NOT NULL,

DATE_TIME TIMESTAMP(3)

);

ALTER TABLE SERVICO ADD CONSTRAINT PKSERVICO PRIMARY KEY (CHAVE);

CREATE INDEX IXSERVICO0 ON SERVICO(DATE_TIME);

CREATE INDEX IXSERVICO1 ON SERVICO(DESCRICAO);

Please, how do you fill your primary key?

Autoincrement, manually or something else?

The field "CHAVE" is not autoincrement.

I fill the value typing in the textbox.

(After so much time…)

I think that I have found the error. I am seeing this and will be back soon with a correction.

thanks!!!! :rolleyes:


streaming movies