我有使用#include <occi.h>
的C ++代码:
std::vector< std::string > arr{"qw", "er", "ty"};
stmt = conn->createStatement(
"BEGIN Clear_labels(:p_list1); END;");
setVector(stmt,1,arr,"MYCUSTOMTYPE");
stmt->execute();
现在我想要写PL / SQL命令相同commad发送到数据库。
MYCUSTOMTYPE:
TYPE "MYCUSTOMTYPE" as table of varchar2(255)
我认为应该是这样的:
DECLARE list MYCUSTOMTYPE := MYCUSTOMTYPE("qw", "er", "ty")
BEGIN Clear_labels(list); END;
/
但我收到错误消息:
Invalid SQL type: sqlKind = UNINITIALIZED
org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error [17439] [99999]: Invalid SQL type: sqlKind = UNINITIALIZED
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:134)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:467)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$0(SQLQueryJob.java:407)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:146)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:405)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:849)
at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:2727)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:98)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:146)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:96)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.sql.SQLException: Invalid SQL type: sqlKind = UNINITIALIZED
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:74)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:30)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:931)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1150)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1792)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1745)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:334)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:338)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:131)
... 11 more
答案 0 :(得分:0)
我决定尝试sqlplus
,结果证明是成功的:
$ sqlplus tests/tests@cdb1
SQL*Plus: Release 11.2.0.4.0 Production on Thu May 9 02:22:50 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
SQL> DECLARE
2 p_list1 MYCUSTOMTYPE := MYCUSTOMTYPE('qw', 'er', 'ty');
3 BEGIN
4 Clear_labels(p_list1);
5 END;
6 /
PL/SQL procedure successfully completed.
SQL>
我认为是DBeaver
中的问题。