For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > November 2004 > how can i set a large String to a xmltype field use PHP?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how can i set a large String to a xmltype field use PHP?
Javagen

2004-11-27, 8:55 am

i can set xml String to xmltype field with:

$sql_insert_sql = "insert into g_province
(p_id,p_regionid,p_provincenameobj,solt)

values
(g_province_q.nextval,'".$_GET['region_id']."',sys.XMLTYPE.createXML('".$xml
_con."'),0)";

but if $xml_con too long,i can not set this content into xmltype fields.

then , i use :
****************************************
********
<?
/*
//(tabel_name:articles)DDL; //just for test;
//create table articles (id number(11),content sys.xmltype);
*/
//----------This is insert test----------------------------------
$conn = @OCILogon("in_user","user_in","bigfish");
$stmt = @OCIParse($conn,"insert into articles (id,content)
values(1,xmltype(EMPTY_CLOB())) RETURNING content INTO:CONTENT");
$clob = @OCINewDescriptor($conn,OCI_D_LOB);
OCIBindByName($stmt,':CONTENT',&$clob,"1",OCI_B_CLOB);
OCIExecute($stmt,OCI_DEFAULT);
if ($clob->save("<root><a>JUST TEST</a></root>")){
OCICommit($conn);
echo "Insert succes!";
}
else{
echo "Insert default!";
}
//---------------Insert end-----------------------------------------
//---------------Select start---------------------------------------
$sql = "select content from articles order by id desc";
$stmt = @OCIParse($conn,$sql);
@OCIExecute($stmt,OCI_DEFAULT);
@OCIFetchInto($stmt,&$rows,OCI_RETURN_LOBS);
echo "<br>Content is:\"".$rows[0]."\"";
//---------------Select end-----------------------------------------
?>

**************
run it ,display these errors:

Warning: ociexecute(): OCIStmtExecute: ORA-22816: unsupported feature with
RETURNING clause in /home/www/bigfish/sgtest/testclob.php on line 12

Warning: save(): OCILobWrite: OCI_INVALID_HANDLE in
/home/www/bigfish/sgtest/testclob.php on line 13
Insert default!
Content is:""
Warning: Unknown(): _oci_close_session: OCISessionEnd: ORA-00600: internal
error code, arguments: [729], [28], [space leak], [], [], [], [], [] in
Unknown on line 0



how can i set long content to xmltype fields??
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com