sijms/go-ora

UDT with CLOB. out param. ORA-65502: cannot access temporary LOB data

Closed this issue · 1 comments

HI
Maybe I don't know how to use it ((

// Oracle Type
create or replace type Tfile as object ( file_id number(20), file_body clob )
// Go code
func testFile(db *sql.DB) {
type TypeFile struct {
File_id int udt:"FILE_ID"
File_body string udt:"FILE_BODY"
}
err := go_ora.RegisterType(db, "TFILE", "", TypeFile{})
if err != nil {
fmt.Println("err RegisterType TypeFile:", err)
}
var v_file TypeFile
_, err = db.Exec( declare v_file Tfile := Tfile(1, '12'); begin for i in 1..1000 loop dbms_lob.append(v_file.file_body, 'dsjfkjsdlkfjsdlkfjdslkjflkdsjflksdjflksdjflksf'); end loop; :file_out := v_file; end;,
sql.Named("file_out", go_ora.Out{Dest: &v_file}),
)
if err != nil {
fmt.Println("err test:", err)
return
}
fmt.Println("v_file:", v_file)
}

func main() {
db := connect()
defer db.Close()
testFile(db)
}
// Output
err test: ORA-65502: cannot access temporary LOB data

cant repro with another text