Update Database Problem "too long string literal"

Asked

Viewed 215 times

2

I have a problem when it comes to Update of a content to the database, below the code used for the Update

public function atualizar_conteudo_manual() {
    $dadosmanual_update = array ("id_processo_manual"=>$this->id,
    "conteudo"=>$this->conteudo);
    $this->db->where('id_processo_manual', $dadosmanual_update['id_processo_manual']);
    $this->db->set('conteudo', $dadosmanual_update['conteudo']);
    $this->db->update('tb_processos_manuais',$dadosmanual_update);
}

Well, I can do the Update of the content, but when it is too long the following error occurs:

Message: "oci_execute(): ORA-01704: too long string literal"

I would like to know if a conversion to another type of data is possible before the Update, for this problem not to occur. Preferably the conversion to type Blob.

  • invert the set with Where

  • ok reversed, but the question is not that

  • That I remember it would already solve your problem, it didn’t work?

  • You’re using which database?

  • I am using Oracle Database

  • Take off the set to test.

  • I took, the error remains with a large amount of data, with little it works even without the set

Show 2 more comments

1 answer

0


Problem of Update Too extensive content for the database, solved with OCI commands for communication with the Oracle database, follows the code:

public function atualizar_conteudo_manual(){
        $sql = "UPDATE tb_processos_manuais SET conteudo = ' ' , titulo = :titulo, chave_amigavel = :chave_amigavel WHERE id_processo_manual = :id RETURNING conteudo into :conteudo";
        $stmt = oci_parse($this->db->conn_id, $sql);
        $lob = oci_new_descriptor($this->db->conn_id, OCI_D_LOB); 
        oci_bind_by_name($stmt, ':conteudo', $lob, -1, OCI_B_CLOB);
        oci_bind_by_name($stmt, ':titulo', $this->titulo,50);
        oci_bind_by_name($stmt, ':chave_amigavel', $this->chave_amigavel,50);
        oci_bind_by_name($stmt, ':id', $this->id,5);
        oci_execute($stmt, OCI_NO_AUTO_COMMIT);
        $lob->save($this->conteudo);        
        oci_commit($this->db->conn_id);        
        oci_free_statement($stmt);
        $lob->free();
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.