You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a query with several fields and these fields are of type string, date, int and clob and this query will return several rows.
I'm running a DB.query and returning the rows, but the CLob field is already returned to me as a string in the row and does not contain all the bytes of the CLb.
Note: I can't type my fields as go_ora.clob because of my logic.
The logic is as follows:
func Open(){
var dataset []map[string]*any
rows, err = ds.Connection.DB.Query(query, ds.GetParams()...)
fieldTypes, _ := rows.ColumnTypes()
fields, _ := rows.Columns()
for rows.Next() {
columns := make([]any, len(fields))
for i := 0; i < len(columns); i++ {
columns[i] = &columns[i]
}
err := rows.Scan(columns...) // <--- Here the CLob column already has a string
if err != nil {
print(err)
}
line := make(map[string]*any)
for i := 0; i < len(columns); i++ {
line[strings.ToUpper(fields[i])] = columns[i]
}
dataset = append(dataset, line)
}
}
columns[0] <----- Here it already brings me the CLob column as a string because the field type is ANY.
Internally in go_ora, it cannot identify that the field is of type OCIClobLocator and perform the correct conversion bringing all the CLob bytes?
The text was updated successfully, but these errors were encountered:
so these oracle types will be converted internally into the corresponding go types
oracle type
go type
CLOB
string
NCLOB
string
BLOB
[]byte
if your data is larger than 32kb so you should use url option lob fetch=post it is not the default option because it slightly slow down the query. (note default will return clob as varchar2 and nclob as nvarchar2 and blob as raw)
I have a query with several fields and these fields are of type string, date, int and clob and this query will return several rows.
I'm running a DB.query and returning the rows, but the CLob field is already returned to me as a string in the row and does not contain all the bytes of the CLb.
Note: I can't type my fields as go_ora.clob because of my logic.
The logic is as follows:
columns[0] <----- Here it already brings me the CLob column as a string because the field type is ANY.
Internally in go_ora, it cannot identify that the field is of type OCIClobLocator and perform the correct conversion bringing all the CLob bytes?
The text was updated successfully, but these errors were encountered: