Oracle - mostrar en web.php campo tipo CLOB

 
Vista:

mostrar en web.php campo tipo CLOB

Publicado por Yurisleidy Hernandez Moya (1 intervención) el 26/08/2006 22:44:36
Tengo una tabla con un campo tipo CLOB y lo quiero mostrar en mi pagina web, trabajo con php. Como podria hacer eso?
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:mostrar en web.php campo tipo CLOB

Publicado por Rodolfo Reyes (445 intervenciones) el 28/08/2006 17:26:16
Yo tengo un proceso que lo muestra en ASP, las funciones a las que llamas son exactamente la mismas solo tienes que cambiarlas para la sintaxis de PHP.

- CLOBRead - ASP/VBScript function reads CLOB data
' - This ASP function reads a CLOB (character large object field) from your Oracle table.
' - You must specify the Oracle table, column name, where clause, and DSN string.
' - Table: name of Oracle table where your data resides.
' - Column: name of column (with a datatype of CLOB) in your Oracle table where your data resides.
' - Where clause: what you would specify in your SQL call to get your data, such as (select lots_of_customer_info_columnname from customer_table where) "CustomerID='123456'"
' - DSN: data source name. Should be either:
' - 1. application("CustomerDB_DSN") (if you're using global.asa in the root path of your webserver)
' - 2. "DRIVER={Oracle ODBC Driver};DBQ=ora.domain.com;UID=userid;pwd=password"
' - Call using:
' - strReturnString=CLOBRead(strTable, strCLOBColumn, strWhereClause, strDSN)
' - Example:
' - strBigOracleString=CLOBRead("customer_table", "lots_of_customer_info_columnname", "CustomerID='"&strCustomerID&"'", application("CustomerDB_DSN"))
' - Note: This function returns only one string (at a time).

function CLOBRead(strTableCR, strCLOBColumnCR, strWhereClauseCR, strConnectionStringCR)
on error resume next
dim conDBOracleGenericReadCR, strStringReturnedCR
dim intCLOBLengthCR, intStartCR, strSQLCR
const intSegmentLengthCR=4000
strStringReturnedCR=""
set conDBOracleGenericReadCR=server.CreateObject("ADODB.Recordset")
strSQLCR="select dbms_lob.getlength(" & strCLOBColumnCR & ") as CLOBLength from " & strTableCR & " where " & strWhereClauseCR & ";"
conDBOracleGenericReadCR.open strSQLCR, strConnectionStringCR
if err.number<>0 then
response.write "CLOBRead() error: Error in SQL call<br>"
response.write "Table: " & strTableCR
response.write "Column: <b>" & strCLOBColumnCR & "</b><br>"
response.write "Where clause: <b>" & strWhereClauseCR & "</b><br>"
response.write "Connection string: <b>" & strConnectionStringCR & "</b><br>"
response.write "SQL statement generated: <b>" & strSQLCR & "</b><br>"
err.clear
else
intCLOBLengthCR=conDBOracleGenericReadCR("CLOBLength")
conDBOracleGenericReadCR.close
intStartCR=1
if intCLOBLengthCR>0 then
do
conDBOracleGenericReadCR.open "select dbms_lob.substr(" & strCLOBColumnCR & ", " & intSegmentLengthCR & ", " & intStartCR & ") as CLOBSegment from " & strTableCR & " where " & strWhereClauseCR, strConnectionStringCR
strStringReturnedCR=strStringReturnedCR & conDBOracleGenericReadCR("CLOBSegment")
conDBOracleGenericReadCR.close
intStartCR=intStartCR+intSegmentLengthCR
loop until intStartCR=>intCLOBLengthCR
end if
end if
set conDBOracleGenericReadCR=nothing
CLOBRead=strStringReturnedCR
end function
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar