with or without “Returning … Into,” into the sql command, the instruction
Var b As Boolean = cmd.FetchNext
generates this SqlErrorExceptionMBS:
ORA-24374: define not done before fetch or execute and fetch
Var con As SQLConnectionMBS = Session.db
Var sql As String = " INSERT INTO T1 (c2) VALUES (‘c’) RETURNING Id INTO :RetId "
Var cmd As New SQLCommandMBS (con,sql)
cmd.Execute
the parameters dictionary before and after Execute:
I don’t know anything about Oracle, but this “:RetId” looks fishy to me. Have you tried omitting the colon?
And: Check your Oracle log files, maybe they contain more information about the exact nature of the problem.
Looking at the documentation here, it should just work:
Not sure why it fails. And I have no oracle sever here to try.
I wonder for SQLParamMBS whether the parameter is maybe not marked as output parameter?
Can you query the SQLParamMBS object using Param(“RetId”) in SQLCommandMBS class and then check if IsOutput or IsInput is set?
Maybe change the type before the Execute to fix?
it is possible something in the SqlAPI++ documentation could help me, but I have not found it.
I tried it this way:
Var con As SQLConnectionMBS = Session.db
Var sql As String = " INSERT INTO T1 (c2) VALUES (‘c’) RETURNING Id INTO :return_value "
Var cmd As New SQLCommandMBS (con,sql)
cmd.Param(“return_value”).type = SQLParamMBS.kParamDirTypeOutput
Var b1 As Boolean = cmd.Param(“return_value”).IsInput
Var b2 As Boolean = cmd.Param(“return_value”).IsOutput
Var i1 As Integer = cmd.Param(“return_value”).DirType
Var i2 As Integer = cmd.Param(“return_value”).Type
cmd.Execute