Good Morning
I am having a problem with trying to get a returned value for some test data. Here is my code for making the table:
CREATE TABLE TABLE1
(
ID NUMBER(*, 0) GENERATED ALWAYS AS IDENTITY INCREMENT BY 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 CACHE 20 NOT NULL
, NAME VARCHAR2(20 BYTE) NOT NULL
, CONSTRAINT TABLE1_PK PRIMARY KEY (ID )
)
Here is my Basic code to insert and hopefully return some the id key column:
Option Explicit
Sub main
Dim stmt As Object
Dim resultset As object
oraCon =makeOracleODBCConnection("TESTDSN")
Set stmt= oraCon.prepareCall("INSERT INTO TABLE1 (NAME) VALUES (?) RETURNING ID INTO ?" )
stmt.setString(1, "FREDO")
stmt.registerOutParameter(2, com.sun.star.sdbc.DataType.INTEGER,-1)
stmt.executeUpdate()
While resultSet.Next
Print stmt.getInt(1)
wend
closeDBObject(resultSet)
closeDBObject(stmt)
closeDBObject(oraCon)
End Sub
function makeOracleODBCConnection(src As String) As com.sun.star.sdbc.XConnection
sUser$ = "MY_USERNAME"
sPass$ = "MY_PASSWORD"
sURL$ ="sdbc:ado:DSN="& src & ";Uid="& sUser$ &";PWD=" & sPass$
makeOracleODBCConnection= connectionManager(sURL)
End Function
Function connectionManager(sURL As String) As com.sun.star.sdbc.XConnection
oManager = CreateUnoService("com.sun.star.sdbc.DriverManager")
connectionManager= oManager.getConnection(sURL)
End Function
Sub closeDBObject(dbObject As Object)
dbObject.close()
dbObject = Nothing
End Sub
I get the error message:
BASIC runtime error.
Property or method not found: registerOutParameter.
Thank you for all of your help.