Closed dened3 closed 1 month ago
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 vfile 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) }
create or replace type Tfile as object ( file_id number(20), file_body clob )
udt:"FILE_ID"
udt:"FILE_BODY"
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;
func main() { db := connect() defer db.Close() testFile(db) } // Output err test: ORA-65502: cannot access temporary LOB data
cant repro with another text
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 intudt:"FILE_ID"
File_body stringudt:"FILE_BODY"
} err := go_ora.RegisterType(db, "TFILE", "", TypeFile{}) if err != nil { fmt.Println("err RegisterType TypeFile:", err) } var vfile 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