Home » Open Source » Programming Interfaces » LONG type - ORA-01704: string literal too long - Php
LONG type - ORA-01704: string literal too long - Php [message #51246] Wed, 08 May 2002 19:09 Go to next message
VerĂ³nica
Messages: 3
Registered: November 2001
Junior Member
Hello!
I'm working with an Oracle database from Php scripts.
I use Php OCI functions to work with the database (OCILogOn, OCILogOff, OCIParse, OCIExecute, etc.).
One of the tables has a LONG field, and I'm having trouble when trying to save long strings (longer than 4000 bytes) in that field.
I'm treating that field like a Varchar2 field in inserts and updates.
Could anyone tell me how to save those long strings in the LONG field? I'm new to Oracle, and I must solve this problem real fast.
Thanks!!!!!!!!!!
Re: LONG type - ORA-01704: string literal too long - Php [message #51256 is a reply to message #51246] Thu, 09 May 2002 22:59 Go to previous messageGo to next message
Peter
Messages: 62
Registered: August 2000
Member
try www.phpbuilder.com

I have not tried this with long columns as such,
Though I have done this with clobs not that this helps, but if you are still developing clobs may be a better option than longs

$conn=OCILogon("username","password");
$clob = OCINewDescriptor($conn, OCI_D_LOB);
//setup the query
$query = "update DB_NOTES set $updating_column = ".
"EMPTY_CLOB() where criteria = 'X' ".
"returning $updateing_columninto :THE_CLOB";

$stmt = OCIParse($conn, $query);

// then bind the :THE_CLOB to $clob
OCIBindByName($stmt, ":THE_CLOB", &$clob, -1, OCI_B_CLOB);

OCIExecute($stmt, OCI_DEFAULT);
// this saves the information to the database via the descriptor
$clob->save($the_data);
OCICommit($conn);
OCIFreeStatement($stmt);
OCILogoff($conn);
Re: LONG type - ORA-01704: string literal too long - Php [message #51275 is a reply to message #51256] Sat, 11 May 2002 11:31 Go to previous message
VerĂ³nica
Messages: 3
Registered: November 2001
Junior Member
Thanks !!
I finally could solve the problem.
Here's what I did, in case it's useful for someone else:

$stmt = OCIParse($conn,"INSERT INTO table VALUES (:algo)");

$texto = "...long long string...";
OCIBindByName($stmt,":algo",&$texto,-1);
OCIExecute($stmt);
Previous Topic: about php & oracle
Next Topic: Create stored procudere in PHP ?
Goto Forum:
  


Current Time: Wed Sep 17 18:58:10 CDT 2014

Total time taken to generate the page: 0.06815 seconds