Open tgulacsi opened 1 week ago
Hi @tgulacsi, what DB & client lib version are you using? When you say sometimes, do you mean 'always fails for some types'?
Client: 19.23.0.0.0 Server: 19.23.0.0.0
Somtimes = some types. For this type, this fails always, reproducibly.
It is the same (errors) with
I've tried to assemble a minimal reproductor:
unzip ORA21062.zip
cd ORA21062
env ORACALL_DSN=user/passw@host:1521/service_name go test
I tried your code but it fails with the type not existing. Is there something that creates it?
I found a way to test with Python instead and can confirm that this error occurs when you try to set an attribute of a record with an instance of another record. I am asking internally if there is a solution or if this is simply not possible. It may be possible with PL/SQL -- which you can generate if necessary -- but that's an unpleasant workaround.
Thanks for the idea!
func setAttribute(ctx context.Context, ex godror.Execer, obj *godror.Object, name string, data *godror.Data) error {
if err := obj.SetAttribute(name, data); err != nil {
var ec interface{ Code() int }
if !errors.As(err, &ec) && ec.Code() == 21602 {
return err
}
qry := fmt.Sprintf(`DECLARE
v_obj %s := :1;
BEGIN
v_obj.%s := :2;
:3 := v_obj;
END;`,
obj.ObjectType.PackageName+"."+obj.ObjectType.Name,
name,
)
_, xErr := ex.ExecContext(ctx, qry, obj, data.GetObject(), sql.Out{Dest: obj})
if xErr != nil {
return fmt.Errorf("%s: %w: %w", qry, xErr, err)
}
}
return nil
}
works, thank you!
(I'll wait with closing this issue till you confirm that this is a bug/missing feature in OCI).
(Another strange phenomenon is that is a record type contains a NUMBER(10), represented as SQLT_INT (int64), and this record type is an attribute of another record type, and this gets this ORA-21602, thus I try the aforementioned PL/SQL workaround, then I get ORA-21525. If I handle such numbers with strings, then this is error does not appear.)
Hi,
I'd like to use
dpiObject_setAttribute
to build an object wich attributes are themselves objects, too.Sometimes (for some types) this works, but sometimes it fails with OCI-21602. For example
dpiObjectAttr_getInfo returns ociTypeCode=250 = SQLT_REC = OCI_TYPECODE_RECORD for this FONT attribute.
Any help would be appreciated, thanks in advance!